G40, G41 and G42: Cutter Radius Compensation
G41 and G42 shift the tool to the left or right of the programmed path by the tool's radius. G40 turns compensation off.
Most CAM programs output the path of the tool centre, already offset by the tool's radius. Cutter radius compensation works the other way round: the program follows the outline of the part, and the control offsets the tool by the radius stored in its offset table.
- G41: the tool stays to the left of the path, looking in the direction of travel.
- G42: the tool stays to the right of the path.
- G40: compensation off. The tool centre follows the path exactly.
The D word picks which offset register holds the radius, for example G41 D1.
Why use it
Compensation lets the operator adjust the size of a part at the machine. If a pocket comes out 0.05 mm too small, they change the value in the offset table and run it again, with no trip back to CAM. It also lets one program work with a resharpened or slightly undersize tool.
Many CAM systems offer wear compensation: the program still follows the tool centre path, and the D register holds only a small correction, normally zero. That keeps the program safe to run even if nobody has entered the tool's radius.
Climb or conventional
With the spindle turning clockwise (M3), the side of the path decides the cutting direction:
| G41 (tool on the left) | G42 (tool on the right) | |
|---|---|---|
| Outside profile | Climb milling when you go clockwise around the part | Conventional milling |
| Most common use | Finishing passes on CNC mills | Older or less rigid machines |
Lead-in and lead-out moves
The control can't jump the tool sideways by its radius, so it ramps the offset in on the move where compensation turns on and out on the move where it turns off. Those moves need care:
- Turn compensation on during a straight G0 or G1 move, not an arc. Most controls alarm on G41 with G2 or G3.
- The lead-in should be longer than the tool radius and approach the part from outside the material.
- Cancel with G40 on a straight move away from the part, after the last cut.
- Inside corners and slots must be wider than the tool, or the control will stop with an interference alarm.
Example: outside profile of a 40 × 30 mm part
The program follows the part outline, from the corner at X0 Y0 to X40 Y30, clockwise. With the 6 mm end mill's radius (3 mm) in register D1, the control keeps the tool 3 mm outside every edge and climb mills the profile.
(G41 example: outside profile of a 40 x 30 mm part, climb milling)
(The tool radius is stored in D1, so the program follows the part outline)
G21 G17 G90 G54 G40
T1 M6 (6 mm flat end mill)
G0 X-10 Y-10 Z25 S12000 M3
Z5
G1 Z-3 F300
(Lead-in: turn compensation on during a straight move toward the part)
G41 D1 G1 X0 Y-5 F800
Y30
X40
Y0
X-5
(Lead-out: cancel compensation on a straight move away from the part)
G40 G1 X-10 Y-10
G0 Z5
M5
M30
CutViewer draws the programmed outline: the part edge itself, not the path of the tool centre.
G41 D1 G1 X0 Y-5 F800is the lead-in. Compensation ramps in on this straight move toward the part.Y30,X40,Y0andX-5trace the part clockwise. The last move runs past the starting corner so the edge is cut cleanly.G40 G1 X-10 Y-10cancels compensation on a move away from the part.
Machine differences
- Fanuc and Haas support G41 and G42 with a D register. Haas can store the D value as a radius or a diameter, depending on a setting.
- LinuxCNC uses the tool table and also has G41.1 and G42.1, which take the tool diameter directly on the line.
- Mach3 supports G41 and G42 with its tool table.
- GRBL does not support cutter compensation at all.
How CutViewer shows G40, G41 and G42
CutViewer keeps track of whether compensation is on, but it doesn't apply the offset. It draws the path exactly as programmed, so with G41 or G42 you see the part outline rather than where the tool centre will go. Programs posted with compensation turned off in CAM show the true tool centre path.
Frequently Asked Questions
What is the difference between G41 and G42?
G41 keeps the tool to the left of the programmed path, looking in the direction of travel. G42 keeps it to the right. With a spindle turning clockwise (M3), G41 gives climb milling and G42 gives conventional milling.
What does the D word do in G41 D1?
D picks the offset register that holds the tool's radius (or its wear, see below). D1 uses the value stored in register 1. On most controls the value is the radius; some, like Haas, can be set to use the diameter instead.
Why does my control alarm when I turn on cutter compensation?
The most common causes are turning G41 or G42 on during an arc, a lead-in move shorter than the tool radius, or an inside corner or slot that is narrower than the tool. Turn compensation on during a straight G0 or G1 move that is longer than the tool radius.
Does GRBL support G41 and G42?
No. GRBL, which runs many hobby routers such as the Shapeoko and X-Carve, does not support cutter radius compensation, so CAM programs for it must output the tool centre path. LinuxCNC, Mach3, Fanuc and Haas controls support it.
More G-Code Guides
Rapid positioning and straight cutting moves.
Clockwise and counter-clockwise arcs with I/J/K or R.
Pause for a set time, in seconds or milliseconds.
Choose the XY, XZ or YZ plane for arcs.
Inch or millimetre units for the program.
Return to home or a second reference position.
Tool length offset on and off.
Work coordinate systems and machine coordinates.
Drilling canned cycles, from plain drilling to peck drilling.
Tapping cycle, and how to work out the feed rate.
Absolute positions or incremental distances.
Set the current position by shifting coordinates.
Feed per minute, per revolution, or inverse time.
Constant surface speed or a fixed spindle RPM.
Where a drilling cycle retracts between holes.
Spindle, coolant, tool change, stop and subprogram codes.
Check your own program before you cut: open it in CutViewer to see the toolpath in 3D, the run time and any problems.
Open CutViewer