Back to GSM Code List

G42: cutter radius compensation to the right

G42 offsets the toolpath by one tool radius to the right of the contour, looking in the direction of travel, using the radius in the D offset register. It is the mirror image of G41: you use it when the material is on the left of the direction of travel. With a right-hand cutter running M03, G42 gives conventional milling, and on a lathe it is the usual tool nose radius compensation for a right-hand insert turning toward the chuck.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

See the full data sheet for the family

Syntax by control

Fanuc (milling)

G01 G42 D01 X-15. Y0. F250

It comes on in a linear move clear of the part and goes off with G40 in another linear move. D is the radius offset register in the tool table.

Fanuc / Haas (turning)

G42 G01 X40. Z-2. F0.2

On a lathe G42 compensates the insert nose radius. Besides the radius you need the right tip orientation code (0 to 9) in the offset table: with the orientation wrong, compensation is applied to the wrong side.

Haas (milling)

G01 G42 D01 X-15. Y0. F250

Same syntax as Fanuc. If the machine offset table works in diameter and you enter the radius (or the other way around), the part comes out the same amount off size all the way around the contour.

Heidenhain TNC (Klartext)

L X-15 Y+0 RR F250

RR is the equivalent of G42, RL of G41 and R0 of G40. The radius comes from the R column of TOOL.T; the APPR/DEP cycles let you lead in and out of the contour tangentially or on an arc without building the move by hand.

Address letters used with it

LetterWhat it setsUnit
DRadius offset register number in milling. On a lathe, the nose radius and its orientation come from the offset called with the T word.integer (D01, D12...)
X Y (X Z on a lathe)End point of the lead-in block and of every contour segment, in finished part dimensions.mm / in
FFeedrate for the lead-in block and for the contour.mm/min under G94, mm/rev under G95
G17 / G18 / G19Plane the compensation acts in. Milling works in G17 (XY); on a lathe the plane is G18 (XZ).modal, no units

Worked example

The same 80 x 60 mm plate as the G41 example, but run counterclockwise with a 12 mm cutter and D01 = 6.0 mm. This is the conventional milling case, still the sensible option when there is mill scale or a casting skin that kills the edge on entry, or on a machine with noticeable backlash in the screws.

O0042 (PERFIL EXTERIOR CON G42)
( Program header. )
G21 G17 G40 G49 G80
( Clean starting state: no offsets and no canned cycle active. )
G91 G28 Z0.
( Z to the reference point in incremental before the tool change. )
T1 M06
( 12 mm cutter. )
G90 G54 G00 X-25. Y-15.
( Start point clear of the part, below and to the left of the profile. )
G43 H01 Z50. M03 S3000
( Tool length offset for T1 and spindle on. )
M08
( Coolant on. )
G00 Z-5.
( Depth of cut, still clear of the material. )
G01 G42 D01 X-15. Y0. F250
( Turns compensation on to the right in a lead-in with 15 mm of sideways travel in Y, well above the 6 mm radius. )
G01 X80. F450
( Bottom wall Y0 feeding toward +X. Looking the way the cutter is going, the material is on the left: that is why G42. )
Y60.
( Right wall X80, climbing. )
X0.
( Top wall Y60, heading toward -X. )
Y-15.
( Left wall X0 coming down and lead-out along the extension, already clear of the material. )
G01 G40 X-25.
( Cancels compensation in a straight move with the cutter outside the part. )
G00 Z50. M09
( Retract in Z and coolant off. )
G91 G28 Z0. M05
( Z to the reference point and spindle stop. )
G90 M30
( Back to absolute and end of program. )
Open the simulator to check the example

Practical keys to using G42 in the workshop

When you use G42 and not G41

The rule is the same for both and it does not depend on whether the contour is outside or inside: look along the direction of travel. If the material is on the left, the tool shifts right and you want G42. With a right-hand cutter and M03 that happens running an outside profile counterclockwise or a pocket clockwise, in other words conventional milling. On a lathe with a front turret and a right-hand insert, turning from right to left toward the chuck leaves the material on the left of the travel and calls for G42.

How it works with the lead-in, D and G40

G42 comes on in a linear block that starts clear of the material and whose sideways travel is bigger than the tool radius, because the control has to place the center perpendicular to the next move. The lead-out with G40 follows the same rule. On a lathe you also need the tip orientation code in the offset table on top of the radius: without it the control does not know which way the edge faces and compensates backwards, above all on tapers and radii. G42 lives alongside G43 in milling and alongside the T offset on a lathe.

What it actually corrects on a profile

Compensation only touches the path, so the dimensional margin lives in the offset. In milling the D offset is where you dial in the last few hundredths of the profile without touching the program. On a lathe, nose radius compensation changes nothing on a straight turn or a face, but it is essential on tapers and radii: without it the taper comes out at the right angle but displaced, and radii come out short or long depending on direction. That error grows with the nose radius of the insert.

Mistakes that cost you a part (or a tool)

  • Copying a G41 program and just reversing the order of the points without switching to G42: the cutter eats the profile from the wrong side all the way around.
  • Turning G42 on in a lead-in shorter than the tool radius, or doing it in an arc: compensation alarm or a gouge at the entry.
  • On a lathe, entering the nose radius in the table and forgetting the tip orientation code (0 to 9): straight moves come out fine and tapers and radii come out displaced.
  • Leading straight into the contour with G42 from inside the material: the offset ramps in on the first move and cuts material where it should not.
  • Leaving G42 on when you reach the tool change or the G28: you have to cancel with G40 before retracting.
  • Calling a D that does not belong to the tool in the spindle: the path shifts by whatever another row of the table says and the profile comes out off size with no symptom at the machine.

Frequently Asked Questions (FAQ)

What is the real difference between G41 and G42?

Only the side. Looking along the direction of travel, G41 shifts the tool left and G42 shifts it right. As a consequence, with G41 the material is on the right of the travel and with G42 it is on the left. It has nothing to do with the contour being outside or inside.

Is G42 conventional milling?

With a right-hand cutter running M03, yes: G42 leaves the material on the left of the travel and that is conventional milling. With a left-hand tool or the spindle in M04 the relationship flips, so the useful rule is to look at the rotation and the side of the material, not at the code.

Is G42 used on lathes?

Yes, and it is the commonest case: with a front turret and a right-hand insert turning toward the chuck, tool nose radius compensation goes on with G42. You cancel with G40 before retracting the tool, and the tip orientation has to be right in the offset.

Can I switch from G41 to G42 without cancelling?

Some controls allow it in a linear move, but it is a classic source of gouging because the tool crosses from one side of the contour to the other. The safe way is to cancel with G40 clear of the material and turn compensation back on in a fresh lead-in block.

Why is the part off size by the same amount all the way around?

Almost always the offset value: a radius where the control expects a diameter, an old wear value nobody cleared, or the offset of another tool. Measure the profile, work out the difference per side and fix it in the table; the program stays as it is.

Related codes

Related tools