CNC Milling Training Lesson 7: Cutter Radius Compensation with G40, G41 and G42

10 July 2026

Mentor CNC Editör Ekibi

📷 IMAGE AREA — The tool-radius difference between the tool center path and the part contour
Suggested alt text: Difference of tool radius between tool center path and part contour in CNC milling

When machining the outer or inner contour of a part on a CNC mill, the center of the cutter cannot be moved directly along the part edge, because a milling tool has a definite diameter and radius. For example with a Ø12 mm end mill the tool radius is 6 mm; if the tool center moves directly on the part contour, the cutter goes 6 mm into the part and the dimension comes out wrong. There are two solutions: (1) calculate the coordinates the tool center will follow one by one, accounting for the radius, or (2) program the part’s real contour and introduce the tool radius to the control. The second method, cutter radius compensation, is far more practical.

The basic commands on FANUC-controlled CNC mills: G40 cancels cutter radius compensation, G41 offsets the tool to the left of the programmed path, G42 to the right. Thanks to compensation the program is written to the part’s real drawing dimensions rather than the tool center; the control uses the radius in the offset memory to compute the tool center path automatically.

1. Objectives of the lesson

After this lesson the student will be able to understand the difference between the tool center and the part contour; explain why compensation is needed; distinguish the roles of G40/G41/G42; determine the G41/G42 direction from the tool’s travel direction; choose the right direction for outer/inner contours; grasp the role of the D offset number; start compensation with a linear lead-in; use G40 with a suitable exit move; assess possible geometric/programming errors; and apply wear corrections without changing the program.

2. The tool center and the part contour are not the same path

Suppose we machine the outer edge of a part with a Ø10 mm end mill; the radius is r = D/2 = 10/2 = 5 mm. If the part edge is at X0 on the drawing, it is not correct for the tool center to travel on X0 too; the tool center must move 5 mm away from the edge. On an outer contour the tool center path runs outside the part contour by the radius; on an inner contour/pocket it runs inside by the radius. Doing this calculation by hand for every line, corner, angle and arc is long and error-prone on complex contours. With compensation the program is written directly to the part-surface dimensions.

3. How compensation works

With compensation the programmer writes the real contour from the drawing. The control examines the programmed travel direction, reads the G41/G42 selection, takes the radius from the offset memory, offsets the tool center to the left/right of the path, computes intersection points at corners, and moves the tool along the compensated center path. Simply: programmed path = the part’s real contour; the actual tool center path = the compensated path computed by the CNC. So even if the tool diameter changes, the coordinates need not be recalculated — only the offset is updated.

4. Advantages of compensation

The program is written directly to the drawing dimensions; there is no need to compute tool-center coordinates separately; tools of different diameter can be used in the same program; wear is corrected from the offset; roughing and finish allowance are managed via the offset; the program is easier to read; complex contours are easier to program; and geometry lines need not be changed to correct a dimension. For example if the program was prepared for a Ø12 tool and a Ø10 tool will be used, the correct radius is entered into the offset memory instead of recalculating the coordinates.

5. G40 – Cancelling compensation

G40 cancels cutter radius compensation; while active, the tool center follows the programmed coordinates directly. The safety line at the start of the program usually contains G40: G17 G21 G40 G49 G80 G90 G94; — this line cancels any G41/G42 left over from a previous program. G40 is also used when the compensated operation is complete; for example G40 G01 X-25.; moves the tool away from the contour during a linear exit, returning it to the uncompensated state. If G41/G42 was used, it must be cancelled with G40 at the end.

6. G41 – Compensation to the left of the path

G41 offsets the tool center to the left of the programmed travel direction. “Left” here is not the operator’s left, the part’s left edge, or the left of the screen. The reference is: the left side when looking along the tool’s programmed travel direction. For example if the tool moves in +X, the G41 side is the +Y side; if the tool moves in −X, the left side is reversed. So G41 is determined by drawing an arrow of travel, not from memory.

7. G42 – Compensation to the right of the path

G42 offsets the tool center to the right of the travel direction; the right side is also determined by the tool’s feed direction. When the tool moves in +X the G42 side is −Y; if the same edge is machined in −X, left and right swap. So there is no rule that “G41 is always for outer contours and G42 for inner ones.” The correct choice is made according to the tool’s feed direction, which side the part stays on, inner/outer contour and the cutting direction.

8. The most reliable way to determine G41/G42

Sequence: (1) draw the tool’s travel direction as an arrow, (2) imagine looking along the arrow, (3) determine which side the part/material stays on, (4) draw which side the tool center must be on, (5) if the center path is to the left of travel, choose G41, (6) if to the right, choose G42. Example: the tool moves left to right, the part stays above the tool path → the tool center must shift below; since below is the right of travel, G42 is used. If the same edge is machined right to left, the choice changes.

9. G41/G42 do not indicate the tool rotation direction

G41/G42 do not indicate the spindle rotation direction, clockwise/counter-clockwise, or the G02/G03 arc direction. They only determine which side of the programmed contour the tool center stays on. The spindle direction is set by M03/M04, the circular direction by G02/G03, and the compensation direction by G41/G42 — these three must not be confused.

10. The D offset address

The tool radius/diameter offset number is selected with the D address in most modern FANUC applications. Example: G41 D01 → G41 activates left compensation, D01 calls radius offset number 1. The tool plan is arranged as T01→H01→D01, T02→H02→D02 (T: tool no, H: length offset, D: radius offset). The FANUC manual states the compensation number can be selected with the H or D address, depending on the control model. In this training the D address is used for clarity; on a real machine the offset layout must be verified.

11. Radius or diameter in the D offset, Geometry/Wear and the compensation plane

This must always be verified on the real machine. In common use, for a Ø12 tool the diameter is 12 and the radius 6 mm, so 6.000 may be entered in the D Geometry field; but some systems use the diameter value. No value should be entered without knowing whether the screen accepts radius or diameter. Geometry holds the main radius/diameter (e.g. D01 Geometry = 6.000), Wear holds small wear corrections (e.g. D01 Wear = 0.020); entering the main dimension in Wear and the small wear in Geometry is wrong. Compensation plane: it is applied in the selected working plane — G17 (XY), G18 (XZ), G19 (YZ). On three-axis vertical machining centers peripheral contours are mostly machined in XY, so G17 is used.

12. The compensation start (lead-in) move

When G41/G42 is written, the control cannot teleport the tool center sideways instantly; a lead-in move is needed to go from the uncompensated to the compensated position. Common structure: G00 X-20. Y-10.;G01 Z-5. F100.;G41 D01 G01 X0. Y0. F250.;. In the last line the tool moves linearly, shifts D01 sideways at the same time, and enters the compensated contour. G40/G41/G42 can be used in the same block as G00 or G01; they must not be used in the same start/cancel block as G02/G03. In practice compensation is mostly started with a G01 linear lead-in.

13. Why the lead-in distance matters

The length of the lead-in must be enough for the tool to build up the compensation value. For example if the radius is 6 mm, a lead-in of only 2 mm may not be enough for some geometries. Insufficient lead-in causes the tool to enter the contour abruptly, leaves a mark on the surface, triggers an alarm and produces a wrong intersection calculation. Generally the lead-in must be larger than the tool radius, away from the clamping elements, outside the surface to be machined, and in a controllable direction. There is no single universal lead-in length; it is set by the part geometry.

14. The compensation cancel (lead-out) move and the G02/G03 rule

When the compensated contour ends, the tool is not switched directly to G40; a lead-out move is needed to go from the compensated to the uncompensated path. Example: G01 X-10. Y70.;G40 G01 X-25. Y70.; — the tool finishes the contour, begins an exit move away from the part, and cancels compensation with G40 during the linear move. Issuing G40 on the contour or at a corner leaves a mark on the surface. Starting G41/G42 in a circular block or issuing G40 in a circular block is not recommended; the safe structure is to start compensation with G01 and cancel it with G01.

15. Compensated outer contour example (G41)

Rectangular outer contour (X0 Y0, X80 Y0, X80 Y50, X0 Y50), T02 = Ø12 end mill, D02 = 6.000 mm. The program coordinates show the part contour; the control shifts the tool center D02 to the correct side. The G41 direction must be verified by sketching the tool path and which side the part stays on.

%
O1700 (OUTER CONTOUR G41);
G17 G21 G40 G49 G80 G90 G94;
T02 M06;
G54 S2500 M03;
G00 X-20. Y-10.;
G43 H02 Z50.;
M08;
G00 Z5.;
G01 Z-3. F100.;
G41 D02 G01 X0. Y0. F300.;
G01 X80. Y0.;
G01 X80. Y50.;
G01 X0. Y50.;
G01 X0. Y0.;
G01 X-10. Y-10.;
G40 G01 X-25. Y-10.;
G00 Z50.;
M09;
M05;
G49;
G91 G28 Z0.;
G90;
M30;
%

If the same outer contour is walked in the opposite direction, G42 can be used. The choice is not made from the words “outer contour” alone; the tool’s travel direction, which side the part stays on and which way the tool center must shift are evaluated together.

16. Compensation on an inner contour/pocket

When machining the inner wall of a pocket, the tool center must shift inward from the part wall by the radius. For example in a rectangular pocket bounded by X20–X80, Y20–Y60, the real wall coordinates are written and G41/G42 is chosen by the travel direction. The lead-in and lead-out moves must have enough clearance inside the pocket; if the tool diameter does not fit the pocket’s corner radii, the control cannot create a geometrically impossible path.

G00 X30. Y30.;
G01 Z-5. F100.;
G41 D03 G01 X20. Y20. F250.;
G01 X80. Y20.;
G01 X80. Y60.;
G01 X20. Y60.;
G01 X20. Y20.;
G01 X30. Y30.;
G40 G01 X40. Y30.;

17. Inner corner radius and tool diameter

A tool cannot machine an inner corner radius smaller than its own radius. For example a Ø12 tool (6 mm radius) cannot form an R4 inner corner; as a result the corner stays oversized, the control may alarm, the compensated paths may not intersect and the tool may make an unexpected move. Solutions: choose a smaller-diameter tool, increase the radius in the design, or perform the operation by a different method. Compensation does not make a physically impossible geometry possible.

18. Compensation moves at outer and inner corners

Outer corner: the control computes the intersection of one block’s compensated path with the next block’s compensated path; at sharp outer corners the tool center walks around the outside of the part corner. The real behavior at the corner depends on the control model, the compensation type, the corner angle and the geometry of the following blocks. Inner corner: the intersection of compensated lines is more critical because of the tool’s physical size; if the radius is large the tool cannot reach the corner, the paths do not intersect and there is a risk of over-cut/compensation alarm. If no geometric intersection can be formed, a “no intersection” or compensation interference alarm may appear.

19. G41/G42 are modal, and changing D

G41/G42 are modal; once activated they stay active until G40 or the opposite compensation is given. For example after G41 D01 G01 X0. Y0.; the lines X80., Y50., X0., Y0. keep G41 active even though it is not repeated. In some configurations the D number can be changed while compensation is active, but this can produce an abrupt change in the center path (surface mark, dimensional step, unexpected direction). The safe method in early training: cancel with G40, move to a safe area, and restart compensation with the new D.

20. Roughing/finishing and wear correction

The same contour program can be used for roughing and finishing with different compensation values. If the real radius is 6.000 mm, to leave a 0.30 mm allowance in roughing the effective compensation may be used as 6.300 mm (depending on configuration) and 6.000 mm in finishing. But the sign to add/subtract is evaluated together with outer/inner dimension, the G41/G42 direction and the radius/diameter layout of the offset screen — entering a random positive value is not correct. Wear correction: as the tool is used the effective diameter changes; the correction is done in small steps, after measurement, keeping a record, and re-measuring the first part. Instead of memorizing “if I add plus the part always gets bigger,” the student should reason: which way does the offset change shift the tool center, and does that shift remove more or less material?

21. Outer and inner dimension correction logic

Outer contour: moving the tool center away from the part leaves the part larger; moving it toward the part removes more material and reduces the outer dimension. Which sign is entered into the D offset depends on the G41/G42 direction, the Geometry/Wear usage and whether the value is radius or diameter. Inner contour: if the tool approaches the wall more, the inner dimension grows; if the center path moves away from the wall, the inner dimension shrinks — this behaves opposite to the outer dimension. So the same offset-correction sign may not be used for outer and inner dimensions.

22. Compensation on arcs and full circles

After compensation is activated, G02/G03 arc moves can be used. Example: G41 D01 G01 X0. Y0.;G01 X60. Y0.;G03 X70. Y10. R10.;G01 Y40.;. The control treats the programmed arc as the real contour and shifts the center by D01; on inner arcs the tool radius must suit the part radius. Full circle: the tool is first brought into compensation with a suitable linear move (G41 D01 G01 X60. Y40.;), then machined with G02 I-20. J0. F250.;; starting G41/G42 or issuing G40 in the same full-circle block is not appropriate.

23. Compensation with plane, drilling cycles and reference moves

Changing G17/G18/G19 directly while G41/G42 is active is not safe; first cancel compensation with G40 G01 X... Y...;, then change the plane. Likewise, do not switch directly into a G81–G89 drilling cycle while compensation is active; first cancel with G40, retract to a safe Z and G80, then start the cycle. G53/G28/G30 (machine coordinate, reference return) are also used carefully while compensation is active: exit the contour, cancel with G40 during a linear move, retract Z to a safe position, then use these commands. In compensation mode these commands can temporarily affect compensation.

24. Switching directly from G41 to G42

An abrupt switch from G41 to G42 makes the tool center cross to the opposite side of the contour; this can cause cutting into the part, a surface mark and a compensation interference alarm. The safe method at beginner level is to cancel first with G40 G01 X...; and create a suitable new lead-in as G42 D01 G01 X...;.

25. Compensation interference alarm

While computing compensated paths, the control may detect that the tool will enter the part or that the paths cannot intersect. Possible causes: tool radius larger than the inner corner, wrong G41/G42 direction, lead-in too short, insufficient lead-out, consecutive blocks too short, contour turning back on itself, wrong D value, geometric break, G41/G42 started in a circular block, or wrong plane. Randomly zeroing the D value to clear the alarm is not the right fix; the tool-path geometry must be checked first.

26. Compensation in CAM programs and the double-compensation error

CAM output can use different methods: Computer compensation (CAM computes the center path fully, G41/G42 may not appear in the program), Control compensation (CAM produces a path close to the part contour and G41/G42 is used, allowing small wear corrections on the machine), Wear type (CAM computes the center path largely, only a small wear value is used in the control). Without knowing which method was chosen, the full real radius must not be entered into the D offset. Otherwise double compensation occurs: CAM already shifted 6 mm outward + 6 mm entered in D01 → the control shifts another 6 mm, totaling 12 mm and seriously spoiling the dimension. The CAM setup sheet must state which of computer/control/wear compensation is used.

27. Checking the tool’s real diameter

The nominal diameter marked on a tool may not always equal the real cutting diameter; a tool marked Ø10 can produce a different effective diameter due to wear, regrinding, runout, coating differences and tip geometry. For precision work the real effective value is determined with a tool measuring device, micrometer, presetter or test-part measurement. Especially on indexable milling heads the effective diameter can be affected by the nominal size and insert placement.

28. Rounded outer contour example

On an outer contour with R10 at the corners, the programmed coordinates are the part contour; based on G41 and the D02 value, the control converts the linear sections, outer-corner arcs and tangent transitions into the compensated center path.

G41 D02 G01 X10. Y0.;
G01 X70. Y0.;
G03 X80. Y10. R10.;
G01 X80. Y40.;
G03 X70. Y50. R10.;
G01 X10. Y50.;
G03 X0. Y40. R10.;
G01 X0. Y10.;
G03 X10. Y0. R10.;

29. G41/G42 program template

The structure below is a basic compensated-contour template. The lead-in and lead-out coordinates must be prepared for safe areas outside the part.

%
O____ (COMPENSATED CONTOUR);
G17 G21 G40 G49 G80 G90 G94;
T__ M06;
G54 S____ M03;
G00 X____ Y____;
G43 H__ Z50.;
M08;
G00 Z5.;
G01 Z____ F____;
G41 D__ G01 X____ Y____ F____;
G01 X____ Y____;
G02/G03 X____ Y____ R____;
G01 X____ Y____;
G01 X____ Y____;
G40 G01 X____ Y____;
G00 Z50.;
M09;
M05;
G49;
G91 G28 Z0.;
G90;
M30;
%

30. Example: G42 on an outer profile

Part 80 × 50 mm, zero at the lower-left top corner; T03 = Ø10 end mill, D03 = 5.000 mm. The G42 selection must be verified by sketching the tool’s travel direction and the part position; the code only shows an example structure.

%
O1710 (OUTER PROFILE G42);
G17 G21 G40 G49 G80 G90 G94;
T03 M06;
G54 S3000 M03;
G00 X-15. Y-10.;
G43 H03 Z50.;
M08;
G00 Z5.;
G01 Z-4. F120.;
G42 D03 G01 X0. Y0. F350.;
G01 X0. Y50.;
G01 X80. Y50.;
G01 X80. Y0.;
G01 X0. Y0.;
G01 X-10. Y-10.;
G40 G01 X-25. Y-10.;
G00 Z50.;
M09;
M05;
G49;
G91 G28 Z0.;
G90;
M30;
%

31. Programming without compensation (comparison)

Without compensation the programmer must calculate the tool center path. For example for an outer rectangle X0–X80, Y0–Y50 and a 5 mm radius, a simple outer contour’s center coordinates could be thought of as X−5 to X85, Y−5 to Y55. But when corner radii, angled lines, inner contours and tangent arcs are added, the calculation becomes complex; if the tool diameter changes, all coordinates may need reworking. Compensation removes this burden.

32. First-part check in a compensated program

On the first run: check the D Geometry value; check whether there is an old value in the D Wear field; verify the G41/G42 direction from the drawing; check the tool’s entry point and that the lead-in distance is sufficient; use Single Block; lower Rapid and Feed Override; watch that the tool shifts to the correct side of the contour; verify the tool diameter is suitable at inner corners; measure the part after machining; if needed make a small Wear correction and re-measure the part after correcting.

33. Common mistakes

  • Thinking G41/G42 mean the machine’s right/left (correct: left/right relative to the tool’s travel direction).
  • Entering radius instead of diameter (or vice versa) in the D offset (compensation becomes double or half).
  • Calling the wrong D number (D02 applied to T03).
  • Making the lead-in/lead-out too short; starting G41/G42 at a contour corner; issuing G40 on the part wall.
  • Using too large a tool for an inner corner; changing the plane or switching to a drilling cycle while compensation is active.
  • Wrongly combining CAM compensation with control compensation (double compensation); forgetting an old value in the Wear field.
  • Relying only on RESET to drop compensation (G40 should be written at the logical end).

34. Check sequence when an alarm occurs

If an alarm occurs during G41/G42, check in order: is G17/G18/G19 correct; is the D number written and in a valid range; is the D value realistic; is compensation started with G00/G01; is the lead-in sufficient; is the first contour block too short; is the inner corner radius smaller than the tool radius; do consecutive blocks intersect; is the G41/G42 direction correct; is G40 in a suitable linear exit; is a G81–G89 or plane change issued while compensation is active; was the CAM program already prepared to the center path?

35. Safe compensation application sequence

In good practice the sequence is: (1) uncompensated start with G40, (2) tool change, (3) G54 selection, (4) tool length compensation with G43 H, (5) go to a safe X–Y start point, (6) descend to the machining Z depth, (7) linear lead-in move, (8) call G41/G42 and the D number, (9) machine the part contour, (10) linear exit outside the contour, (11) cancel radius compensation with G40, (12) retract to a safe Z, (13) M09 and M05, (14) G49 and reference return. This order makes the program easier to read and check for errors.

36. Lesson summary

In this lesson we learned that the cutter center cannot move directly on the part contour; that the center path must be shifted by the radius; that G40 cancels compensation, G41 offsets the center to the left of travel and G42 to the right; that left/right are determined by the feed direction; that G41/G42 have no fixed meaning for outer/inner contour alone; that the radius offset is mostly called with the D address and it must be verified whether the system accepts radius or diameter; that compensation is applied in the selected G17/G18/G19 plane; that compensation must be started with a suitable linear lead-in and cancelled with G40 during a suitable exit; that G02/G03 must be avoided at start/cancel; that compensation cannot solve a physical problem if the tool diameter does not suit the inner-corner geometry; that Geometry/Wear offsets serve different purposes; that the compensation type must be known in CAM programs; that G40 must be used before switching to a drilling cycle, plane change or reference move while compensation is active; and that a wrong D value, wrong direction and insufficient lead-in can cause a collision/alarm.

📷 IMAGE AREA — G41 left and G42 right compensation by travel direction; comparison of uncompensated/compensated tool paths on an outer contour
Suggested alt text: G41 left and G42 right cutter radius compensation by tool feed direction in CNC milling