G-code reference

G42 G-Code: Cutter Radius Compensation Right

Cutter Radius Compensation Right — Offsets the tool path to the right of the contour by the D value. With a right-hand cutter, G42 on an outside contour gives conventional milling.

By cnccode · Updated
PropertyValue
CodeG42
FunctionCutter Radius Compensation Right
Modal group07
TypeModal — stays active until replaced by another code of the same group
Used onMills and lathes
SyntaxG42 D_ G01 X_ Y_

What does G42 do?

Offsets the tool path to the right of the contour by the D value. With a right-hand cutter, G42 on an outside contour gives conventional milling.

G42 is modal: once programmed it remains in effect for the following blocks until another code from modal group 07 replaces it or the control is reset.

Syntax and parameters

Format
G42 D_ G01 X_ Y_
AddressMeaning
DOffset register

G42 example program

Example
G42 D01 G01 X0 Y5.0 F600.

▶ Open this example in the G-code viewer

Tips and common mistakes

  • On a lathe turning an OD with the turret behind the spindle, G42 is the usual choice.

Controller compatibility

G42 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G42 modal?
Yes. G42 belongs to modal group 07 and stays active until another code of that group is programmed.
What does G42 mean in CNC?
G42 means Cutter Radius Compensation Right. Offsets the tool path to the right of the contour by the D value. With a right-hand cutter, G42 on an outside contour gives conventional milling.
What is the difference between G42 and G41?
G42 is Cutter Radius Compensation Right, while G41 is Cutter Radius Compensation Left. See the G41 page for its syntax and examples.
Can I use G42 on a lathe?
Yes, G42 is used on both mills and lathes, although some parameters differ between them.