G28: Return to reference position
What G28 does
G28 moves the named axes to the machine reference (home) position at rapid, passing first through the point given on the line. That intermediate point is why G28 is usually written with G91 and zero values, such as G91 G28 Z0: it means go straight up from where you are, then home. Written in G90 with Z0, the tool would first rapid down to work Z0.
| Type | G-code |
|---|---|
| Machine | Mill and lathe |
| Group | Non-modal |
| Modal | No: acts only on its own line |
G28 example
G91 G28 Z0. Go home in Z straight from the current position.
| Word | What it means here |
|---|---|
G91 | Incremental positioning |
G28 | Return to reference position |
Z0. | Z axis target or depth |
Codes people confuse with G28
| Code | What it does instead |
|---|---|
G30 | Return to second reference position. Like G28, but to a second stored position, often the tool-change point. |
G53 | Machine coordinate move. Moves to a position in machine coordinates for this one line. |
Memory hook: Always read G28 with the G90/G91 that is active on the same line.
Where controls differ
- Lathes (system A): Written G28 U0. W0. because U and W are the incremental axes.
Other codes in the non-modal group
These also act only on their own line.
Meanings follow the common Fanuc-style standard that Haas, Okuma (EIA mode), Mitsubishi, LinuxCNC and most other controls share for this code. Options and parameters change details from machine to machine, so check the manual for your control.
Quick check: G28
-
What does
G28do? (Mill and lathe) -
Which code: Sends the named axes home, by way of an intermediate point.(Mill and lathe)
-
What does
G30do? (Mill and lathe)
Show the answers
- Sends the named axes home, by way of an intermediate point.
- G28
- Like G28, but to a second stored position, often the tool-change point.
Frequently asked questions
- What does G28 mean in CNC programming?
- Return to reference position. Sends the named axes home, by way of an intermediate point.
- Is G28 modal?
- No. G28 acts only on the line where it is written; the next line goes back to whatever modal codes were already active.
- What is the difference between G28 and G30?
- G28 (return to reference position): sends the named axes home, by way of an intermediate point. G30 (return to second reference position): like G28, but to a second stored position, often the tool-change point. A way to remember it: always read G28 with the G90/G91 that is active on the same line.
- What is the difference between G28 and G53?
- G28 (return to reference position): sends the named axes home, by way of an intermediate point. G53 (machine coordinate move): moves to a position in machine coordinates for this one line. A way to remember it: always read G28 with the G90/G91 that is active on the same line.
G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.