3D printer G-code · Marlin and Klipper
G1: Linear move (G0 / G1) (Marlin & Klipper)
Linear move (G0 / G1) — Moves in a straight line to the given position. With E the extruder pushes filament at the same time, so this is the command that prints. G0 is the same move without…
On this page
| Property | Value |
|---|---|
| Command | G1 |
| Function | Linear move (G0 / G1) |
| Firmware | Marlin and Klipper |
| Group | Motion |
| Syntax | G1 [X] [Y] [Z] [E] [F] |
What does G1 do?
Moves in a straight line to the given position. With E the extruder pushes filament at the same time, so this is the command that prints. G0 is the same move without the intent to extrude; Marlin and Klipper treat G0 and G1 the same way. F is the feed rate in mm/min and stays active for the next moves.
Parameters
| Parameter | Meaning |
|---|---|
X Y Z | Target position in mm (absolute with G90, relative with G91) |
E | Filament position or length (absolute with M82, relative with M83) |
F | Feed rate in mm/min, modal. F3000 = 50 mm/s |
Example
G1 Z0.2 F1200 ; first layer height
G1 X60 Y20 E9.0 F1500 ; prime line
G0 X100 Y100 F9000 ; travelTips from practice
- F is in mm per minute, not per second: 60 mm/s is F3600.
- The real speed is limited by acceleration and the max feed rate (M203, max_velocity).
- Slicers write G1 for everything; your file is mostly G1 lines.
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.
Related commands
- G90 — Absolute positioning (G90 / G91)
- M82 — Absolute extrusion (M82 / M83)
- G92 — Set position (G92 E0)
More motion commands
| Command | Function | Firmware |
|---|---|---|
G2 | Arc move clockwise (G2 / G3) | Marlin and Klipper |
G4 | Dwell (pause) | Marlin and Klipper |
G28 | Home axes | Marlin and Klipper |
G90 | Absolute positioning (G90 / G91) | Marlin and Klipper |
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