G54 through G59 select work coordinate systems (also called work
offsets or fixture offsets). Each one stores a distance from the machine's
home position to a zero point you choose — usually a corner or center of
the part. When a program says G0 X0 Y0, the machine goes to the active
work system's zero, not the machine's.
That indirection is the whole point: the CAM program is written around the part's zero and doesn't care where the vise sits on the table. Move the fixture, touch off the new location into G54, and the same program runs unchanged. (Yes — this site is named after the most-typed code in CNC.)
#How the offsets work
Machine coordinates are fixed by homing: machine zero is wherever the home switches put it. A work offset is just a stored vector added to that:
work position = machine position − work offset
The six systems are selected modally — G54 stays active until another
G55–G59 (or an extended offset) replaces it:
G54 ; use work system 1 (first vise)
G0 X0 Y0 ; rapid to part zero of vise 1
M98 P100 ; run the part program
G55 ; same program, second vise
G0 X0 Y0 ; now this is vise 2's part zero
M98 P100
#Setting an offset
You can set offsets from the control's touch-off screen, or in G-code with
G10:
G10 L2 P1 X_ Y_ Z_— set G54 (P1) to an absolute machine position. P2 = G55 … P6 = G59.G10 L20 P1 X0 Y0 Z0— set G54 so that the current position becomes the given value ("zero here"). This is what most touch-off buttons do behind the scenes.
| Operation | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|
| Select work coord system 1–6 | G54 / G55 / G56 / G57 / G58 / G59 |
G54 / G55 / G56 / G57 / G58 / G59 |
G54 / G55 / G56 / G57 / G58 / G59 |
G54 / G55 / G56 / G57 / G58 / G59 |
G54 / G55 / G56 / G57 / G58 / G59 |
G54 / G55 / G56 / G57 / G58 / G59 |
G54 is the default WCS after power-on on most controls. |
| Work coord systems 7–9 | G59.1 / G59.2 / G59.3 |
— | — | — | G59.1 / G59.2 / G59.3 |
G59.1 / G59.2 / G59.3 |
The LinuxCNC / Mach way to get three more fixtures. |
| Extended fixture bank (P-addressed) | — | — | — | G54.1 |
— | G54.1 |
FANUC: P1–P48 (0i) or P1–P300 (30i). Mach4: P1–P248. Centroid uses a different, NO-decimal form below. FANUC: G54.1 P1–P48 (0i) / P1–P300 (30i) Mach4: G54.1 P1–P248 |
| Extended work offsets (Centroid) | — | — | G54 P1–P12 |
— | — | — | Centroid's 12 optional extended fixtures (WCS #7–#18). Note the space and NO decimal — distinct from FANUC's G54.1 Pn. Centroid: also addressable as E7–E18 |
| Set work offset value (absolute) | G10 L2 |
G10 L2 |
G10 L2 |
G10 L2 |
G10 L2 |
G10 L2 |
P1 = G54 … P6 = G59. The active WCS need not match P. |
| Set work offset to current position | G10 L20 |
G10 L20 |
G10 L20 |
G10 L20 |
G10 L20 |
G10 L20 |
"Set to here" form. |
| Local coordinate offset | G52 |
— | G52 |
G52 |
G52 |
G52 |
Temporary frame shift on top of the active WCS. |
| Move in machine coordinates (non-modal) | G53 |
G53 |
G53 |
G53 |
G53 |
G53 |
One-shot move in the machine frame. |
— means the control has no equivalent code. Full cross-control tables: the complete G-code & M-code reference.
#Escaping the offset: G53
G53 is a non-modal one-shot: it applies to a single block and moves in
raw machine coordinates, ignoring the active work offset. It's the standard
way to send the spindle to a fixed park or tool-change position:
G53 G0 Z0 ; raise Z to machine zero (top of travel)
G53 G0 X-10 Y-10 ; park near home, regardless of which G54–G59 is active
G53 must be paired with a motion command on the same line and does not
cancel the work offset — the next line is back in G54 (or whatever was
active).
#Common mistakes
- Relying on the power-on default. The machine usually wakes in G54, but a previous program may have left G55 active mid-session. Command your work system explicitly in the preamble.
- Touching off in the wrong system. Zeroing the part while G55 is active, then running a G54 program, sends the tool to wherever G54 last pointed — a classic crash. The viewer's coordinate readout shows the active system for exactly this reason.
- Mixing G92 with G54–G59. A leftover G92 shift silently offsets every work system. If parts suddenly cut off-location, clearing the G92 offset is the first thing to check.
- Assuming extended offsets are portable.
G54.1 P5(FANUC/Mach4),G59.1(LinuxCNC/Mach), andG54 P5(Centroid) are three different spellings — and GRBL has none of them. Check the table above before posting for a different control.