G49 G-Code: How to Cancel Tool Length Compensation

G49 cancels tool length compensation on your CNC machine. Once you call it, the machine stops accounting for any H offset. From that point on, it moves the spindle nose — not the tip of the cutting tool — to each programmed location.

You’ll almost always be running a tool. So G49 isn’t something most programmers use all the time. But it’s worth understanding so you know what it does and how to use it safely if you need it.

Key Takeaways

  • G49 cancels tool length compensation
  • After G49, the machine moves the spindle nose, not the tool tip
  • It’s rarely required — most programs never call it at all
  • Some machines immediately shift position when G49 is called, which can cause a crash
  • Tool length comp is also cancelled by M30, a control reset, or by calling H0
G49 – At A Glance
FunctionCancel tool length compensation
TypeModal (Group 8)
Cancelled byG43, G44
Related codesG43, G44, H code

What does G49 do?

G49 turns off tool length compensation. That means the machine no longer adjusts for the physical length of the cutting tool.

When you use a G43 or G44 code, you’re telling the machine: “This tool is a certain length — account for it when you move in Z.” G49 cancels that. The machine goes back to moving the raw spindle position with no offset applied.

an illustration of a cnc machine that shows how a g43 code offsets the program

What is tool length compensation?

Tool length compensation is how your CNC accounts for the fact that every cutting tool is a different length. You measure each tool and enter that value into the offset library as an H offset.

illustration of a cnc cutting tool that shows what an H offset is

When you program G43 H02, you’re saying: “Turn on tool length compensation using offset number 2.” The machine reads that value and adjusts all Z moves accordingly.

mach 3 tool offset table
A tool offset library

This is important because your program is written to a specific reference point — usually the top of the part. Without tool length compensation, the machine has no idea how long the tool is and can’t hit the right depth.

Where do you actually see G49?

Most programs don’t call G49 at all.

You’ll almost always have a tool loaded, and you’ll almost always want the machine to account for that tool’s length. Canceling that compensation mid-program is rarely useful.

Some programmers include G49 in their safety block — a group of codes at the start of a program that resets the machine to a known state. Others skip it and just make sure the correct H offset is called whenever they change tools.

As long as you’re calling the right offset for the currently loaded tool, G49 is optional.

Code examplE

Here’s a typical tool change section where G49 would appear:

G49                      (Cancel tool length compensation)
G91 G28 Z0               (Return to machine home in Z)
M06 T02                  (Tool change to tool 2)
G90 G54 G00 X0 Y0        (Move to part zero)
G43 H02 Z1.0             (Apply tool 2 length offset, move to clearance)

G49 is called before the Z home move. That clears the old offset before the machine moves. Then G43 is called again with the new tool’s H value.

COMMON MISTAKE – Calling G49 while the tool is still near the part

On some controls, canceling tool length compensation causes an immediate Z-axis shift — because the machine moves to where the spindle nose would have been, not where the tool tip is.

If you’re anywhere near the workpiece, this can cause a crash. Always retract Z to a safe clearance height before calling G49.

Try it yourself

Tool Length Compensation — G43 & G49 Explainer

Tool Length Compensation

What changes when G43 and G49 are active

Spindle Nose ➤ Tool Tip (ignored) Z = 0 (part top) Tool Length
Spindle nose is the Z reference

Without TLC active, the machine moves the bottom of the spindle housing to every programmed Z position. It has no idea a tool is even installed.

Tool tip is ignored

No H offset is loaded, so the machine cannot account for the physical length of the cutting tool hanging below the spindle.

Z0 = top of the workpiece

Your program’s Z origin is the part surface — but the machine won’t move the right point there without compensation.

The problem: Program Z−0.500 to drill a half-inch hole and the machine moves the spindle nose to Z−0.500 — not the drill tip. You’ll drill the wrong depth every time, or crash on the first move.
H offset Spindle Nose Tool Tip (active) ➤ Z = 0 (part top)
Tool tip becomes the Z reference

G43 shifts the reference point down from the spindle nose to the tip of the cutting tool. Every Z move now targets the correct point.

H offset = tool length

You measure the tool, enter that value as the H offset, and the control adds it to every Z calculation automatically. One measurement, done.

Spindle nose is now secondary

The machine still tracks the spindle position internally, but it’s no longer what gets moved to your programmed Z values.

How to call it: G43 H02 Z1.0 — activates TLC using height offset #2 and rapids the tool tip to Z1.0 clearance. Stays active (modal) until cancelled by G49 or a tool change.
G43 H02 Z1.0 (TLC on — tool 2 offset, clear to Z1.0)
G01 Z-0.500 F10.0 (tool TIP drills to exactly Z-0.500)
Z = 0 (part top) Safe clearance H offset CANCELLED CRASH! Spindle Nose Tool Tip
G49 cancels the H offset

The machine drops the tool length value entirely. Spindle nose becomes the Z reference again, instantly.

Z shifts immediately on some machines

Some controls physically move the Z-axis the moment G49 executes — compensating for the now-missing offset value.

Always retract Z first

If the tool is anywhere near the part when G49 cancels and triggers that shift — the tool drives straight into the workpiece.

See it live: “Safe Sequence” shows the correct way. “Crash Demo” shows what happens when G49 is called without retracting first.
Ready
— Safe way —
G91 G28 Z0 (retract Z to machine home FIRST)
G49 (now safe to cancel TLC)
M06 T02 (tool change)
G43 H02 Z1.0 (new tool offset active)

Other CNC cancel commands

Code

Description

G40

Cancel cutter compensation

G49

Cancel tool length compensation

G50

Cancel scaling

G67

Cancel custom macro call

G69

Cancel rotation

G80

Cancel canned cycles

Codes that do the same thing

You don’t have to use G49 to cancel tool length compensation. These will also cancel it:

  • M30 — End of program / rewind also resets TLC
  • H0 — Calling a height offset of zero effectively cancels compensation
  • Control reset — Pressing reset on the control clears active offsets on most machines

If you’re switching tools, calling G43 H[new offset number] is the cleanest approach — you don’t need to cancel first.

FAQS

What does G49 do in CNC?

G49 cancels tool length compensation. After G49 is called, the machine moves the spindle nose to programmed positions instead of the cutting tool tip.

Do I need G49 in every program?

No. Most programs don’t use G49 at all. As long as you’re calling the correct H offset for each tool, there’s no need to cancel tool length compensation between tool changes.

What happens if I call G49 while the tool is near the part?

On some machines, calling G49 mid-program causes the Z-axis to shift immediately. This can result in a crash if you haven’t retracted to a safe height first. Always move Z to a clearance position before calling G49.

What’s the difference between G43 and G49?

G43 turns tool length compensation ON using a specified H offset. G49 turns it OFF. You’ll use G43 at the start of a tool path; G49 is used when you want to cancel that offset before a tool change or end of program.