G54.APP

G-code deep dive

G54–G59 Work Offsets: How Work Coordinate Systems Work

G54G55G56G57G58G59G54.1G59.1G53G10 L2G10 L20

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 G55G59 (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:

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4Notes
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

Frequently asked questions

What is the difference between G54 and G55?

Nothing structural — they are two identical slots. G54 is work coordinate system 1 and G55 is system 2. Each stores its own XYZ (and rotary) offset from machine zero, so you typically use G54 for the first vise or fixture and G55 for the second.

Is G54 the default work offset?

On most controls, yes. LinuxCNC, GRBL, Centroid, FANUC, Mach3 and Mach4 all wake up in G54 after power-on or reset. Well-written programs still command G54 explicitly at the top rather than relying on the default.

What is the difference between G54 and G92?

G54 selects a stored offset table entry that survives power cycles and is set independently of the program. G92 shifts the coordinate system on the fly from wherever the tool currently is, which stacks on top of the active G54–G59 offset. Modern practice: set your fixture offsets with G54–G59 and avoid G92 unless you have a specific reason.

How do I get more than six work offsets?

It depends on the control. LinuxCNC and Mach3/4 add G59.1, G59.2, G59.3. FANUC and Mach4 use G54.1 P1, P2, … Centroid uses G54 P1–P12 (no decimal point). GRBL stops at G59.

See it, don't guess it

Paste a program into the free G54.APP viewer and watch these codes execute — toolpaths, stock removal, and machine state, live in your browser. Nothing is uploaded.

Open the G-code viewer