MeshMath

Steps per mm & rotation_distance calculator

Work out steps per mm for Marlin and rotation_distance for Klipper from your motor, microsteps, belt, screw or gearing, then correct it from a measured move.

Motion system

Steps per mm (Marlin)—
rotation_distance (Klipper)—
mm per motor revolution—
Microsteps per revolution—

Correct it from a measured move

New steps per mm—
New rotation_distance—
Error in the move—
Marlin: new = old × requested ÷ measured
Klipper: new = old × measured ÷ requested

What steps per mm means

A stepper motor turns in small fixed steps, and the controller divides each one into microsteps. Steps per mm tells the firmware how many microsteps move the axis by 1 mm. It depends only on the motor step angle, the microstepping, the gearing and how far the mechanism moves per revolution: belt pitch × pulley teeth for a belt axis, or the lead for a leadscrew.

Klipper expresses the same thing as rotation_distance, the distance moved per full motor revolution. This page gives both, and shows how to correct either after measuring a real move.

steps per mm = (360 ÷ step angle) × microsteps × gear ratio ÷ mm per revolution

Worked examples

Worked example

The classic X/Y axis: GT2 belt, 20-tooth pulley, 1.8° motor, 16 microsteps

Full steps per revolution360 ÷ 1.8 = 200
Microsteps per revolution200 × 16 = 3,200
Belt travel per revolution2 mm pitch × 20 teeth = 40 mm
Steps per mm3,200 ÷ 40 = 80
Klipper rotation_distance40 mm (same 40 mm, no gearing)

This is the familiar value of 80 steps/mm. Change to 32 microsteps and it becomes 160; change to a 16-tooth pulley and it becomes 100.

Worked example

A T8 leadscrew Z axis: 8 mm lead, 1.8° motor, 16 microsteps

Microsteps per revolution200 × 16 = 3,200
Travel per revolution8 mm (lead = thread pitch 2 mm × 4 starts)
Steps per mm3,200 ÷ 8 = 400

A 0.9° motor has twice the full steps per revolution, so the same screw gives 800 steps/mm at 16 microsteps.

Worked example

Calibrating after measuring: asked for 100 mm, got 97 mm

Current steps/mm (Marlin)80
Corrected steps/mm80 × 100 ÷ 97 = 82.474
Current rotation_distance (Klipper)40 mm
Corrected rotation_distance40 × 97 ÷ 100 = 38.8 mm

More steps per mm means less movement per step, so a short move needs a bigger steps value but a smaller rotation_distance. The two corrections always move in opposite directions.

Worked example

A geared extruder (hypothetical numbers)

Extruder gear travel per gear revolution24 mm (example figure, not a specific product)
Gear ratio3:1 reduction
Microsteps per motor revolution3,200
Steps per mm3,200 × 3 ÷ 24 = 400
Klipper rotation_distance24 ÷ 3 = 8 mm

Always use your extruder's documented values or measure them. The example only shows how the ratio enters the formula.

Marlin steps per mm vs Klipper rotation_distance

They describe the same thing from opposite sides. Marlin stores how many microsteps make 1 mm. Klipper stores how many mm one full motor revolution moves, and takes the step angle and microsteps from separate settings, so changing microsteps in Klipper does not change the physical distance. That is also why the Klipper value is the more portable of the two.

steps per mm = (360 ÷ step angle) × microsteps × gear ratio ÷ mm per revolution
rotation_distance = mm per revolution ÷ gear ratio
Axis typemm per motor revolutionComment
Belt axisbelt pitch × pulley teethGT2 belts have a 2 mm pitch. A 20T pulley is 40 mm, a 16T pulley is 32 mm.
Leadscrewlead (pitch × thread starts)A T8 screw with 4 starts and 2 mm pitch has an 8 mm lead. Read the lead, not just the pitch.
Geared extrudergear travel ÷ gear ratioEnter the ratio in the gear ratio box.

How to calibrate any axis

  1. Mark the axis or filament, move a commanded distance (for example 100 mm on a belt axis, or extrude 100 mm of filament with the hotend hot), and measure the real distance.
  2. Enter the commanded distance and what you measured in the calibration boxes above.
  3. For Marlin, send the new steps value with M92 (for example M92 X82.474) and save it with M500. For Klipper, edit rotation_distance in printer.cfg and restart.
  4. Repeat the move. It should now match within measurement error. If it keeps drifting, the problem is mechanical (slipping pulley, loose belt), not a number.
  5. For the extruder, finish with a flow-rate check, see how to calibrate e-steps and the e-steps calculator.

Common mistakes

Troubleshooting

SymptomLikely causeFix
Axis moves a fixed percent too far or shortWrong pulley teeth, lead or microsteps in the firmwareRecompute above and compare with the config
Error grows with distanceReal scale error, not backlashUse the calibration boxes with a long move (100 mm or more)
Error is randomLoose pulley or belt, skipped stepsTighten grub screws and check belt tension, see how to fix layer shifting
Prints are the wrong size but moves measure fineShrinkage or slicer scale, not stepsUse the shrinkage compensation calculator

FAQ

How do I calculate steps per mm for a belt axis?

Multiply the full steps per revolution (360 ÷ step angle, 200 for a 1.8° motor) by the microsteps, and divide by the belt pitch times the pulley teeth. A 1.8° motor at 16 microsteps on a 2 mm GT2 belt with a 20-tooth pulley gives 3,200 ÷ 40 = 80 steps/mm.

What is rotation_distance in Klipper?

It is the distance the axis moves in one full motor revolution, in mm. For a belt axis it is belt pitch × pulley teeth (40 mm for GT2 with 20 teeth). For a geared extruder it is the gear travel per revolution divided by the gear ratio.

How do I convert steps per mm to rotation_distance?

rotation_distance = full steps per revolution × microsteps ÷ steps per mm. For 80 steps/mm at 200 full steps and 16 microsteps that is 3,200 ÷ 80 = 40 mm.

Which direction does rotation_distance go when the axis moves too far?

If the axis moves too far, increase rotation_distance. The corrected value is old × measured ÷ requested, so measuring 97 mm for a 100 mm move changes 40 to 38.8 (a smaller value, because the axis moved too little).

What is the difference between pitch and lead on a leadscrew?

Pitch is the distance between neighbouring thread crests. Lead is how far the nut travels per turn: pitch times the number of starts. Use the lead. A T8 screw with 4 starts and 2 mm pitch has an 8 mm lead.

Do I need to recalibrate if I change microsteps?

In Marlin, yes: the steps/mm value scales with microsteps (80 at 16 becomes 160 at 32). In Klipper, no: rotation_distance does not change because microsteps are a separate setting.

Related tools

See all tools →