We use technical and security cookies and, only if you accept, analytics with no cross-site tracking. More in the Cookie policy and Privacy policy.
We use first-party cookies and technical storage to make the site work, Google reCAPTCHA security technology and, only if you accept, Vercel analytics (no cookies, no cross-site tracking). You can accept or reject analytics; both options are equivalent and you can change your choice at any time. More info: Cookie policy, Privacy policy, Legal notice and Terms and conditions.
G54, G55, G56, G57, G58 and G59 are the six rows of the machine work offset table: each one stores the distance from machine zero to the zero of a different setup, and the code you write decides which one the program X, Y and Z coordinates are measured from. They are modal, so the last one you wrote stays in charge until another replaces it. When you need more than six setups you move to the extended offsets: G54.1 P on Fanuc and G154 P on Haas.
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.
Family
Coordinate system
Machine
Milling, Turning, Mill-turn
Risk
High
Example
G54 G00 X0 Y0
Syntax by control
Fanuc (milling and turning)
G90G54G00X0.Y0.
The six run in sequence: G54, G55, G56, G57, G58 and G59. They are written in the safety block of every tool, together with G90, so that starting part way through the program does not inherit the work offset of the previous operation.
Fanuc with extended work offsets
G54.1P7
G54.1 P1 to P48 are additional work offsets (up to P300 with the matching option). They do not replace the classic six: they live alongside them. They are loaded from the program with G10 L20 P7 X... Y... Z..., not with L2.
Haas
G90G154P7G00X0.Y0.
Haas uses G54 to G59 just like Fanuc and extends with G154 P1 to P99. On older machines the additional ones were G110 to G129, which many controls still accept for compatibility.
Siemens 840D / 828D
G54G90G0X0Y0
G54 to G57 are the settable zero offsets that come as standard; G505 to G599 extend the list and G500 deactivates them leaving nothing set. Separately there are TRANS and ATRANS, programmable shifts that add on top of the settable one and have to be cancelled with a bare TRANS.
Heidenhain TNC (Klartext)
CYCLDEF247FIJARORIGENQ339=2
On Heidenhain there are not six codes: there is a preset table with as many rows as you need. Cycle 247 selects the preset number from inside the program, which is the exact equivalent of going from G54 to G55.
Address letters used with it
Letter
What it sets
Unit
G54 ... G59
Work offset selector: it takes no arguments. Each code points at a row of the table, where the values for each axis are stored.
modal, no units
X Y Z (in the table)
Content of each row: distance from machine zero to the zero of that setup, axis by axis. On a mill with machine zero up and at the back, X and Y come out negative.
mm / in
P (with G54.1 or G154)
Number of the extended work offset when there are more than six setups: G54.1 P7 on Fanuc, G154 P7 on Haas.
integer
L2 P1-P6 (with G10)
The way to write one of the six work offsets from the program itself: G10 L2 P1 is G54, P2 is G55 and so on to P6, which is G59. Under G90 it replaces the value and under G91 it adds to it.
mm / in
L20 P (with G10)
The same for the extended work offsets: G10 L20 P7 X... Y... Z... writes row 7 of the G54.1 or G154 list.
mm / in
Worked example
Two identical plates clamped in two vises on the same table. The operator picks up the corner of each one and stores the values in G54 and in G55. The machining lives in a subprogram, so the main program only changes work offset and calls it again: the same code does both parts without touching a single coordinate.
O0059(DOS AMARRES CON G54 Y G55)
( Header of the main program. )
G21G17G40G49G80
( Millimeters, XY plane and a clean state: no offsets and no cycles active. )
G91G28Z0.
( Z to the reference point in incremental before the tool change. )
T1M06
( 10 mm cutter. )
G90G54G00X0.Y0.
( Absolute and first work offset. From here on, X0 Y0 is the corner picked up on the part in the left-hand vise. )
G43H01Z50.M03S3400
( T1 length offset and spindle on. )
M98P1001
( Calls the subprogram with the machining of one part. Every coordinate inside is measured from the active work offset, which is now G54. )
G00Z50.
( Retracts in Z before changing work offset: the jump between setups is always made with the tool up. )
G90G55G00X0.Y0.
( Second work offset. The same subprogram coordinates now refer to the part in the right-hand vise. )
M98P1001
( Same subprogram, second part. If that setup moves, only the G55 row gets touched up. )
G00Z50.M09
( Final retract and coolant off. )
G91G28Z0.M05
( Z to the reference point and spindle stop. )
G90G53X0.Y-450.
( G53 works in machine coordinates and ignores the active work offset: it takes the table out to the load position. )
M30
( End of the main program. Without this M30 the control would keep reading and walk into the subprogram. )
O1001(MECANIZADO DE UNA PIEZA)
( Subprogram: the content is identical for both setups. )
G00X15.Y15.Z2.M08
( Positioning and coolant on, in part coordinates. )
G01Z-4.F160
( Feeds down to depth. )
G01X65.F650
( Slot along the plate. )
G00Z2.
( Comes out to the safe height, still inside the subprogram. )
M99
( Hands control back to the next block of the main program. )
How the six work offsets are shared out in production
The usual split is one work offset per setup: G54 for the left-hand vise, G55 for the right-hand one and so on. They are also used for the different faces of one part on an angle plate, for each face of a cube in a fourth axis, or to keep apart jobs that share a machine but not a part. What hardly ever pays is splitting them by tool or by operation: if every operation on a setup shares one work offset, picking the part up again means correcting a single row and the whole program is up to date.
When you need the extended work offsets
Six run out the moment you have a fixture plate with eight or twelve parts, a four sided tombstone or a pallet with several setups. That is what G54.1 P1 to P48 on Fanuc, G154 P1 to P99 on Haas and G505 to G599 on Siemens are for. They are written from the program with G10 L20 P instead of G10 L2 P, and that difference is what trips people up most: using L2 with a high number wipes out another row or alarms. Before counting on them, check the option is enabled on the machine.
What should not end up in the offset table
The table stores only where the zero of each setup is. Tool wear goes in its own offset, not here. The height of the part does not go here either if the tools are measured against the face, because it would be counted twice. And the G52, G92 or TRANS shifts do not show up in the table: they add on top of the active work offset invisibly and they are the classic reason for machining ten millimeters off with the table looking perfectly correct. G53 is the useful exception: it ignores every work offset and works in machine coordinates.
Mistakes that cost you a part (or a tool)
Picking the part up into G54 and leaving a G55 in the program inherited from the previous operation: the machine heads for the other setup, in rapid and with the tool down.
Dragging an active G92 or G52 in from an earlier program: the zero is shifted and the offset table still shows the correct values, so the error is invisible on the screen. Cancel with G52 X0 Y0 Z0.
Writing G10 L2 with G91 active: the values add to the existing work offset instead of replacing it, and every run of the program walks the zero a bit further.
Using G10 L2 to load an extended work offset: the G54.1 and G154 ones need L20. With L2 you write into another row or the control alarms.
Changing work offset with the tool down: the move between setups crosses vises, clamps and the part itself. The work offset change always happens with Z up.
Putting the part height in the Z of the work offset and also measuring the tools against the table: the same distance is taken off twice and the tool goes in too deep.
Assuming the setup repeats: changing the stop, re-clamping the vise or flipping the part means picking that row up again.
Frequently Asked Questions (FAQ)
How many work offsets does a machine have?
The classic six, G54 to G59, plus the extended ones: G54.1 P1 to P48 on Fanuc (up to P300 with the option), G154 P1 to P99 on Haas and G505 to G599 on Siemens. On Heidenhain the list is the rows of the preset table. The extended ones are usually a machine option, so it pays to confirm they are enabled.
What happens if I write no G54 in the program?
The machine uses whichever work offset was active, which is normally the one from the last part machined. On most controls the power up default is G54, but that is a parameter and not a guarantee. Writing the work offset in the safety block of every tool costs nothing and takes the problem away.
Can I change work offset halfway through a program?
Yes, and it is the normal way to machine several parts on the table: you do the first under G54, retract the tool in Z, write G55 and call the same subprogram again. The only firm rule is that the work offset change happens with the tool up and in a safe positioning block.
What is the difference between G54-G59 and G52 or G92?
G54 to G59 select a row that is stored and visible on the work offset screen. G52 and G92 are shifts that add on top of the active work offset and stay set without appearing in that table. For repeatable work you use the first; the second only for temporary shifts, and always cancelling them.
Do the same work offsets apply on a mill and on a lathe?
The concept is the same and so are the codes, but on a lathe the normal thing is a single work offset with Z on the finished face of the part, using G55 or G56 for the second setup or the operation after turning it around. On lathes with a sub spindle each spindle usually carries its own set of work offsets.