Cutter radius compensation shifts the toolpath sideways by the tool's radius, so the program can describe the part edge while the machine moves the tool center:
G41— compensate left of the direction of travelG42— compensate right of the direction of travelG40— compensation off (the default state)
The offset amount comes from the tool table, selected by the D word:
T3 M6 ; 10 mm end mill, radius in offset register 3
G0 X-15 Y0 ; start clear of the part
G41 D3 ; comp on, left of path
G1 X0 Y0 F500 ; lead-in: tool drifts left by its radius
G1 Y50 ; from here on, coordinates ARE the part edge
G1 X60
...
G40 ; cancel on the way out, in open space
The payoff is on the shop floor: measure the finished part 0.05 mm oversize, dial the D register down 0.025, and re-run — no repost, no CAM.
#The lead-in rule
Comp cannot switch on instantaneously — the control needs one move to ramp from center-on-path to center-offset. That move must:
- be a straight line (
G1, not an arc) on most controls, - be at least as long as the tool radius, and
- happen outside the material, in the active plane (
G17for mills).
Cancel with G40 the same way: on a linear exit move in open space.
Turning comp on or off mid-profile is the direct cause of most gouges and
"interference" alarms.
| Operation | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|
| Cutter compensation OFF | G40 |
G40 |
G40 |
G40 |
G40 |
G40 |
Default state. |
| Cutter comp LEFT of path | G41 |
— | G41 |
G41 |
G41 |
G41 |
D word selects the offset register. |
| Cutter comp RIGHT of path | G42 |
— | G42 |
G42 |
G42 |
G42 |
|
| Dynamic cutter comp (offset in source) | G41.1 / G42.1 |
— | — | — | — | — | LinuxCNC puts the D value in the source line instead of a register. |
| Cutter-comp corner style | — | — | — | — | — | G40.1 / G40.2 |
Mach4 only: G40.1 arc-rounded, G40.2 square. |
— means the control has no equivalent code. Full cross-control tables: the complete G-code & M-code reference.
#Comp in the control vs comp in CAM
Modern CAM systems compute the offset path themselves and post center-line coordinates with comp off ("computer" compensation in post settings). Control-side comp survives because of the tool-wear workflow above, and because hand-written profiles are far easier to program at the part edge. Know which mode your post is set to — running a CAM-compensated path with control comp active doubles the offset and cuts everything undersize/oversize by a full radius.
#Common mistakes
- Double compensation. CAM already offset the path, then the setup
sheet says
G41 D1too. The part comes out wrong by exactly one tool radius — the signature of this mistake. - Lead-in shorter than the radius. Alarm (best case) or a gouged entry (worst). Give the ramp move room.
- Inside corners tighter than the tool. No compensation can cut a 6 mm inside corner with an 8 mm cutter; the control alarms or leaves material. Fix the geometry or the tool choice.
- Assuming portability. LinuxCNC adds
G41.1/G42.1(radius given in the block, no table), Mach4 adds corner-style variants, GRBL has nothing. Check the table above before moving a comped program between controls.