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…

By cnccode · Updated
On this page
  1. What does G1 do?
  2. Parameters
  3. Example
  4. Tips from practice
  5. Related commands
  6. More motion commands
  7. Frequently asked questions
PropertyValue
CommandG1
FunctionLinear move (G0 / G1)
FirmwareMarlin and Klipper
GroupMotion
SyntaxG1 [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

ParameterMeaning
X Y ZTarget position in mm (absolute with G90, relative with G91)
EFilament position or length (absolute with M82, relative with M83)
FFeed rate in mm/min, modal. F3000 = 50 mm/s

Example

G-code
G1 Z0.2 F1200        ; first layer height
G1 X60 Y20 E9.0 F1500 ; prime line
G0 X100 Y100 F9000    ; travel

Tips 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.

More motion commands

CommandFunctionFirmware
G2Arc move clockwise (G2 / G3)Marlin and Klipper
G4Dwell (pause)Marlin and Klipper
G28Home axesMarlin and Klipper
G90Absolute 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

Frequently asked questions

What does G1 do on a 3D printer?
G1 is 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 the intent to extrude; Marlin and Klipper treat G0 and G1 the same way…
Does G1 work in Klipper and Marlin?
Yes, both firmwares understand G1.
Was this page helpful?