G28 sends the machine axes back to their home (reference) position, usually by way of an intermediate point you specify. It is the standard safe move before a tool change or at the end of a job.
Format
G91 G28 Z0 (home Z only, incremental)
How it works
- The axes first move to the intermediate point, then continue to machine home.
- Pairing with G91 (incremental) and Z0 homes the Z axis straight up with no sideways move.
- Always retract Z to a safe height before homing X and Y.
Example
G28 X0 Y0 (home X and Y)
G90 (back to absolute)
FAQ
What’s the difference between G28 and just commanding a move to machine zero? G28 typically routes through an intermediate point before returning to the reference position, helping avoid clamps, fixtures, or the part on the way home, whereas a direct move to machine zero could crash into an obstruction along a straight path.
Related: work offsets and the G-Code Cheat Sheet.
How G28 moves
G28 sends the axes home by way of an intermediate point you give, which is where the machine travels first before continuing to the reference position. The common form is G91 G28 Z0, which uses incremental mode so the intermediate point is where the axis already is, sending Z straight up to home.
Safety
Be careful using G28 in absolute mode, since the intermediate point is then measured in the work coordinate system and the axes may travel across the part on the way. Move Z home first, then X and Y, to avoid collisions. Cancel cutter compensation before G28, and check how your control handles tool length offsets so that the move behaves as expected.
