G-code reference
G28 G-Code: Return to Reference Point (Machine Home)
Return to Reference Point (Machine Home) — Sends the named axes to machine home through an intermediate point. The intermediate point is a source of crashes in G90, so the safe form is G91 G28 Z0.
| Property | Value |
|---|---|
| Code | G28 |
| Function | Return to Reference Point (Machine Home) |
| Modal group | 00 |
| Type | One-shot (non-modal) — active only in its own block |
| Used on | Mills and lathes |
| Syntax | G91 G28 Z0 / G28 U0 W0 (lathe) |
What does G28 do?
Sends the named axes to machine home through an intermediate point. The intermediate point is a source of crashes in G90, so the safe form is G91 G28 Z0.
G28 is a one-shot code: it only acts in the block where it is written, and the previously active modal codes take over again afterwards.
Syntax and parameters
G91 G28 Z0 / G28 U0 W0 (lathe)| Address | Meaning |
|---|---|
X Y Z (U W) | Intermediate point the axes move through before going home |
G28 example program
G91 G28 Z0 (Z home first)
G28 X0 Y0
G90▶ Open this example in the G-code viewer
Tips and common mistakes
- In G90, "G28 Z0" first moves to work Z0 — straight into the part!
- Use G53 Z0 as a modern, safer alternative on many controls.
- Remember to return to G90 afterwards.
Controller compatibility
G28 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.
Related codes
- G53 — Machine Coordinate System (One Block)
- G30 — Return to 2nd/3rd/4th Reference Point
- G91 — Incremental Programming