3dSynth

Docs / Custom G-code

Open in the interactive docs reader

G-code command reference

This is a comprehensive reference for every G-code and M-code command recognized by the 3dSynth Custom G-code Editor. Commands are organized by function. Each entry includes a description, parameters, firmware compatibility, and a usage example.


Motion commands

These commands control nozzle movement — the core of every G-code file.

G0 — Rapid positioning

Move the nozzle at maximum speed without extrusion. Used for travel moves between extrusion regions.

ParameterTypeDescription
XmmTarget X position
YmmTarget Y position
ZmmTarget Z position
Fmm/minFeedrate (optional — some firmwares use max speed regardless)
G0 X100 Y50 Z5 F6000  ; rapid travel to (100, 50, 5) at 6000 mm/min

Firmware notes: In Marlin, G0 and G1 behave identically — the feedrate is always respected. In some firmwares, G0 ignores F and uses the maximum configured travel speed.

G1 — Linear interpolation

Move the nozzle in a straight line with controlled speed. This is the most common command in any G-code file — every extrusion move uses G1.

ParameterTypeDescription
XmmTarget X position
YmmTarget Y position
ZmmTarget Z position
EmmExtrusion amount (absolute or relative, depending on M82/M83 mode)
Fmm/minFeedrate
G1 X120.500 Y80.200 E1.5432 F1200  ; extrusion move at 20 mm/s
G1 Z0.300                           ; Z-only move (layer change)
G1 E-1.0 F2400                      ; retraction (negative E)

G2 — Clockwise arc interpolation

Move in a clockwise arc from the current position to the target position. Used for curves and circles.

ParameterTypeDescription
XmmTarget X position
YmmTarget Y position
ZmmTarget Z position (for helical arcs)
ImmArc center offset in X (relative to start)
JmmArc center offset in Y (relative to start)
EmmExtrusion amount along the arc
Fmm/minFeedrate
G2 X10 Y15 I5 J0 E0.5 F1200  ; clockwise arc with extrusion

Firmware notes: Arc support must be enabled in firmware (ARC_SUPPORT in Marlin). Klipper supports arcs natively. Some firmwares linearize arcs into small segments internally.

G3 — Counter-clockwise arc interpolation

Same as G2 but in the counter-clockwise direction.

ParameterTypeDescription
X, Y, Z, I, J, E, FSame as G2
G3 X10 Y15 I5 J0 E0.5 F1200  ; counter-clockwise arc

G4 — Dwell (pause)

Pause execution for a specified duration. The nozzle stays in place.

ParameterTypeDescription
PmsPause duration in milliseconds
SsPause duration in seconds
G4 P500   ; pause for 500 ms (half a second)
G4 S2     ; pause for 2 seconds

Use cases: Allow a layer to cool before the next pass, wait for a temperature to stabilize, or synchronize with external equipment.


Coordinate system

Commands that configure how coordinates are interpreted.

G20 — Set units to inches

Switch to imperial units. All subsequent coordinates are in inches.

G20  ; all coordinates now in inches
G1 X1 Y1 F60  ; move to (1 inch, 1 inch)

G21 — Set units to millimeters

Switch to metric units. This is the default for virtually all 3D printing G-code.

G21  ; all coordinates now in millimeters (default)

G28 — Home

Move one or more axes to the home position (endstop). This establishes the machine's coordinate origin.

ParameterTypeDescription
XflagHome X axis
YflagHome Y axis
ZflagHome Z axis
G28       ; home all axes
G28 X Y   ; home only X and Y
G28 Z     ; home only Z

When to use: Always at the start of a print. Without homing, the printer doesn't know its position and may crash into limits.

G29 — Automatic bed leveling

Run the printer's automatic bed leveling probe sequence. The specific behavior depends on the leveling type configured in firmware.

G28     ; home first (required before G29)
G29     ; run auto bed leveling

Firmware notes: Marlin supports multiple leveling types (3-point, bilinear, UBL). Klipper uses BED_MESH_CALIBRATE as a macro equivalent. RepRapFirmware uses G29 with additional parameters.

G80 — Mesh bed leveling (Prusa)

Prusa-specific mesh bed leveling command. Functionally similar to G29 but with Prusa-specific behavior.

G28     ; home first
G80     ; run Prusa mesh bed leveling

G90 — Absolute positioning

Set the motion mode to absolute. All X, Y, Z coordinates are relative to the machine origin.

G90                    ; absolute mode
G1 X100 Y50 F3000     ; move to (100, 50) — absolute position
G1 X110 Y50           ; move to (110, 50) — not (210, 100)

G91 — Relative positioning

Set the motion mode to relative (incremental). All X, Y, Z coordinates are offsets from the current position.

G91                    ; relative mode
G1 X10 Y0 F3000       ; move 10mm to the right
G1 X10 Y0             ; move another 10mm to the right

G92 — Set position

Set the current position without moving. This redefines where the printer thinks it is.

ParameterTypeDescription
XmmNew X position
YmmNew Y position
ZmmNew Z position
EmmNew E position
G92 E0    ; reset extruder position to 0 (very common at print start)
G92 X0 Y0 ; redefine current position as origin

Most common use: G92 E0 resets the extruder position counter, typically done before starting a print or after switching extrusion modes.


Retraction

Firmware-level retraction and recovery commands.

G10 — Firmware retract

Retract filament using firmware-configured retraction settings (distance, speed, Z-lift). The specific retraction parameters are set in firmware, not in G-code.

G10  ; retract using firmware settings

G11 — Firmware unretract

Recover (unretract) filament after a firmware retraction. Reverses a previous G10.

G11  ; unretract (prime) using firmware settings

Temperature

Commands for controlling nozzle and bed heating.

M104 — Set hotend temperature (no wait)

Set the nozzle target temperature and continue immediately. Heating happens in the background.

ParameterTypeDescription
S°CTarget temperature
M104 S210  ; start heating nozzle to 210°C (don't wait)

M109 — Set hotend temperature (wait)

Set the nozzle target temperature and wait until it's reached before continuing.

ParameterTypeDescription
S°CTarget temperature (heat up only)
R°CTarget temperature (heat up or cool down)
M109 S210  ; heat nozzle to 210°C and wait
M109 R180  ; wait for nozzle to reach exactly 180°C (cools down if hotter)

M140 — Set bed temperature (no wait)

Set the bed target temperature and continue immediately.

ParameterTypeDescription
S°CTarget temperature
M140 S60  ; start heating bed to 60°C (don't wait)

M190 — Set bed temperature (wait)

Set the bed target temperature and wait until it's reached.

ParameterTypeDescription
S°CTarget temperature (heat up only)
R°CTarget temperature (heat up or cool down)
M190 S60  ; heat bed to 60°C and wait

Cooling

Fan control commands.

M106 — Set fan speed

Turn the part cooling fan on at a specified speed.

ParameterTypeDescription
S0-255Fan speed (0 = off, 255 = full speed)
M106 S255    ; fan at 100%
M106 S128    ; fan at ~50%
M106 S0      ; fan off (equivalent to M107)

M107 — Fan off

Turn the part cooling fan off completely.

M107  ; fan off

Extrusion mode

Commands that control how the E (extrusion) axis is interpreted.

M82 — Absolute extrusion

Set extrusion to absolute mode. The E value represents the total filament position since the last G92 E0.

M82           ; absolute extrusion mode
G92 E0        ; reset E to 0
G1 E1.0       ; extrude to position 1.0mm
G1 E2.5       ; extrude to position 2.5mm (1.5mm more filament)

M83 — Relative extrusion

Set extrusion to relative mode. The E value represents the amount of filament to extrude for this move.

M83           ; relative extrusion mode
G1 E1.0       ; extrude 1.0mm of filament
G1 E1.5       ; extrude 1.5mm more filament

Motion control

Commands that configure acceleration, jerk, and pressure compensation.

M204 — Set acceleration

Set default acceleration values for print and travel moves.

ParameterTypeDescription
Pmm/s2Print acceleration
Tmm/s2Travel acceleration
Smm/s2Both print and travel (legacy)
M204 P500 T1000  ; print at 500 mm/s2, travel at 1000 mm/s2
M204 S800        ; both at 800 mm/s2 (legacy format)

M205 — Set jerk

Set jerk limits (instantaneous speed change at direction changes).

ParameterTypeDescription
Xmm/sX axis jerk
Ymm/sY axis jerk
Emm/sE axis jerk
M205 X8 Y8 E5  ; set jerk limits

Firmware notes: Klipper uses SET_VELOCITY_LIMIT with SQUARE_CORNER_VELOCITY instead of M205. RepRapFirmware uses M566.

M900 — Linear Advance

Set the Linear Advance K factor for pressure compensation during extrusion. Higher K values compensate for more bowden tube or filament compressibility.

ParameterTypeDescription
KfactorLinear Advance K factor (0 = disabled)
M900 K0.05  ; set Linear Advance K factor to 0.05 (typical for direct drive)
M900 K0.4   ; higher K for bowden setups
M900 K0     ; disable Linear Advance

Firmware notes: Marlin only. Klipper uses SET_PRESSURE_ADVANCE with the ADVANCE parameter. Not available in RepRapFirmware.


Control flow

Commands that pause, stop, or change the print workflow.

M0 — Unconditional stop

Stop the print and wait for user interaction (button press on the LCD). The printer holds position and temperature.

M0  ; stop and wait for user to continue

M1 — Conditional stop

Optional stop — the printer pauses only if a physical stop switch is triggered. Most firmwares treat this identically to M0.

M1  ; conditional stop

M25 — Pause SD print

Pause the current SD card print. The printer holds position. Resume by pressing the resume button or sending M24.

M25  ; pause SD print

M600 — Filament change

Pause the print for a filament change. The printer retracts filament, moves the nozzle to a safe position, and waits for the user to load new filament.

M600  ; pause for filament change

Use cases: Color changes mid-print, switching to a different material, or recovering from a filament runout.


Reporting

Commands that query the printer's current state.

M105 — Report temperatures

Request current temperature readings. The printer responds with nozzle and bed temperatures.

M105  ; response: ok T:210.0 /210.0 B:60.0 /60.0

M114 — Report current position

Request the current nozzle position.

M114  ; response: X:100.00 Y:50.00 Z:10.20 E:1234.56

M115 — Report firmware info

Request firmware name, version, and capabilities.

M115  ; response: FIRMWARE_NAME:Marlin 2.1.2 ...

Stepper control

Commands for enabling and disabling stepper motors.

M17 — Enable steppers

Enable (energize) all stepper motors. Motors hold position when enabled.

M17  ; enable all steppers

M18 / M84 — Disable steppers

Disable (de-energize) stepper motors. Motors can be moved by hand when disabled.

M18       ; disable all steppers
M84       ; same as M18
M84 S30   ; disable steppers after 30 seconds of inactivity

Speed and flow overrides

Commands that apply runtime multipliers to feedrate and extrusion.

M220 — Set speed factor

Override the feedrate with a percentage multiplier. Affects all subsequent moves.

ParameterTypeDescription
S%Speed factor (100 = normal, 50 = half speed, 200 = double speed)
M220 S80   ; slow everything down to 80% of programmed speed
M220 S100  ; restore normal speed

M221 — Set flow factor

Override the extrusion rate with a percentage multiplier. Affects all subsequent extrusion moves.

ParameterTypeDescription
S%Flow factor (100 = normal, 110 = 10% more extrusion)
M221 S95   ; reduce flow to 95% (slightly less extrusion)
M221 S100  ; restore normal flow