G40, G41, G42 Explained: CNC Cutter Compensation Made Easy
In CNC programming, cutter compensation allows the machine to account for the tool’s radius when following a programmed toolpath. This is vital for achieving precise part dimensions during contouring.
There are three main codes:
- G40: Cancel cutter compensation
- G41: Cutter compensation left (tool left of path)
- G42: Cutter compensation right (tool right of path)
🔧 Why Use Cutter Compensation?
CAD/CAM paths are often created for the part contour, not the center of the tool. Without compensation, a tool with 5mm radius following the part profile would overcut by that radius.
Cutter comp lets the controller offset the toolpath automatically, using stored values in tool offset tables (like D01, D02, etc.).
➕ G41 – Cutter Compensation Left
G41 D01
G1 X50 Y50
- Tool stays to the left of the programmed path
- “Left” is determined by the tool’s movement direction
- Common for climb milling in clockwise contours
➖ G42 – Cutter Compensation Right
G42 D01
G1 X50 Y50
- Tool stays to the right of the programmed path
- Used for conventional milling or counterclockwise contours
✖️ G40 – Cancel Compensation
G40
- Disables any previously activated G41/G42
- Must be called before rapid moves or exiting the profile
- Prevents unexpected tool deflection
🧠 Visual Guide
Tool Path (Climb Milling, Clockwise)
→
┌───────┐
G41 → │ │ ← G42
└───────┘
←
🧰 Tool Offset Table Usage (Fanuc Style)
| D Number | Tool Radius | Description |
|---|---|---|
| D01 | 5.0 mm | End mill radius |
| D02 | 3.0 mm | Ball nose tool |
You must reference the correct D-code in G41/G42:
G1 G41 X30 Y10 D01 ; Apply 5mm left offset
🛠️ Full Program Example
%
O4001 (Cutter Compensation Demo)
G21 G90 G54
G0 X0 Y0 Z5
G1 Z-2 F100
G41 D01
G1 X50 Y0
G1 Y50
G1 X0
G1 Y0
G40
G0 Z100
M30
%
⚠️ Common Errors and Tips
| Issue | Cause / Fix |
|---|---|
| Tool gouges or cuts wrong side | Wrong use of G41 vs G42 |
| Compensation not applied | Missing D number or incorrect value |
| Controller alarm on G41/G42 | No lead-in move or poor start geometry |
| Unexpected offset behavior | Compensation not cancelled with G40 |
✅ Best Practices
- Always begin with a lead-in move before enabling G41/G42
- Cancel with G40 before retracting or rapid moves
- Use wear offsets to fine-tune without modifying G-code
- Know your machine’s comp mode (radius vs diameter)
📏 Typical Workflow
- CAM outputs contour path on part profile
- You add
G41/G42 Dxxbased on tool direction - Controller offsets path using tool radius in D-table
- Use G40 after toolpath to cancel comp
🔁 Lead-In and Lead-Out Example
G1 G41 D01 X5 Y0
G3 X10 Y5 I0 J5
G3 X5 Y10 I-5 J0
G1 G40 X0 Y10
- Smooth arc-based lead-in/out helps avoid cutter jumps or alarms
- Line-based lead-ins are also valid (at ~tool radius length)
🔚 Final Thoughts
Proper use of G41, G42, and G40 is the key to accurate contouring and professional-grade CNC programming.
Forgetting to use cutter comp is like driving a car without adjusting your mirrors — you might reach your destination, but probably not safely.
By leveraging cutter compensation, you gain flexibility, precision, and the ability to tweak dimensions without regenerating CAM files.
Leave a comment