G28 – Return To Machine Home

CAUTION: This command can be used in different combinations and wrong command can result in unexpected rapid motion. Depending if the machine is in Absolute or Incremental mode the behavior of G28 command will be very different, extra caution should be used when using this command.


This command is used to move the axis back to the home position of the axis after the machine was homed. Further axis commands can also be combined with G28 to achieve intermediate position.


Syntax & Parameters


  • G28 - Only G28 can be used, this will move all axis at rapid back to the home position.
  • X, Y, Z, A, B Value - specifies the intermediate position you wish to move following the distance to move. The distance value will be the current machine units in use.
  • Combining the G28 with a rotary axis in incremental mode G91 will allow the axis to unwind in 1 revolution or less. See example below.


N10 G28


The above gcode will move all axis of the machine at rapid back to the home position.



Example program all axis to machine 0.00

N10 G28 X0 Y0 Z0


The above gcode will move all axis to working coordinates X0 Y0 Z0 before moving to home position.

Example program all axis to machine 0.00

N10 G91 G28 X0 Y0 Z0
N20 G90


The above gcode will move all axis to home position as there is no intermediate position to go to first.



Example program to move Z axis first

N10 G91 G28 X0 Y0 Z8
N20 G90


The above gcode will first move the Z axis 8.00 units and then move all axis to their home positions



Rotary Axis Unwind within one rotation


G00 A900 (Rapids the A axis to A900 (2.5 turns))
G91 (Change to Incremental mode)
G28 A0 (Moves Axis by 0 degrees then moves to A0 within one rotation)
G90 (Return to Absolute mode)


  • In the above example if you specify another coordinate eg: G28 A360 it will move an additional 360 degrees taking the axis to A1260 (3.5 turns) then move to A0 in less than 1 rotation.
  • In this case it would be an additional 1/2 rotation to be back to home.


INFORMATION: If you do not change to incremental mode before the G28 A0 the axis will unwind the full 2.5 revolutions to A0 and then move to the home position. In this case no further move is needed.