What M851 means

In Marlin, X and Y describe the probe's horizontal location relative to the nozzle, while Z describes the trigger height relationship. The correct sign follows Marlin's documented convention and must be measured on the actual machine. Changing the value does not rewrite an existing bed mesh, but it affects later probe use.

Klipper calibrates z_offset with PROBE_CALIBRATE and SAVE_CONFIG instead of built-in M851. RepRapFirmware implements M851 mainly for Marlin compatibility with a sign reversal relative to its preferred G31 Z form. Never transfer a number across firmware without rechecking the convention.

Syntax and parameters

M851 [X<offset>] [Y<offset>] [Z<offset>]
X / Y

Horizontal probe-to-nozzle offsets in millimeters on supported Marlin builds.

Z

Vertical probe trigger offset in millimeters; sign convention is firmware-specific.

No parameters

Firmware-specific report behavior; consult the target version before relying on it.

Practical examples

Set a Marlin Z offset

M851 Z-2.0

Records a probe trigger point 2.0 mm below the nozzle under Marlin's convention; the real value must be measured.

Set horizontal offsets

M851 X-1.70 Y-1.30

Places the probe 1.70 mm left and 1.30 mm in front of the nozzle under Marlin's coordinate convention.

Firmware context

SystemStatusWhat changes
MarlinCommonPrimary command for XYZ probe-to-nozzle offsets when a bed probe is configured; M500 can persist supported settings.
KlipperCheck dialectUses PROBE_CALIBRATE and the probe z_offset configuration; M851 is not a documented built-in calibration command.
RepRapFirmwareCheck dialectProvides M851 for compatibility, maps it to G31 with a reversed Z sign, and recommends G31 instead.
CNC controllersNot applicableNot applicable to general CNC probe offset configuration.

What this viewer can show

Not simulated

The viewer does not apply M851 to coordinates, meshes or the first layer. It cannot measure the physical nozzle-probe relationship or determine whether the saved value is safe.

Common mistakes

  • Sign conventions differ across firmware; a copied value can move the nozzle the wrong way.
  • Mechanical changes can invalidate a previously measured offset.
  • Changing an offset does not prove that homing, probing, mesh data or first-layer calibration is correct.

Primary sources

This page is an original explanation, reviewed against the firmware documentation below. Always confirm commands against the firmware and configuration on the machine that will execute them.