G28 - Auto Home

calibration Auto home one or more axes.


When you first start up your machine it has no idea where the toolhead is positioned, so Marlin needs to use a procedure called “homing” to establish a known position. To do this it moves each axis towards one end of its track until it triggers a switch, commonly called an “endstop.” Marlin knows where the endstops are, so once all the endstops have been triggered the position is known.

The G28 command is used to home one or more axes. The default behavior with no parameters is to home all axes.

In order to improve positional accuracy, the homing procedure can re-bump at a slower speed according to the [XYZ]_HOME_BUMP_MM and HOMING_BUMP_DIVISOR settings.

The position is easy to lose when the steppers are turned off, so homing may be required or advised after the machine has been sitting idle for a period of time. See the Configuration files for all homing options.


  • Homing is required before G29, M48, and some other procedures.
  • If homing is needed the LCD will blink the X Y Z indicators.
  • By default G28 disables bed leveling. Follow with M420 S to turn leveling on.
    • With ENABLE_LEVELING_AFTER_G28 leveling will always be enabled after G28.
    • With RESTORE_LEVELING_AFTER_G28 leveling is restored to whatever state it was in before G28.


G28 [L] [O] [R] [X] [Y] [Z]



Flag to restore bed leveling state after homing. (default true)


Flag to skip homing if the position is already trusted


The distance to raise the nozzle before homing


Flag to home the X axis


Flag to home the Y axis


Flag to home the Z axis


The most-used form of this command is to home all axes:

G28 ; Home all axes
G28 X Z ; Home the X and Z axes
G28 O ; Home all "untrusted" axes