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.

By cnccode · Updated
PropertyValue
CodeG28
FunctionReturn to Reference Point (Machine Home)
Modal group00
TypeOne-shot (non-modal) — active only in its own block
Used onMills and lathes
SyntaxG91 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

Format
G91 G28 Z0  /  G28 U0 W0 (lathe)
AddressMeaning
X Y Z (U W)Intermediate point the axes move through before going home

G28 example program

Example
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.

Frequently asked questions

Is G28 modal?
No. G28 is a one-shot (group 00) code and only acts in the block where it appears.
What does G28 mean in CNC?
G28 means 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.
What is the difference between G28 and G53?
G28 is Return to Reference Point (Machine Home), while G53 is Machine Coordinate System (One Block). See the G53 page for its syntax and examples.
Can I use G28 on a lathe?
Yes, G28 is used on both mills and lathes, although some parameters differ between them.