In a CNC mill, you might have a stubby face mill that sticks out 2 inches50 mm from the spindle, right next to a drill that sticks out 6 inches150 mm. How does the machine know where the tip of each tool actually is? The answer is Tool Length Compensation (G43).

1. The Problem: The Spindle is Blind

When you set your Work Coordinate System (G54 Z0), you are telling the machine where the top of the part is relative to the empty spindle nose (or a master reference point). Without compensation, if you command the machine to go to Z0.0, it will try to drive the spindle nose all the way down to the part—completely ignoring any tool you have in the spindle, resulting in a catastrophic crash.

What is G43?

G43 (Tool Length Compensation Positive) tells the machine to mathematically shift the Z-axis by the length of the tool currently in the spindle. It effectively tells the controller: "Stop looking at the spindle nose, and start looking at the tip of the tool."

2. The 'H' Word: Where to Find the Length

G43 alone isn't enough; the machine needs to know *how long* the tool is. It gets this value from the Tool Offset Table, specifically the H (Height) register.

(Tool 1 is in the spindle)
G43 H01 Z1.0 (Apply length offset 1, rapid to 1" above part)

If Tool 1 has been "touched off" (measured) and its length is 4.500"114.3 mm, the machine will look in register H01, see that value, and stop the spindle 4.500"114.3 mm higher than it normally would, safely placing the tip of the tool at Z1.0.

The Golden Rule: T = H = D

To avoid confusion and crashes, professional shops follow a strict numbering rule: The Tool number (T), Height offset number (H), and Diameter offset number (D) must all match.

Example: Tool 5 (T5) must always use H05 for its length and D05 for its cutter compensation.

3. The "Touch Off" Process

Before you run a program, you must populate the H-registers. This is done by measuring the tools. Modern machines use automated tool setters (laser or physical probes) that automatically write the length to the H-register.

If you don't have a tool setter, you must manually "touch off" by jogging the tool down to a known surface (like a 1-2-3 block or a piece of paper on the part) and recording the machine's Z-position into the offset table.

4. The Most Common Cause of Z-Crashes

Mismatched H-Words

The deadliest typo in CNC programming is calling the wrong H-number.

Imagine you have a short end mill in Tool 1 (H01 = 2.0"50mm) and a long drill in Tool 2 (H02 = 6.0"150mm). If you load Tool 2, but accidentally type G43 H01, the machine thinks the tool is much shorter than it actually is. It will drive that 6-inch150mm drill 4 inches100mm straight into your table at rapid speed.

5. Safe Approach Sequencing

You should always call your G43 on the very first Z-axis approach move after a tool change. This gives the machine a chance to apply the math while it is still high up in the air.

(Safe Tool Approach Example)
T1 M06 (Change to Tool 1)
G00 G90 G54 X0.0 Y0.0 (Rapid to X/Y start position FIRST)
G43 H01 Z1.0 (Apply length comp and rapid to safe Z clearance)
G01 Z-0.5 F20.0 (Begin feed move)

6. G49: Canceling Tool Length

Just like cutter comp, tool length comp should be canceled before a tool change to ensure the machine's internal coordinates return to a known state.

You can use G49 (Tool Length Compensation Cancel), but in modern programming, it is safer to use G53 (Machine Coordinates) to retract the Z-axis, as G53 inherently ignores the H-offset.

(Safe Retract and Cancel)
G53 G00 Z0.0 (Rapid Z straight up to Machine Home, ignoring G43)
G49 (Cancel the active tool length compensation)
M01 (Optional Stop)

Verify Your Code

Always verify that your T-number matches your H-number before hitting Cycle Start. Use our G-Code Viewer to step through your program visually and ensure your toolpaths approach from a safe Z-clearance plane.

Open G-Code Viewer

Conclusion

G43 is arguably the most dangerous G-code to mismanage because it directly controls vertical positioning at rapid speeds. By understanding how the H-register works, religiously matching your T and H numbers, and always applying G43 well above the part, you can eliminate the most common cause of CNC crashes.