What does a G43 code do?
The G43 code turns on tool length compensation.
Tool length compensation allows the CNC machine to account for the length of your cutting tool that has been entered and stored in an H offset value.
H offsets and G43
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. The memory storage location is often called an offset table or library.
There are multiple H offsets that can be stored in the tool table. Each tool will have its corresponding H offset value.
The best practice when storing offsets 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.
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
How to use a G43 code
You know the G43 code is used in a CNC program to account for the tool length, but why does it matter?
It matters because 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.
An H code is used with the G43 code to select the height (H) offset value. The H code tells the CNC which H (height) offset value to account for when running the program.
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.
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. You are trying to move the end of the spindle to a new location and if a tool is loaded in the spindle then it is in the way of that movement.
This can mean you end up with a damaged part, broken tool or maybe even damage to your CNC.
Where does the G43 code show up?
G43 will often be used at the start of a new section of code.
This will ensure that you have tool length compensation on and the correct H offset applied before running that section of code.
Making sure they are on and set to the correct offset 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. It is common to need to rerun only a section of your CNC program to dial in the size.
To make sure this is possible you need to make sure your machine is always set to the correct modes using modal commands.
G43 is one of those modal commands, 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. This practice is called using safety lines or safety codes in your program.
It is better to be safe and include them than to not and be sorry when your machine crashes.
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
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.
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 to avoid crashing your machine.
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.
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 cutter compensation G codes G41 and G42 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.
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.