G54 answers a question every program needs answered: where on the table is the part? The control knows its own home position, but it has no idea where you clamped the material until you tell it. G54 is how you point the program at that spot.
Machine zero vs part zero
When a machine homes its axes, it finds a fixed reference called machine zero. That point never moves. Your part, though, sits wherever you clamped it. The program is written around a convenient part zero (often a corner or the center of the stock), not around machine zero.
A work offset is simply the distance from machine zero to part zero, stored as X, Y, and Z values in an offset register. G54 activates the first such register. After G54, every coordinate in the program is measured from your part zero on a normal Cartesian coordinate system, which is what lets you program from the drawing instead of from the machine.
G54 through G59: six coordinate systems
Controls give you several work coordinate systems so you can hold more than one setup at a time. The standard set runs G54 to G59, and each stores its own independent offset, as listed in the LinuxCNC coordinate-system reference:
| Code | Work coordinate system | Typical use |
|---|---|---|
G54 | System 1 | The main part (most common) |
G55 | System 2 | A second part or fixture |
G56 | System 3 | A third setup |
G57 | System 4 | A fourth setup |
G58 | System 5 | A fifth setup |
G59 | System 6 | A sixth setup |
Many Fanuc-style controls extend this further with the G54.1 P1, P2, and so on additional offsets, covered in the standard work coordinate system guides, which is handy on fixtures that hold many parts.
How a work offset is set
You do not type the offset into the program. You measure it at the machine and enter it into the offset table:
| Step | What you do |
|---|---|
| 1 | Home the machine so machine zero is known |
| 2 | Touch off X and Y with an edge finder or probe at the part corner |
| 3 | Touch off Z at the top of the part or a known surface |
| 4 | Store those values in the G54 register |
The program then just calls G54 and trusts those stored numbers. This is why the same program runs on any setup: only the offset changes, not the code.
G54 is modal, and separate from tool length
G54 is modal: it belongs to the coordinate-system group, so once active it stays active until you call another offset like G55. That is the same carry-down behavior you track when you read a CNC program line by line, and it pairs with the absolute positioning in G90 vs G91, since absolute coordinates are measured from the active work offset.
One common mix-up: the work offset locates the part, while the tool length offset locates each tool. They are different tables. The work offset is G54; the tool length offset is handled by G43 and an H register. Forgetting to activate G54, or leaving the wrong one active, sends the whole job to the wrong place, so it belongs on every list of common G-codes for CNC beginners.
Bottom line
G54 selects work coordinate system 1, the stored distance from machine zero to your part zero. G54 to G59 give six independent systems for six setups. It is modal, it is set by touching off and storing values, and it is separate from tool length offset. Get it right and the same program runs anywhere on the table.
Sources
- LinuxCNC G-code reference (G54-G59 coordinate systems)
- HelmanCNC: G54 to G59 work coordinate system
- Wikipedia: Cartesian coordinate system
Frequently asked questions
What is G54 in CNC?
G54 activates work coordinate system 1, the first stored part zero. The program’s X, Y, and Z values are measured from that origin. It is modal, so it stays active until you call a different offset.
What is the difference between machine zero and a work offset?
Machine zero is the fixed home the machine finds when it homes. A work offset is the distance from machine zero to your part zero, which G54 stores so the program can use part-relative coordinates.
Why are there G54 through G59?
They are six independent work coordinate systems, one per setup or fixture, and many controls extend the set with additional offsets such as the G54.1 P series.
What is the best way to learn work offsets like G54?
Drill the coordinate codes with active recall. A free app like G-Code Sprint quizzes G54 and the rest of the everyday codes as quick timed questions and repeats the ones you miss.
G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.