---
title: G40, G41, G41.1, G42, G42.1 (Cutter Radius Compensation)
slug: g40-g41-g411-g42-g421-cutter-radius-compensation
docTags: 
createdAt: 2023-04-18T10:44:27.000Z
---

To turn cutter radius compensation off, program `G40`. It is OK to turn compensation off when it is already off. Cutter radius compensation may be performed only if the XY plane is active.

To turn cutter radius compensation on the **left** (i.e., the cutter stays to the left of the programmed path when the tool radius is positive), program `G41 D...`. To turn cutter radius compensation on the **right** (i.e., the cutter stays to the right of the programmed path when the tool radius is positive), program `G42 D...`. The D-word is optional; if there is no D-word, the radius of the tool currently in the spindle will be used. If used, the D number should normally be the slot number of the tool in the spindle, although this is not required. It is OK for the D number to be zero; a radius value of zero will be used.

It is an error if:

- The D number is not an integer, is negative or is larger than the number of car­ousel slots
- The XY-plane is not active or for turning the ZX plane is not active
- Cutter radius compensation is commanded to turn on when it is already on.

The behavior of the machining center, when cutter radius compensation is on, is described in Appendix A.

With `G41.1 D...` is the same as `G41 D...` except now the D number is not a tool number but a tool diameter.

With `G42.1 D...` is the same as `G42 D...` except now the D number is not a tool number but a tool diameter.

### Example code for milling

This example mills out a rectangular object from the outside and inside.

On the outside, we use G42, tool radius compensation right and for the inside G41, tool radius compensation left is used.

For both contours, a tool-radius-compensation entry move is programmed consisting of a line that must be longer than the tool-radius used and a circle, of which also the radius is bigger than the tool.

As a side note, all arc radii should be bigger than the tool radius. If you have inside corners, there should always be an arc, so that the tool fits.

::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/kW9Z8PLEhilnZ_fNIfgRy_image.png" size="54" width="373" height="339" caption="Milling Example 1" position="flex-start" showCaption="true"}

The G42, G41, and G40 codes are programmed with a / (block delete sign) in front. This makes it easy to debug tool comp programs. The program is loaded with the block delete, this is the blue curve.

Then the program is run with block delete off resulting in the yellow curve.

It is clear to see what the entry move does.

:::BlockQuote
g0 z3
g0 x-15 y15
f500
/g42.1 D6
g1 x-5       (cutter comp entry move 1)
g2 x0 y10 r5 (cutter comp entry move 2)
g1 z-3       (plunge down)
g3 x10 y0 r10
g1 x70
g3 x80 y10 r10
g1 y90
g3 x70 y100 r10
g1 x10
g3 x0 y90 r10
g1 x0 y10
/g40
g0 z3
g0 x30 y30
/g41.1 d6
g1 x20
g3 x10 y20 r10
g1 z-3
g3 x20 y10 r10
g1 x60
g3 x70 y20 r10
g1 y80
g3 x60 y90 r10
g1 x20
g3 x10 y80 r10
g1 y20
/g40
g0 z3
m30
:::

## Example Code for Turning

The movement starts at the right upper corner.

The blue line is the programmed contour. The yellow is the contour with tool-radius compensation G41.

The first G1 line is the tool comp entry move.

You can get this figure by putting a / character in front of the G41/G40 codes. The load the program with block delete on and execute it with block delete off. With block delete on the tool comp is skipped.



::Image[]{src="https://api.archbee.com/api/optimize/wP9peVc2bAVBPOh6IboCS/ISNFknuk7W3z_gLvrD3dl_image.png" size="54" width="513" height="437" caption="Turning Example 1" position="flex-start" showCaption="true"}

The G42, G41, and G40 codes are programmed with a / (block delete sign) in front. This makes it easy to debug tool comp programs. The program is loaded with the block delete, this is the blue curve.

Then the program is run with block delete off resulting in the yellow curve.

It is clear to see what the entry move does.

:::::Tabs
::::Tab{title="Diameter / R arcs"}
:::BlockQuote
(Radius programming)
(Use I,K programming for arc’s)
g0 x-10 z20
/g41.1 d5
g1 x-10 z10
g3 x0 z0 i10 k0
g1 x10
g2 x20 z-10 i0 k-10
g1 z-20
g3 x30 z-30 i10 k0
/g40
m30
:::
::::

::::Tab{title="Diameter / I,K arcs"}
:::BlockQuote
(Diameter programming)
(Use I,K programming for arc’s)
g0 x-20 z20
/g41.1 d5
g1 x-20 z10
g3 x0 z0 i10 k0
g1 x20
g2 x40 z-10 i0 k-10
g1 z-20
g3 x60 z-30 i10 k0
/g40
m30
:::
::::

::::Tab{title="Radius / R arcs"}
:::BlockQuote
(Radius programming)
(Use R word for arc’s)
g0 x-10 z20
/g41.1 d5
g1 x-10 z10
g3 x0 z0 r10
g1 x10
g2 x20 z-10 r10
g1 z-20
g3 x30 z-30 r10
/g40
m30
:::
::::

::::Tab{title="Radius / I, K arcs"}
:::BlockQuote
(Radius programming)
(Use I,K programming for arc’s)
g0 x-10 z20
/g41.1 d5
g1 x-10 z10
g3 x0 z0 i10 k0
g1 x10
g2 x20 z-10 i0 k-10
g1 z-20
g3 x30 z-30 i10 k0
/g40
m30
:::
::::
:::::

