G49 CNC Code Explained: An Easy Intro for Beginners [Tool Length Compensation Cancel]

What does a G49 code do?

The G49 code cancels tool length compensation.

Once the G49 command is used, the machine will not account for any tool length (H) offsets in its movement.

This means the machine will move the end of the spindle to all new locations.

When tool length compensation is in effect by using either a G43 or G44 code, the machine will move the end of the cutting tool to all new locations.

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

What is tool length compensation?

Tool length compensation is your CNC machine accounting for the length of the cutting tool when running the program.

It does this by adjusting for the cutter by a value that is entered into the offset library. This offset is called an H offset.

mach 3 tool offset table
A tool offset library

H offsets are assigned by using the H code with a G43 code to turn tool length compensation on. 

For example, the line

G43 H02 

tells the CNC to turn tool length compensation on using the #2 height (H) offset.

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

Learn CNC Programming – It’s Easier Than You Think!

Learning G Code doesn’t have to be difficult…

If you know what to focus on.

Join our simple, easy-to-follow course, “G Code Made Easy: CNC Programming for Beginners“. We walk you through all the important codes – with simple explanations and real-world examples.

Want to become a super-skilled CNC programmer? Join now to take the shortcut to becoming a G Code Master today!

Make Learning G Code Easy

Where will you find G49 in a CNC program?

The G49 code is not a required part of your CNC program.

It is rare that you would want to move the tip of your spindle to an exact location. You will almost always have a cutting tool in the spindle that you will want to account for.

This means the G49 code is not used often. It is more important to make sure you have the correct tool and offset selected.

Some programmers choose to include the G49 code as part of their safety block of code.

Others skip it and just make sure to call out the correct offset for their tool at the start of a new section of code.

As long as you switch to the correct offset for the currently loaded tool, then there is no need to cancel tool length compensation with the G49 code.

What to think about when using a G49 code?

Different machines can interpret the G49 code in varying ways.

When the G49 code is used, some machines will immediately move the end of the spindle to the location the end of the cutting tool was previously in.

If you aren’t in a safe location with enough clearance, the machine could crash. That’s never good!

If you plan to use a G49 code then make sure you understand how your CNC will react. Check your manual!

Other CNC cancel commands




Cancel Cutter Compensation


Cancel Tool Length Compensation


Cancel Scaling


Cancel Custom Macro Call


Cancel Rotation


Cancel Canned Cycles

Codes that are similar to G49

There are multiple commands that will cause the machine to act very similar to when a G49 codes is used.

Using the M30 code, the reset command or an H0 offset will cause the CNC machine to cancel tool length compensation.

Want to learn more about G Code for your CNC?

Leave a Comment