3D printer G-code · Marlin and Klipper

G10: Firmware retract (G10 / G11) (Marlin & Klipper)

Firmware retract (G10 / G11) — G10 retracts and G11 unretracts with lengths and speeds stored in the firmware instead of the slicer. The advantage: you can change the retraction while printing…

By cnccode · Updated
On this page
  1. What does G10 do?
  2. Example
  3. Tips from practice
  4. Related commands
  5. More extrusion commands
  6. Frequently asked questions
PropertyValue
CommandG10
FunctionFirmware retract (G10 / G11)
FirmwareMarlin and Klipper
GroupExtrusion
SyntaxG10 then G11

What does G10 do?

G10 retracts and G11 unretracts with lengths and speeds stored in the firmware instead of the slicer. The advantage: you can change the retraction while printing (M207/M208 in Marlin, SET_RETRACTION in Klipper) without slicing again. Marlin needs FWRETRACT, Klipper a [firmware_retraction] section. The slicer must have firmware retraction turned on.

Example

G-code
G10        ; retract (length from M207 / SET_RETRACTION)
G0 X120 Y80 F9000
G11        ; unretract

Tips from practice

  • Useful for tuning retraction on a test print in real time.
  • In Marlin set the values with M207 S<length> F<speed> and save with M500.

The command works in Marlin and Klipper. Options can differ: Klipper accepts fewer parameters for some M-codes and ignores codes it does not know with an "Unknown command" error.

More extrusion commands

CommandFunctionFirmware
G92Set position (G92 E0)Marlin and Klipper
M82Absolute extrusion (M82 / M83)Marlin and Klipper
M221Flow percentageMarlin and Klipper
M900Linear advance factorMarlin
SET_PRESSURE_ADVANCEPressure advance (Klipper)Klipper
SET_RETRACTIONChange firmware retractionKlipper

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 G10 do on a 3D printer?
G10 is firmware retract (G10 / G11). G10 retracts and G11 unretracts with lengths and speeds stored in the firmware instead of the slicer. The advantage: you can change the retraction while printing (M207/M208 in Marlin, SET_RETRACTION in Klipper) without slicing again…
Does G10 work in Klipper and Marlin?
Yes, both firmwares understand G10.
Was this page helpful?