Quick Guide to the G43 CNC G Code [Tips and Tricks]

How to use a G43 code

The G43 code is used in a CNC program to account for the tool length. Without a G43 code, you would need to create a new program every time you wanted to run the same part with a different tool.

The G43 code along with an H offset value lets the machine calculate the needed changes based on the program locations and the tool length.

This allows any number of tools to be used in the same program as long as your controller stores enough offset values and those offset values have been entered correctly.

When a G43 code is not active, the machine will move the end of the spindle to all locations in the program.

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

When the G43 code is active, the machine will move the end of the cutting tool to all locations in the program.

You can see how not having the G43 code on when needed could cause a crash. With G43 off the machine will try to move the end of the spindle to the location, except there is a tool in the way. This can mean you end up with a damaged part, broken tool or maybe even damage your machine.

G43 at the start of a new section of code

G43 will often be used at the start of a new section of code. This will ensure that you have the tool length compensation on and the correct offset applied before running that section of code.

This will allow you to run only that section of code if needed. This can be helpful if a particular feature or size of the part being worked doesn’t come out as intended.

G43 is a modal command which means it stays active until switched or canceled. The same goes for many other g codes.

The best practice when dealing with modal commands is to not assume that they will be on when you need them. You should call them out in any section of your program where they will be needed.

It is better to be safe and include them than to not and be sorry when your machine crashes.

H offsets and G43

a variety of cnc cutters with text overlay that says different offsets for different length cutting tools

The G43 command tells the machine to turn on tool length compensation but it is the H code that tell the machine how much to compensate for.

The H offset number will correspond to a value stored in the machine’s memory, often entered at the time of setup. This value will be for the length of the tool.

There are multiple H offsets that can be stored. Each tool will have its corresponding H offset value.

The best practice is to match the tool number with the H number. This means for tool #1 you will store the tool length offset in H01. For tool #2 you will store the offset in H02 and so on.

What to think about when using a G43 code

When using a G43 code the most important thing to think about is avoiding collisions.

Correctly using the G43 code will also help make sure that your parts come out the right size.

The G43 code will take effect on your first Z axis move after using the G43 code. This will usually all be the same line of code.

You want to avoid getting too close to your part before calling out the G43 code. Call out your tool length compensation while you are still a safe distance away from your workpiece.

How to format your G43 codes

There are three parts to your G43 code. The G43 code itself, the H offset number to use, and a location move.

Altogether they should look similar to this line of code:

G43 H02 Z1.0

In this example G43 turns the tool length compensation on using the 2nd H offset value and moves the machine to a location 1 unit above the Z axis zero location.

Note that tool length compensation with the H02 offset for all future moves until it is turned off or changed.

How to cancel a G43 command

G49 is the command that cancels tool length compensation.

It will cancel any active G43 or G44 modes that may be active.

G49 is often used at the beginning of the program as part of the safety lines or safety block of code that initializes the machine and makes sure all of the correct modes are set.

G43 vs G44

G43 and G44 are opposites.

One is a positive compensation, and the other is a negative compensation.

G43 tells the control to adjust for a positive length compensation.

G44, which is rarely used by most shops, tells the control to adjust for a negative tool length. I wouldn’t worry about understanding why or how to use G44 if you are just starting out. Get a little experience under your belt before worrying about this rarely used code.

CNC codes that are similar to G43

We established that G44 works much like a G43 code but what other similar codes are there available.

The other main types of cutter compensation are the G41 and G42 codes. These cutter compensation codes allow the machine to account for the diameter of the cutting tool. Which one gets used depends on the type of cutting you are doing.

Climb milling will use the G41 code. Conventional milling will use the G42 code.

The G41 and G42 codes adjust for the diameter of the cutter while G43 accounts for the length of the tool.

Please note that G41 and G42 are also modal commands, which means they will stay on until turned off or switched.

G43 code example

Check out the G43 code example below to see how the code affects what the machine will do.

The N numbers below, such as N100, are line numbers for your program. Some programs might not include them, but we left them in so they don’t confuse anyone.

Example #1:

N100 T02 M6                                   

N105 G00 G43 H02 Z1.0

N110 G01 Z-2.0 F5

Line 100 selects tool #2 and changes to that tool.

Line 105 sets the movement mode as rapid and turns on tool length compensation while moving to Z = 1.0

Line 110 sets the movement mode as straight line movement and moves the tool to Z=-2.0 at a feed rate of 5 units per minute.

Want to learn more about G Code for your CNC?

Leave a Comment