CNC · programming

Tool compensation: radius and length without the confusion

Compensation is what lets you program the profile of the part instead of the path of the cutter centre. Set up right, you never notice it; set up wrong, the part comes out offset by the same amount every time.

There are two different compensations and it pays not to mix them up. One corrects where the tip is on the Z axis: length compensation. The other corrects the thickness of the tool in the plane: radius compensation. They are declared with different codes and they fail in different ways.

Length compensation: G43, G44 and G49

Every tool is the length it is. The control has no idea until somebody measures it and stores it in the offset table. G43 H__ tells the machine to use offset number H to know where the tip is.

T02 M06
G43 H02 Z50.

G44 is negative compensation, which is hardly ever used. G49 cancels it.

The mechanical rule: after every tool change, its G43 with the matching H. And make the H number match the T number. If T05 uses H03, sooner or later somebody gets it wrong and the machine works with another tool's length.

The symptom is unmistakable: the depth of cut is not the one in the program, and the error is constant across every pass — exactly the difference in length between the two tools.

Radius compensation: G41, G42 and G40

This is where the real benefit is. Without compensation you would have to work out the path of the cutter centre, offset by its radius from the profile. With compensation active you program the coordinates of the finished part and the control does the maths.

  • G41: compensates to the left of the direction of travel.
  • G42: compensates to the right.
  • G40: cancels.

To work out which one you need, picture yourself walking along the path in the direction of feed: if the part is on your right, the tool runs down the left, and that is G41. On an external profile milled anticlockwise, G41 usually comes out right.

The radius value comes from offset D, and there is the hidden advantage: if the cutter wears or you fit one of a slightly different diameter, you do not touch the program — you change the number in offset D and that is it.

How to switch it on without an alarm

Three conditions that always have to be met:

  • Switch on and cancel on a linear move (G01 or G00), never on an arc and never while stationary.
  • The approach move has to be longer than the tool radius. Ask it to travel 3 mm with a cutter of 5 mm radius and it has no room to offset itself.
  • Switch on off the material, during the approach, and cancel off the material too, on the retract.
G00 X-15. Y-15.
G01 Z-3. F120
G41 D01 X10. Y10. F400
... the profile ...
G40 G01 X-15. Y-15.

The failure that costs the most

Leaving G41 or G42 active when you finish. The next tool works offset by its own radius, and since compensation stays in force through the whole operation, the entire part comes out shifted. The worst of it is that the shift is constant and clean, so it looks like a work-offset problem and you can spend half an hour looking in the wrong place.

Rule: G40 before every M06, no exceptions. Put it in the retract sequence alongside the M05 and the M09.

Tangential entry so you do not mark the part

Entering the profile head-on leaves a mark at the entry point. If the finish matters, you come in on a small arc tangent to the profile: the tool arrives already aligned with the path and there is no abrupt change of direction. Most CAM systems do it for you; writing by hand you have to remember.

What compensation does not fix

It does not correct a badly set work offset, it does not compensate for the deflection of a long cutter, and it does not know the tool is blunt. It compensates geometry, not physics. If the part comes out tapered on a tall wall, that is tool deflection and it is fixed with a lighter cut or a shorter cutter, not by fiddling with offset D.

To see both compensations at work inside a whole program, there is the program annotated line by line; and the ten codes that surround them, in the essential codes.

Need a part machined? The directory of Spanish machine shops lists more than 700 workshops across Spain with their processes, materials and certifications verified, filterable by province. And if you are learning, the CNC Path takes you from G-code to your first part.

Frequently asked questions

What is the difference between G41 and G42?

G41 is radius compensation to the left and G42 to the right, looking along the direction of tool travel. With the cutter turning clockwise, G41 corresponds to climb milling and G42 to conventional milling. Choosing the wrong one flips the side the material is on and ruins the part.

What is length compensation for?

So the program does not depend on the specific length of each tool. Each tool is measured once, its length is stored in the offset table, and the control adjusts the Z axis when the tool is called with G43. That way you can change or regrind a tool without rewriting the program.

Can you correct an out-of-tolerance dimension without touching the program?

Yes, and it is the normal way to do it: you adjust the radius or length offset for that tool. If a dimension comes out two hundredths oversize, you change the radius offset by one hundredth and the next pass lands in tolerance, without editing a single line of code.

← All the guides