Bed mesh leveling vs tramming: Klipper bed_mesh, Marlin G29 and Prusa's mesh

Published October 15, 202614 sources

Short answer

A bed mesh probes a grid of points, interpolates between them, and moves Z during printing to follow the surface [11, 1]. It only approximates the bed's shape and cannot correct a skewed axis or an inaccurate probe [1]. Tram the bed mechanically first, for example with Klipper's SCREWS_TILT_CALCULATE or Marlin's G35 assistant, and calibrate the probe offset before meshing [4, 10, 1].

Mesh compensation and tramming are different jobs

Tramming physically adjusts the bed screws so the bed sits true to the machine frame. Marlin’s G35 tramming assistant exists for exactly this, and takes the screw thread type, for example G35 S40 for M4 clockwise screws [10]. Mesh leveling leaves the bed where it is, measures its shape, and moves Z during printing to follow it [11].

Klipper’s bed mesh guide is direct about the limits of the second approach: software correction only approximates the bed’s shape, and it cannot compensate for mechanical or electrical problems such as a skewed axis or an inaccurate probe [1]. Marlin’s UBL guide likewise says results improve the more physically level and straight the bed is, and asks for physical leveling before the first probe run, especially on printers without a display [8].

Tools for the tramming step:

  • Klipper BED_SCREWS_ADJUST moves the nozzle over each screw for a paper test, cycling until no screw needs more than a small adjustment [4].
  • Klipper SCREWS_TILT_CALCULATE probes each screw position after G28 and reports turns as clock-face time relative to the first screw: “CW 01:15” means one and a quarter turns clockwise. Repeat until every adjustment is under about 6 minutes [4].
  • Bambu Lab X1/P1 beds are trammed at the factory. If shipping disturbs them, Bambu Lab provides a G-code file that parks the nozzle over each knob for 30 seconds, then repeats twice with 15-second pauses for fine adjustment; tightening a knob moves the bed away from the nozzle [14].

Adjusting bed tilt invalidates the Z offset of a probe mounted beside the nozzle, so recalibrate the probe after tramming [4, 5]. The first-layer Z offset guide covers that step.

Klipper bed_mesh

Calibrate the probe’s Z offset before meshing [1]. A minimal rectangular configuration needs mesh_min and mesh_max, both given in probe coordinates. Other options and their defaults [2, 1]:

Option Default Notes
probe_count 3, 3 At least 3 per axis; 5, 3 probes 15 points
speed 50 mm/s Travel between points
horizontal_move_z 5 mm Height before each probe
mesh_pps 2, 2 Interpolated points per segment; 0 disables
algorithm lagrange Lagrange caps at 6 probed points; bicubic needs at least 4
fade_start / fade_end 1.0 / 0.0 Fade is off until fade_end exceeds fade_start

Klipper’s worked example probes 5 × 3 points and interpolates with mesh_pps: 2, 3 into a 13 × 9 mesh [1]. If fade is enabled, Klipper suggests ending it around 10 mm and warns that on a badly warped bed it can stretch or shrink the print in Z [1].

Run BED_MESH_CALIBRATE after homing; the mesh is active immediately. With ADAPTIVE=1, only the area under the objects in the current G-code is probed, and that profile should not be saved for reuse [3]. Regular meshes go to the default profile and can be saved under a name with BED_MESH_PROFILE SAVE=<name> and SAVE_CONFIG. Klipper no longer loads a profile at startup, so add BED_MESH_PROFILE LOAD=default to the start macro if you rely on a stored mesh [1].

Marlin: bilinear and UBL

Marlin supports one leveling type per build [6]:

Option What it does
AUTO_BED_LEVELING_3POINT Probes a triangle and tilts a flat plane
AUTO_BED_LEVELING_LINEAR Probes a grid and fits a tilted flat plane
AUTO_BED_LEVELING_BILINEAR Probes a grid and interpolates a mesh; suited to uneven beds
AUTO_BED_LEVELING_UBL Recommended superset with mesh editing and storage slots; needs an LCD
MESH_BED_LEVELING Manual paper-test grid, no probe

G28 disables leveling by default, so follow it with M420 S1 to re-enable a stored mesh, or build with RESTORE_LEVELING_AFTER_G28 [9, 6]. Bilinear leveling probes the whole grid with one G29 after homing and is saved with M500; without a probe, PROBE_MANUALLY walks through the points with a paper test [7].

UBL splits the job into phases. Marlin’s sample sequence is G29 P1 to probe automatically, G29 P3 to fill points the probe cannot reach, G29 S0 to store the mesh in slot 0, G29 F10 for a 10 mm fade, G29 A to activate, and M500 to save. G26 prints a validation pattern and G29 P4 edits bad areas. In slicer start G-code, G29 L0 followed by G29 J reloads the stored mesh and tilts it to match a quick three-point probe [8]. UBL costs about 50 kB of program space against about 5 kB for bilinear, which matters on 128 kB boards [8]. Default grids are 3 × 3 for bilinear and 10 × 10 for UBL [6].

M420 Z10 sets a fade height so correction tapers to zero by 10 mm [9].

Prusa: mesh bed leveling and Bed Level Correction

Prusa printers probe a grid before each print and interpolate a virtual mesh [11]. On the MK3 family, Settings → Mesh bed leveling offers:

  • Mesh: 3 × 3 by default, 7 × 7 for more detail.
  • Z-probe nr.: 1, 3 or 5 readings per point; Prusa suggests 3 or 5, since the result is averaged.
  • Magnet comp.: three of the 49 points on a 7 × 7 mesh sit near magnets and can read up to 80 µm off; this option replaces them with values from neighboring points.

The MINI uses a 4 × 4 grid, and LoadCell models (MK4/S, MK3.9/S, XL) probe within the print area [11]. If one side still prints thinner, Bed Level Correction offsets the left, right, front and rear by up to ±100 µm, in steps Prusa suggests keeping to about 10 µm [12].

Adaptive meshes and probe quality

OrcaSlicer can generate the adaptive mesh commands itself from the objects on the plate, with a default probe spacing of 50 mm. For Marlin it emits G29 with left, right, front and back limits; for Klipper it calls BED_MESH_CALIBRATE with ADAPTIVE=0 ADAPTIVE_MARGIN=0 because OrcaSlicer has already applied its own margin [13].

A mesh is only as good as its probe. Klipper treats a PROBE_ACCURACY range above 25 µm as unsuitable for typical bed leveling, recommends probing at a consistent temperature, and requires a new mesh after any probe recalibration [5]. If the first layer still varies after meshing, see bed adhesion. Ridges that appear higher up the print are a separate problem covered under Z banding.

Questions

Do I still need to level the bed screws if my printer has a mesh?

Marlin's UBL documentation says the more physically level and straight the bed, the better the results, and Klipper notes that bed mesh only approximates the surface [8, 1]. Tramming first keeps the corrections small.

Does Klipper load my saved mesh automatically?

No. Klipper stopped loading the default profile at startup; add BED_MESH_PROFILE LOAD=default to the start macro or slicer start G-code if you want it [1].

Sources

  1. Bed Mesh. Klipper documentation. Firmware documentation. Limits of mesh, configuration examples, interpolation, fade, profiles, adaptive meshes. Accessed October 12, 2026.
  2. Configuration reference. Klipper documentation. Firmware documentation. [bed_mesh] defaults. Accessed October 12, 2026.
  3. G-Codes. Klipper documentation. Firmware documentation. BED_MESH_CALIBRATE with ADAPTIVE=1. Accessed October 12, 2026.
  4. Manual leveling. Klipper documentation. Firmware documentation. BED_SCREWS_ADJUST and SCREWS_TILT_CALCULATE. Accessed October 12, 2026.
  5. Probe calibration. Klipper documentation. Firmware documentation. PROBE_ACCURACY limits; re-mesh after probe recalibration; temperature bias. Accessed October 12, 2026.
  6. Configuring Marlin (Configuration.h). Marlin Firmware documentation. Firmware documentation. Leveling types, G28 behavior, fade height, grid sizes. Accessed October 12, 2026.
  7. G29 - Bed Leveling (Bilinear). Marlin Firmware documentation. Firmware documentation. Bilinear probing, manual probing option, saving. Accessed October 12, 2026.
  8. Unified Bed Leveling. Marlin Firmware documentation. Firmware documentation. UBL phases, sample command sequence, program size, physical leveling first. Accessed October 12, 2026.
  9. M420 - Bed Leveling State. Marlin Firmware documentation. Firmware documentation. Enable leveling after G28; fade height. Accessed October 12, 2026.
  10. G35 - Tramming Assistant. Marlin Firmware documentation. Firmware documentation. Interactive bed tramming with screw thread types. Accessed October 12, 2026.
  11. Mesh bed leveling. Prusa Knowledge Base. Manufacturer documentation. How Prusa meshes work; MK3 grid and sample options; magnet compensation. Accessed October 12, 2026.
  12. Bed Level Correction. Prusa Knowledge Base. Manufacturer documentation. Per-side ±100 µm correction. Accessed October 12, 2026.
  13. Adaptive Bed Mesh. OrcaSlicer Wiki. Slicer documentation. Slicer-driven adaptive mesh commands for Marlin, Klipper and RRF. Accessed October 12, 2026.
  14. Manual Bed Leveling / Manual Bed Tramming. Bambu Lab Wiki. Manufacturer documentation. X1/P1 factory tramming and manual tramming procedure. Accessed October 12, 2026.