---
tag: g028
title: Auto Home
brief: Auto home one or more axes.
author: thinkyhead
contrib: classicrocker883


codes: [ G28 ]

group: calibration
notes: |
  - Homing is required before [`G29`](/docs/gcode/G029.html), [`M48`](/docs/gcode/M048.html), 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`.

parameters:

- tag: H
  type: flag
  optional: true
  requires: Z_SAFE_HOMING
  description: Flag to hold the current X/Y position. Otherwise move to the defined safe X/Y position before homing Z. This can be used to avoid a model.

- tag: L
  optional: true
  description: Flag to restore bed leveling state after homing. (Default `true`)
  values:
  - type: bool

- tag: O
  since: 1.1.9
  type: flag
  optional: true
  description: Flag to skip homing if the position is already trusted

- tag: R
  since: 1.1.9
  optional: true
  description: The distance to raise the nozzle before homing
  values:
  - type: float
    tag: linear

- tag: X
  type: flag
  optional: true
  description: Flag to home the X axis

- tag: Y
  type: flag
  optional: true
  description: Flag to home the Y axis

- tag: Z
  type: flag
  optional: true
  description: Flag to home the Z axis

- tag: A
  type: flag
  optional: true
  since: 2.0.9
  requires: I_DRIVER_TYPE, AXIS4_NAME 'A'
  description: Flag to home the A axis

- tag: B
  type: flag
  optional: true
  since: 2.0.9
  requires: J_DRIVER_TYPE, AXIS5_NAME 'B'
  description: Flag to home the B axis

- tag: C
  type: flag
  optional: true
  since: 2.0.9
  requires: K_DRIVER_TYPE, AXIS6_NAME 'C'
  description: Flag to home the C axis

- tag: U
  type: flag
  optional: true
  since: 2.1
  requires: U_DRIVER_TYPE, AXIS7_NAME 'U'
  description: Flag to home the U axis

- tag: V
  type: flag
  optional: true
  since: 2.1
  requires: V_DRIVER_TYPE, AXIS8_NAME 'V'
  description: Flag to home the V axis

- tag: W
  type: flag
  optional: true
  since: 2.1
  requires: W_DRIVER_TYPE, AXIS9_NAME 'W'
  description: Flag to home the W axis

examples:
- pre: "The most-used form of this command is to home all axes:"
  code: G28 ; Home all axes
- code: G28 X Z ; Home the X and Z axes
- code: G28 O ; Home all "untrusted" 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.
