CNC mill · G-code
G10: set offsets from the program
G10 writes offsets from the program: L2 sets a work offset (G54–G59), other L numbers set tool length and diameter offsets. L20 means something different on each control. Haas lists it as one-shot (group 00). Formats below from Haas, LinuxCNC, Mach4, Mach3 and Fanuc, each from its maker.
Worked example
Set G55 outright, then nudge G54 (G54 X is −15.0 on the offsets page). Written for this page in the Haas format.
G90 G10 L2 P2 X-12.5 Y-8.25 (G55 = these machine coordinates)G91 G10 L2 P1 X6.0 (adds 6.0: G54 X becomes -9.0)G90 (back to absolute)G55 G00 X0 Y0G91 G10 L2 P1 X6 adds 6 to G54 X on Haas and Mach4 (-15 → -9); LinuxCNC ignores G91 and sets X6.
How each control writes it
Haas G10 L- P- R- X- Y- Z-
One source: Haas Automation, the control's maker
- L
- Category: L2 = G52 (P0) and G54–G59 (P1–P6); L20 = G110–G129 (P1–P20) or G154 P1–P99; L10/L11 length and wear (H); L12/L13 diameter and wear (D); L14 max RPM
- P
- Which offset in that category
- R
- Value for a length or diameter offset (optional)
- X, Y, Z, A, B, C
- Axis zero location for a work offset (optional)
- In G90 the value replaces the offset; in G91 it is added to it: G10 L2 P1 G91 X6.0 moves G54 6.0 to the right.
- L20 writes the auxiliary offsets G110–G129 and G154 P1–P99.
LinuxCNC G10 L2 P- axes R- / G10 L20 P- axes
One source: the LinuxCNC project, the control's maker
- P
- Coordinate system: 1–6 = G54–G59, 7–9 = G59.1–G59.3, 0 = the active one
- X, Y, Z …
- L2: the origin, measured from machine zero; L20: what the current position should read (optional)
- R
- L2 only: rotation of the XY axes about Z, degrees counterclockwise (optional)
- G91 has no effect on G10 L2: the value always replaces the offset.
- L20 sets the offset so the current position reads the value given: G10 L20 P1 X1.5 makes the current position X1.5 in G54.
- G10 L2 does not select that system: program G54–G59.3 to use it.
- G10 L1, L10 and L11 write the tool table.
Source: LinuxCNC documentation, "G10 L2 / G10 L20 Set Coordinate System" (archived Oct 29, 2026)
Mach4 G10 L2 P- X- Y- Z- A- B- C- (modal: G10 L2 … G11)
One source: Artsoft (Newfangled Solutions), the control's maker
- P
- Fixture offset: 1–6 = G54–G59; 0 = the work shift
- X, Y, Z, A, B, C
- Offset values; axes left out are not changed (optional)
- In G90 the value is written into the offset; in G91 it is added to it. Mach4 calls this a major difference: check the mode first.
- L20 writes the additional offsets G54.1 P1–P248; L10–L13 write the H and D offsets.
- The modal form sets several offsets in a row and is closed by G11.
Source: Mach4 Mill Programming Guide v1.1 (Artsoft), "G10 L2 Fixture Offset Setting; G10 L20" (archived Jul 1, 2024)
Mach3 G10 L2 P- X- Y- Z- A- B- C-
One source: Artsoft (Newfangled Solutions), the control's maker
- P
- Fixture number 1–255; 1–6 are G54–G59
- X, Y, Z, A, B, C
- Origin, in absolute machine coordinates (optional)
- Only the axes named are changed.
- The values are lost unless the fixture table is saved on the Tables screen.
- G10 L1 P- sets a tool's offsets, but not its diameter.
Source: Using Mach3Mill rev 1.84 (Artsoft), "10.7.5 Set Coordinate System Data - G10" (archived Oct 18, 2026)
Fanuc G10 L_ P_ R_ Q_ ;
One source: FANUC, the control's maker
- L
- Which offset: L10 length geometry (H), L11 length wear (H), L12 radius geometry (D), L13 radius wear (D)
- P
- Offset number
- R
- Offset value: replaces it in G90, adds to it in G91
- Q
- Imaginary tool nose number (optional)
- FANUC 0i-MF (machining centre), from its operator’s manual. On another FANUC model, check that control’s manual.
- This form is for tool compensation memory C. With memory A it is G10 L11 P_ R_ Q_ ;.
- This section sets tool compensation values only.
Source: FANUC B-64604EN-2/01, Operator's Manual, 0i-MF (machining centre), §6.10
How the controls differ
- Only LinuxCNC takes Z ….
- Only Fanuc takes Q.
- A word two controls share can still mean different things: read each control's list above.
Haas follows Fanuc's numbering, but options and parameters differ between controls: check your control's manual.