G28: Homing and Returning to Machine Zero
G28 is an important G-code command of CNC machines, called “return to reference point” or “return to home”. When G28 is given in the program, the machine axes (X, Y, Z) automatically return to the machine’s home, that is, the first reference point.
This command is typically used at the beginning of a program, before a tool change, or at the end of a program to keep the tool and workpiece at a safe distance. This allows the machine to be in a safe position during the tool change and reduces the risk of collision during the next operation.
What is G28 in CNC?
G28 stands for Return to Reference Point (Machine Home). This command causes the tool to first move the machine axes (X, Y, Z) to an intermediate point and then move directly to the machine’s original Home Position (Machine Zero).

Basic format of G28
G91 G28 Z0
G91 G28 X0 Y0
G91 is incremental mode.
G28 is return to reference point.
X0 Y0 Z0 is the intermediate point. In incremental mode this means “no further movement from the current position”, i.e. the axes go straight to home.
Use of G28 in CNC Milling and CNC Lathe
CNC Milling (VMC / HMC)
G91 is mostly used in CNC milling so that the tool moves directly to the home position from there.
G91 G28 Z0. ; First move the Z-Axis safely to the home position.
G91 G28 X0. Y0. ; Then move the X and Y-Axis to the home position.
G90 ; Switch back to Absolute Mode (very important!).
CNC Lathe (Turning Center)
U (Incremental of X) and W (Incremental of Z) are used in CNC lathes:
G28 U0. W0. ; Sends both X and Z Axes to Home Position.
Precautions When Using G28
- When milling, the Z-Axis should be raised and homed first, then home X and Y so that the tool does not hit any fixtures.
- G90 must be entered in the next block immediately after using G91, otherwise the entire program ahead may be corrupted.
- Use G28 just before the end of the program (Program End) or tool change (M06).
