G49 is one of the shortest commands in G-code. One word, no parameters. It cancels tool length compensation — the offset activated by G43 or G44 that tells the control how long the current tool is.
What makes G49 dangerous is not what it does, but when programmers forget it — or assume the control will cancel compensation automatically when it never does.
What G49 Does
When you call G43 H__, the control adds the tool length offset stored in register H__ to every Z position in the program. The machine moves as if the tool were the length specified in the offset table — which, if set correctly, corresponds to the actual tool in the spindle.
G49 cancels that offset. After G49, the control goes back to treating Z positions as raw machine coordinates, with no length offset applied.
On Fanuc and Haas controls, the syntax is simply:
G49On some Siemens Sinumerik configurations, tool length compensation is managed differently through the tool nose radius compensation and D-offset system — the equivalent cancel behavior is controller-specific. Always verify the correct cancellation method for your specific Sinumerik version.
When G49 Is Typically Called
In standard CNC practice, G49 appears in two places:
At the beginning of the program, in the safety block that resets modal states:G17 G21 G40 G49 G80 G90This block cancels cutter compensation (G40), canned cycles (G80), and tool length compensation (G49) before anything else runs. It ensures the program starts from a known state regardless of what was active when the previous program ended.
After a tool change, before activating compensation for the new tool:G28 G91 Z0 (return Z to reference point)
T2 M6 (tool change)
G43 H2 Z50. (activate length compensation for tool 2)In this sequence, G49 is implicit — G43 H__ replaces whatever offset was previously active. But some programmers add it explicitly for clarity, and some shop standards require it.
The Three Ways G49 Causes Problems
1. Missing G49 in the Safety Block
If the program omits G49 from the opening block, it starts with whatever tool length compensation was active at the end of the previous program. On a Haas or Fanuc control, modal states persist between programs — G49 is not automatically reset when you press Reset or load a new program.
If the previous program ended with H5 active (a 150mm endmill) and the new program loads a 20mm drill expecting no compensation, the first Z move will be off by 130mm in the wrong direction.
This failure mode is invisible in CAM simulation. The CAM system doesn't know the previous program's modal state.
2. Calling G49 at the Wrong Z Position
Canceling tool length compensation changes the effective Z position of the machine. If G49 is called while the spindle is near the part, the control suddenly interprets the current Z as a raw machine coordinate — which is typically much higher than the work coordinate. The result is that the machine may rapid to an unexpected position.
The correct place to call G49 is at a safe clearance height, or after returning to machine reference (G28).
G0 Z100. (move to safe Z first)
G49 (then cancel compensation)Calling G49 with the tool near the part is a crash waiting to happen.
3. Relying on G49 to Cancel Between Tools
Some programmers use G49 between tool changes as a deliberate step, then activate a new G43 for the next tool. This works correctly only if the Z axis is at a safe position before G49 executes. A G49 called at R-plane height — Z2. above the part — will shift the Z by the full tool length offset, potentially driving the spindle into the fixture or workpiece.
G49 vs. G43 H0
On many Fanuc and Haas controls, calling G43 H0 has the same effect as G49 when offset register H0 is zero. This is a common shortcut in programs where H0 is never assigned a non-zero value.
The difference matters when H0 is not zero. If someone has accidentally stored a value in H0, G43 H0 activates that offset rather than canceling compensation. G49 always cancels unconditionally.
For safety, prefer explicit G49 over G43 H0 unless your shop has a strict protocol that guarantees H0 is always zero.
Why Simulation Catches G49 Errors That CAM Cannot
CAM simulation runs before post-processing. It has no knowledge of:
- What modal state the control is in when the program starts
- What offset value is stored in each H register
- What happens when G49 executes at a specific machine position
A controller-accurate simulation loads the actual G-code file — including the safety block — and emulates the control's modal state from line one. It catches:
- Missing G49 in the safety block (compensation from a previous program carries over)
- G49 called at unsafe Z positions
- Programs that rely on H0 being zero when it isn't
These are errors that look correct in the CAM backplot and fail on the machine.
Reference: G49 Behavior by Controller
| Controller | Cancel command | Notes |
|---|---|---|
| Fanuc 0i / 30i | G49 | Cancels G43 or G44 unconditionally |
| Haas NGC | G49 | Same as Fanuc; G43 H0 also works if H0=0 |
| Siemens Sinumerik 840D | Tool length via TOFL[Z] / D0 | Controller-specific; verify with your machine documentation |
| Heidenhain TNC | TOOL CALL with no length | Length compensation managed via tool call, not a G49 equivalent |
Frequently Asked Questions
Does G49 need to be on its own line?No. G49 can appear in a block with other G-codes, as in the standard safety block G17 G21 G40 G49 G80 G90. It takes effect the moment the block executes.
If the program runs correctly from start to finish without calling G49, nothing breaks. G49 is a precaution, not a required step for every program. The problem appears when programs are chained, when the control retains modal state between runs, or when operator intervention changes the machine state mid-program.
Does pressing Reset cancel G49?On most Fanuc and Haas controls, pressing Reset does not cancel tool length compensation. G49 must appear in the program or be entered at the MDI panel.
Can G49 cause a crash?Yes — if called when the tool is at a low Z position near the part. The Z shift that results from canceling the offset can cause an immediate unintended move. Always call G49 at a safe clearance height.
Does G49 affect X and Y?No. G49 only affects the Z axis offset applied by G43 or G44. X and Y are not modified.
Verifying G49 Behavior Before Running the Program
The safest way to verify G49 handling is to simulate the post-processed G-code on a controller-accurate digital twin — not to check the toolpath in CAM, but to run the actual .nc file the way the control will interpret it.
A simulation that emulates your specific controller (Fanuc, Haas, Siemens, Heidenhain) will show exactly what happens to Z when G49 executes, whether the safety block is correctly structured, and whether any compensation from a previous program state could carry over.
Run every G-code program risk-free — before it touches your machine.
Try Eureka 3X Pro free for 30 days →Related articles:
- G43 Tool Length Compensation — How It Works and What Goes Wrong
- G84 Tapping Cycle — Setup, M29 Rigid Mode, and Common Errors
- Canned Cycles — G81 G83 G84 G73 Reference and Common Mistakes
Try Eureka 3X Pro Risk-Free
Run every G-code program risk-free — before it touches your machine.
