Back to GSM Code List

G54: the first work offset (part zero)

G54 selects the first work offset: from that block on, every X, Y and Z dimension in the program is measured from the point on the part that the operator picked up and stored in the offset table. It is modal, so it stays active until another G55-G59 replaces it. What the table stores is the distance from machine zero to part zero, normally negative in X and Y.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

See the full data sheet for the family

Syntax by control

Fanuc (milling and turning)

G90 G54 G00 X0. Y0.

It goes in the safety block of every tool, together with G90. For more than six setups, Fanuc extends the list with G54.1 P1...P48 (up to P300 depending on the option).

Haas

G90 G54 G00 X0. Y0.

Identical to Fanuc. The extra Haas offsets are G154 P1...P99; older machines used G110-G129 for the same thing.

Siemens 840D / 828D

G54 G90 G0 X0 Y0

On Siemens, G54-G57 are settable zero offsets; G505 to G599 extend the list and G500 deactivates them. There are also the programmable offsets TRANS and ATRANS, which add on top of the settable one.

Heidenhain TNC (Klartext)

CYCL DEF 247 FIJAR ORIGEN Q339=1

On Heidenhain the datum comes from the preset table or from the datum table. Cycle 247 selects the preset number from inside the program, which is the practical equivalent of switching from G54 to G55.

Address letters used with it

LetterWhat it setsUnit
X Y Z (in the table)Values stored in the offset row: distance from machine zero to part zero on each axis. They are not written in the G54 block, they are loaded into the table or with G10.mm / in
P (with G54.1 or G154)Extended offset number when you have more setups than the classic six: G54.1 P7 on Fanuc, G154 P7 on Haas.integer
L2 P1 (with G10)The way to write the offset from inside the program: G10 L2 P1 X... Y... Z..., where P1 is G54 and P6 is G59.mm / in

Worked example

Plate clamped in a vise. The operator picks up the front left corner and the top face and stores those values in G54; here they are written from the program with G10 L2 P1 to make clear what they mean. Then a step is milled with a 16 mm cutter.

O0054 (ESCALON CON ORIGEN G54)
( Program header. )
G21 G17 G40 G49 G80
( Millimeters, XY plane and a clean state. )
G90 G10 L2 P1 X-412.350 Y-215.780 Z0.
( Writes the G54 offset (P1) from the program: the distance from machine zero to the corner that was picked up. With G90 it replaces the value; with G91 it would add to it. Plenty of shops prefer to keep this in the table only. )
G91 G28 Z0.
( Z to the reference point in incremental before the change. )
T1 M06
( 16 mm cutter. )
G90 G54 G00 X-15. Y10.
( Turns the offset on and positions in part dimensions: X-15 is 15 mm to the left of the corner that was picked up. )
G43 H01 Z50. M03 S2600
( T1 length offset and spindle on. With the G54 Z at zero, it is the offset length that puts Z0 on the face. )
G00 Z2. M08
( Approach and coolant on. )
G01 Z-3. F150
( Goes 3 mm below the face: Z-3 is a part dimension, not a machine one. )
G01 X95. F600
( Cut along the plate for the step. )
G00 Z50. M09
( Retract and coolant off. )
G91 G28 Z0. M05
( Z to the reference point and spindle stop. )
G90 G53 X0. Y-400.
( G53 works in machine coordinates and ignores the G54: it is how you bring the table out to the load position. )
M30
( End of program. )
Open the simulator to check the example

Practical keys to using G54 in the workshop

When you use G54 and when another offset

G54 is the default and the one you use when there is a single setup. The next ones, G55 to G59, are for more parts on the table, for a setup in a fourth axis chuck or for several faces of the same part. Past six setups you move to the extended offsets, G54.1 P on Fanuc and G154 P on Haas. The healthy habit is to write the offset in the safety block of every tool, so that starting the program part way through does not inherit the offset of the previous operation.

How it works with G90, G43 and G53

G54 says what you measure from, G90 says the dimensions are absolute and G43 says how far the tool sticks out: the three go together in the start block. G52 and G92 add on top of the active offset and stay in effect until you cancel them, so it is best to avoid them or to clear them with G52 X0 Y0 Z0. G53, on the other hand, adds to nothing: it is a move in machine coordinates that ignores the active offset, and it is the clean way to go to a load or unload position.

What the table actually stores

The G54 row stores a vector: how far you have to travel from machine zero to part zero on each axis. Since machine zero on a mill is usually at the back right corner and at the top, the X and Y values come out negative, and Z as well if you touch off the face. That vector is the only thing that changes when the part moves a few millimeters: the program stays as it is. That is why picking the part up again and correcting the row is the most common setup job in the shop.

Mistakes that cost you a part (or a tool)

  • Picking the part up into G54 and leaving another offset active in the program (a G55 inherited from the previous operation): the machine cuts in the wrong place and it does it in rapid.
  • Dragging an active G92 or G52 in from an earlier program: part zero is shifted and the table does not show it. Clear it with G52 X0 Y0 Z0 and keep G92 out of new programs.
  • Re-clamping the vise, moving the stop or flipping the part without picking the offset up again.
  • Putting the part height in the G54 Z and also setting the tools against the table: the same distance is taken off twice and the tool goes in too deep.
  • Writing G10 L2 with G91 active: the values add to the existing offset instead of replacing it, and every run of the program walks the zero a bit further.
  • Assuming a G53 goes back to part zero: G53 is machine coordinates, so G53 X0. Y0. takes the table to machine zero, not to the corner of the part.

Frequently Asked Questions (FAQ)

What is the difference between G54 and G92?

G54 selects a row of the work offset table, which is stored data you can see on the screen. G92 redefines the origin on the fly by declaring what coordinate the current position has, and that shift stays active invisibly until it is cancelled. For repeatable work you use G54.

How many work offsets does a machine have?

The classic six, G54 to G59, plus the extended ones: G54.1 P1...P48 on Fanuc (up to P300 with the option) and G154 P1...P99 on Haas. On Siemens the list grows with G505 to G599 and on Heidenhain with the rows of the preset table.

What exactly is stored in the G54 row?

The distance from machine zero to part zero on each axis, with its sign. On a mill with machine zero at the back right corner, X and Y come out negative. It is not the probe position and not the tool height: just where the zero of the part is.

Do I have to repeat G54 in every tool?

It is not required because it is modal, but it is good practice: if the operator starts the program part way through, at the block for the third tool, that block has to bring its own G90 G54 and its G43 H so the machine does not inherit the state of the previous program.

Can I change work offset in the middle of a program?

Yes, and it is the normal thing with several parts on the table: you machine the first one under G54, call the subprogram under G55, and so on. Every offset change should happen with the tool retracted and in a safe positioning block.

Related codes

G55G59G53G92G90

Related tools