GHaas G-Code Field Guide Get the book

Haas Mill · G-code

G28 Return to Machine Zero

Sends axes to machine home. Most commonly used as G91 G28 Z0. to retract Z before a tool change or at program end.

Updated · by Ethan Reynolds

What G28 does on a Haas mill

G28 moves the named axes back to their machine zero (home) position. On a Haas, a G28 with no axis words sends every axis home.

If you name an axis, the control first moves to the value you give as an intermediate point, then goes home. In G91 that intermediate value is a distance, so G91 G28 Z0. means "move zero inches, then go home" — a straight retract. That is why you see G91 G28 Z0. in so many programs.

G28 format

AddressMeaning
X Y ZIntermediate point, then home
(no axes)All axes return home

G28 example program

G00 Z1.
G91 G28 Z0.  (retract Z straight to home)
G28 Y0.       (still G91: Y home)
G90

⚠ Watch out

G90 G28 Z0. first moves to Z0 of your work offset — the top of the part — before going home. That is a crash waiting to happen. Use G91 G28 Z0. or G53 Z0.

Related codes

G28 questions

Why use G91 G28 Z0 instead of G28 Z0?

In G90, Z0 is treated as an intermediate point in your work coordinates, so the tool can plunge to part zero first. In G91, Z0 means zero distance, so the tool retracts straight up.

Is G53 Z0 safer than G28?

Many programmers prefer G53 Z0 because it is a direct, non-modal move in machine coordinates with no intermediate point.

Independent reference. Not affiliated with, sponsored by or endorsed by Haas Automation, Inc. Haas is a trademark of its respective owner. Always confirm codes against your machine's operator manual — options and settings vary by model and software version.