Skew Correction for Prusa (or Marlin firmware) Printers
We calculate the final price from your selected file. You review and accept it before payment.
Saved on this device.
A Post-process G-code Python script to correct XY skew using Marlin-compatible shear transformations. Tested with Prusa
- Rating
- 4 / 5
- Likes
- 8
- Downloads
- 34
- Makes
- 1
- Views
- 363
- Reviews
- 2
Updated at source:
Model information
- Source
- Printables
- Category
- Prusa Parts & Upgrades
- License
- Creative Commons — Attribution — Noncommercial
What this is for
This project fixes XY skew in prints caused by small mechanical misalignment in Cartesian and CoreXY printers that don't support Marlin's M852 skew compensation (such as Prusa Printers). Even well-built calibrated printers can have a slight angle error between the X and Y axes, which shows up as holes that don’t line up, parts that don’t sit square, or assemblies that bind.
Instead of compensating mechanically, this tool corrects the skew directly in the G-code after slicing.
Note: If skew is large, check belt tension and frame squareness before relying on software correction.
Who this isn't for
If you are printing non-functional objects (desk accessories, toys) where accuracy and alignment on large parts is not needed then skew correction will not give any noticeable benefit.
What it does
This is a post-processing script for PrusaSlicer that applies a shear correction to X coordinates, using the same model as Marlin’s M852 skew compensation.
Corrects XY skew without changing layer height, extrusion, or print order
Linearizes arcs safely before correction (required for accuracy)
Supports deriving skew from:
a measured angle
a measured square
a measured rectangle
Keeps all moves inside the bed using automatic bounds checking
Works on existing G-code — no slicer profile hacks required
The result is dimensionally accurate parts even on printers with small frame or belt misalignment.
⚠ Binary G-code
PrusaSlicer can optionally generate binary G-code (.bgcode) for faster uploads on some printers.
This script does not modify binary G-code.
If binary G-code is detected, the script will abort with a clear error message.
To use this tool, make sure binary G-code is disabled and that PrusaSlicer is outputting normal ascii .gcode files.
How to measure skew
You don’t need special tools or test rigs. Skew can be measured accurately using a simple printed square or rectangle and a set of calipers.
1 Print a test square or rectangle
Use a single-layer or low-infill part to minimize warping
Make it as large as practical (100–200 mm per side works well)
Print flat on the bed, with edges aligned to X and Y
Label the corners as follows:
A -------- B
| |
| |
D -------- C
2 Measure with calipers
Take the following measurements (in millimeters):
For a square
AC — diagonal from A to C
BD — diagonal from B to D
AD — side length in the Y direction
For a rectangle
AC — diagonal from A to C
BD — diagonal from B to D
AD — Y-direction side length
AB — X-direction side length
Measure carefully and repeat if needed. The difference between the diagonals is usually small, so consistency matters.
How to install in PrusaSlicer
Download the Python script. Ensure Python 3.10 or later is installed
In PrusaSlicer, open:
Preferences → Other → Use binary g-code when the printer support it (uncheck this box)
Configuration → Preferences → Output options
Under Post-processing scripts, add one of the following:
python path/to/skew_fix_ps.py --skew-deg ANGLE
python path/to/skew_fix_ps.py --skew-from-square AC,BD,AD
python path/to/skew_fix_ps.py --skew-from-rectangle AC,BD,AD,ABFor example:
python3 /Users/xxxxx/skew_fix_ps.py --skew-deg -0.15 --shear-y-ref-mode auto --recenter-to-bed --recenter-mode clampSlice as normal — the correction is applied automatically when G-code is exported.
Printer firmware compatibility
This tool uses the same shear-based correction model as Marlin (M852), but it operates purely on G-code.
In practice, it works with any Marlin-compatible firmware, including printers that:
don’t expose
M852don’t allow persistent skew settings
or run firmware variants derived from Marlin
Because the correction is made to post-sliced G-code, no firmware changes are needed.