3D printer G-code · Marlin and Klipper
G28: Home axes (Marlin & Klipper)
Home axes — Moves the axes to their endstops (or the probe for Z) and sets the machine position. Without letters all axes are homed. Every print must start with G28, because the…
On this page
| Property | Value |
|---|---|
| Command | G28 |
| Function | Home axes |
| Firmware | Marlin and Klipper |
| Group | Motion |
| Syntax | G28 [X] [Y] [Z] |
What does G28 do?
Moves the axes to their endstops (or the probe for Z) and sets the machine position. Without letters all axes are homed. Every print must start with G28, because the printer does not know its position after power on.
Parameters
| Parameter | Meaning |
|---|---|
X Y Z | Home only these axes |
Example
G28 ; home all
G28 X Y ; home only X and Y (park the head)Tips from practice
- In Marlin G28 turns bed levelling off; turn it back on with M420 S1 or run G29 afterwards.
- With a probe as Z endstop the nozzle must be clean: a blob under the nozzle changes the first layer.
- Klipper refuses moves before homing with "Must home axis first".
The command works in Marlin and Klipper. Options can differ: Klipper accepts fewer parameters for some M-codes and ignores codes it does not know with an "Unknown command" error.
Related commands
- G29 — Bed levelling (probe the mesh)
- M420 — Bed levelling state
- BED_MESH_CALIBRATE — Probe the bed mesh (Klipper)
More motion commands
| Command | Function | Firmware |
|---|---|---|
G1 | Linear move (G0 / G1) | Marlin and Klipper |
G2 | Arc move clockwise (G2 / G3) | Marlin and Klipper |
G4 | Dwell (pause) | Marlin and Klipper |
G90 | Absolute positioning (G90 / G91) | Marlin and Klipper |
Test it before you print
Paste your start code or a whole file into the 3D printer simulator. It plans every move, shows the time and finds missing waits, cold extrusion and moves outside the bed.
Open the simulator