G54.APP

G-code deep dive

G43 Tool Length Offset: How the H Word Works

G43G44G49G43.1G10 L1

Every tool sticks out of the spindle a different amount. Tool length offset is how one program runs them all: G43 Hn tells the control "add tool n's stored length to every Z coordinate," so Z0 means the tool tip touching the part zero — whichever tool is loaded.

T2 M6              ; load tool 2
G43 H2             ; apply its length — Z now means tool tip
G0 Z5              ; tip to 5 above part zero: safe for ANY tool length
G1 Z-2 F200        ; cut

The G43 line belongs immediately after every tool change, before the first Z move. That pairing — Tn M6 then G43 Hn — is the most safety-critical two lines a post processor emits.

How the number gets into the table

Tool lengths are measured, not programmed: touch each tool to a reference (the part top, a gauge block, a tool setter) and store the result. In G-code, G10 L1 P<tool> R<value> writes a register directly, and GRBL setups typically probe each tool and apply the measured value with G43.1. However it gets there, the program only ever says G43 Hn — the table owns the truth.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4Notes
Tool length offset (positive) G43 G43 G43 G43 G43 H word selects the TLO register.
Tool length offset (negative) G44 G44 Rarely used; FANUC-style. Centroid documents G44 in CNC12.
Dynamic tool length offset (in source) G43.1 G43.1
Cancel tool length offset G49 G49 G49 G49 G49 G49
Set tool-table entry directly G10 L1 G10 L1 G10 L1 G10 L1 G10 L1 P = tool number, R = value. Centroid documents this in CNC12. LinuxCNC: partial
Set tool length so current pos = value G10 L10 G10 L10 G10 L10 G10 L10 G10 L10 LinuxCNC: partial

— means the control has no equivalent code. Full cross-control tables: the complete G-code & M-code reference.

Length offset + work offset: the Z stack

The Z position the machine actually moves to is a sum:

machine Z = work-offset Z  +  programmed Z  +  tool length (G43)

When a Z crash happens, one of those three terms is wrong. The usual suspects, in order: G43 missing entirely, the wrong H number (tool 5's length applied to tool 3), or a work offset touched off with a different tool than the one now loaded. A viewer that shows tool tip position and active offsets turns this from detective work into a glance.

Common mistakes

Frequently asked questions

What does G43 H1 mean?

Apply tool length compensation using the length stored in tool-table register 1. After it, Z coordinates in the program refer to the tool tip instead of the spindle nose. By convention H matches the tool number: T1 M6 G43 H1.

What happens if I forget G43 after a tool change?

The control moves the spindle as if the tool had zero length. With a real tool in the spindle, every Z move sits too low by the tool's full length — the classic Z crash. Simulating first, or using a control that alarms on motion without an active offset, catches it.

What is the difference between G43 and G43.1?

G43 reads the length from the tool table via the H word. G43.1 (LinuxCNC, GRBL) takes the offset value directly in the block — no table lookup. G43.1 is what tool-length-probe workflows on GRBL machines use.

Do I need G49 before a tool change?

Usually not — M6 or the next G43 replaces the active offset on most controls, and most posts just issue the new G43 Hn after each change. G49 matters when you genuinely want no length comp active, such as spindle-probe moves or park positions commanded in machine coordinates.

See it, don't guess it

Paste a program into the free G54.APP viewer and watch these codes execute — toolpaths, stock removal, and machine state, live in your browser. Nothing is uploaded.

Open the G-code viewer