3D printer G-code · Marlin

G29: Bed levelling (probe the mesh) (Marlin)

Bed levelling (probe the mesh) — Probes the bed in a grid and builds a mesh that the firmware uses to follow the bed while printing. Marlin has several types: bilinear (most common), linear, 3-point…

By cnccode · Updated
On this page
  1. What does G29 do?
  2. Parameters
  3. Example
  4. Tips from practice
  5. Related commands
  6. More bed levelling commands
  7. Frequently asked questions
PropertyValue
CommandG29
FunctionBed levelling (probe the mesh)
FirmwareMarlin
GroupBed levelling
SyntaxG29 [options depend on the levelling type]

What does G29 do?

Probes the bed in a grid and builds a mesh that the firmware uses to follow the bed while printing. Marlin has several types: bilinear (most common), linear, 3-point, UBL (unified bed levelling) and manual mesh. The options of G29 differ between them.

Parameters

ParameterMeaning
(bilinear)No options needed; G29 probes the full grid
UBL P1 / P3Probe the mesh / fill missing points
UBL TPrint the mesh as a table

Example

G-code
G28
G29        ; probe the bed
M420 S1 Z10 ; enable mesh, fade out by 10 mm
M500       ; save mesh

Tips from practice

  • Run it with the bed at print temperature.
  • Saving the mesh with M500 and loading it with M420 S1 saves minutes per print; probe again when you change the plate.
  • Paste the output into the bed mesh visualizer to see it in 3D.

Marlin. Many Marlin commands only exist when the feature is enabled in the firmware build. If the printer answers "Unknown command", the feature is missing. Klipper does not understand most of these settings codes; it uses printer.cfg instead.

More bed levelling commands

CommandFunctionFirmware
M420Bed levelling stateMarlin
M851Probe offset (Z offset)Marlin
M48Probe repeatability testMarlin
G34Z stepper auto-alignMarlin
G26Mesh validation patternMarlin
BED_MESH_CALIBRATEProbe the bed mesh (Klipper)Klipper
BED_MESH_PROFILESave and load mesh profilesKlipper
Z_TILT_ADJUSTLevel the gantry (two or three Z motors)Klipper
QUAD_GANTRY_LEVELQuad gantry levelKlipper
PROBE_CALIBRATEFind the probe Z offsetKlipper
SET_GCODE_OFFSETLive Z (babystep)Klipper
SCREWS_TILT_CALCULATEBed screw turnsKlipper

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

Frequently asked questions

What does G29 do on a 3D printer?
G29 is bed levelling (probe the mesh). Probes the bed in a grid and builds a mesh that the firmware uses to follow the bed while printing. Marlin has several types: bilinear (most common), linear, 3-point, UBL (unified bed levelling) and manual mesh. The options of G29 differ…
Does G29 work in Klipper and Marlin?
G29 is a Marlin command. Klipper uses its own commands and printer.cfg settings for this task.
Was this page helpful?