Complete Guide to Tool Radius Compensation: G40, G41, G42 Explained with Use Cases and Pitfalls
Tool radius compensation allows you to program toolpaths based on the part geometry rather than the tool centerline. This makes CNC programming more flexible, easier to edit, and more accurate, especially in finishing and contouring operations.
🎯 What Is Tool Radius Compensation?
When you program the contour of a part, the center of the tool must move offset from the edge by the tool’s radius.
Rather than calculating that offset manually, you use:
G41– Left of contour (tool moves to the left)G42– Right of contour (tool moves to the right)G40– Cancel compensation
🧭 Direction Matters: G41 vs. G42
| G-Code | Tool Path Side | Typical Use |
|---|---|---|
| G41 | Left of part | Conventional milling |
| G42 | Right of part | Climb milling |
💡 Rule of Thumb: Imagine walking the tool around the part — G41 keeps the tool to your left, G42 to your right.
🧠 Why Use Cutter Compensation?
- ✅ Adjust for tool wear or different diameters without reprogramming geometry
- ✅ Swap tools mid-job without rewriting paths
- ✅ Ideal for finishing passes and tight tolerances
📌 Cutter Compensation Commands
G41 D01 ; Tool comp left, uses tool offset register D01
G42 D02 ; Tool comp right, uses D02
G40 ; Cancel tool comp
D01,D02, etc., refer to the tool radius value stored in the controller’s tool table.
🔄 Complete Example
T1 M06 ; Select tool
G90 G54 G00 X0 Y0
G43 H01 Z50 ; Tool length comp
G01 Z-2.0 F100
G41 D01 ; Cutter compensation left
G01 X100 Y0 ; First compensated move
Y50
X0
Y0
G40 ; Cancel compensation
G00 Z100
⚠️ The first move after G41/G42 must be a linear move (G01), long enough for the machine to make the offset.
❌ Common Mistakes to Avoid
| Mistake | Problem |
|---|---|
| Not using linear move after G41/G42 | Compensation won’t engage correctly |
| Using arc move immediately after | Causes alarm on most controllers |
| No D register | Controller doesn’t know tool size |
| Forgetting G40 | Leaves tool in offset mode |
🛠️ Tool Table Setup
In most controllers (Fanuc-style), D01 points to the tool radius set in the tool offset table.
| D Code | Radius (mm) |
|---|---|
| D01 | 3.175 |
| D02 | 6.0 |
| … | … |
✅ Make sure tool table values are correct before running compensated programs.
🧩 Practical Use Case
You’re milling the outer contour of a part with a 6 mm end mill:
- Your drawing shows the exact part profile.
- You program the contour as if using a centerless tool.
- Apply
G41 D01and store3.0mm as the tool radius. - You change the tool later with a 5.8 mm cutter → just change the D01 value, no need to edit code.
📋 G40 – Cancelling Cutter Compensation
Always cancel tool comp before lifting the tool or moving to a new contour.
G40
G00 Z100
🔄 Summary Table
| G-Code | Function |
|---|---|
| G41 | Cutter compensation left |
| G42 | Cutter compensation right |
| G40 | Cancel cutter compensation |
🧠 Best Practices
- ✅ Use
G41orG42before the first move into contour - ✅ Ensure tool radius is set correctly in tool offset table
- ✅ Always follow G41/G42 with a linear move
- ✅ Cancel compensation with
G40before retracting - ❌ Never use arcs immediately after enabling compensation
🚀 Final Thoughts
Tool radius compensation turns rigid G-code into flexible, reusable machining strategies. By mastering G40, G41, and G42, you gain control over:
- Surface finish
- Tool life
- Programming efficiency
When every micron counts, cutter compensation gives you the edge — literally.
Leave a comment