3D printer G-code · Marlin

M851: Probe offset (Z offset) (Marlin)

Probe offset (Z offset) — Sets the distance from the nozzle to the probe. The Z value is the famous "Z offset": more negative brings the nozzle closer to the bed. Live adjustment while printing…

By cnccode · Updated
On this page
  1. What does M851 do?
  2. Parameters
  3. Example
  4. Tips from practice
  5. Related commands
  6. More bed levelling commands
  7. Frequently asked questions
PropertyValue
CommandM851
FunctionProbe offset (Z offset)
FirmwareMarlin
GroupBed levelling
SyntaxM851 [X] [Y] [Z]

What does M851 do?

Sets the distance from the nozzle to the probe. The Z value is the famous "Z offset": more negative brings the nozzle closer to the bed. Live adjustment while printing is done with babystepping (M290) or on the display.

Parameters

ParameterMeaning
X YProbe position relative to the nozzle
ZTrigger height of the probe relative to the nozzle tip

Example

G-code
M851 Z-1.85
M500

Tips from practice

  • Change it in steps of 0.02–0.05 mm while the first layer prints.
  • In Klipper this is z_offset in [probe] or [bltouch], set with PROBE_CALIBRATE.

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
G29Bed levelling (probe the mesh)Marlin
M420Bed levelling stateMarlin
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 M851 do on a 3D printer?
M851 is probe offset (Z offset). Sets the distance from the nozzle to the probe. The Z value is the famous "Z offset": more negative brings the nozzle closer to the bed. Live adjustment while printing is done with babystepping (M290) or on the display.
Does M851 work in Klipper and Marlin?
M851 is a Marlin command. Klipper uses its own commands and printer.cfg settings for this task.
Was this page helpful?