What is G Code G28?

G28 command instructs the CNC machine to return rapidly to the Absolute Zero (Datum) point of the machine. The motion can be direct or via an intermediate coordinate.


Although it is not mandatory, it is always recommended to use G28 with Relative G91 mode.

The machines will move in 2 steps:

  • Move to the defined intermediate point.
  • Move simultaneously in all axis from the intermediate point to the reference point.
Gcdeo refernce point G28

Example #1: G91 G28 X0 Y0 Z0 – Move directly to the datum point along the red dashed line.  In this example and many real-life situations, this will cause a crash.

Example #2: G91 G28 Z200.0 – Move safely to the datum via an intermediate point along the blue lines.

Example #3: G28 – Move all the machine’s axis to zero position.

What is G CODE G30?

G30 functions the same as G28 but moves to an alternative reference point. This 2nd point is defined in the machine parameters list. It can be, for example, a position for the tool during a pallet change.

Learn about more G-Codes

Scroll to Top