G-code time estimator: print time from the file itself

Load a sliced .gcode file. The estimator times every move with your acceleration and square corner velocity, adds the dwells, and shows the result next to the slicer's own figure.

G-code file

The file is read in your browser and never uploaded. Plain-text .gcode only: binary .bgcode files are not read.

Motion limits

Most slicers write the acceleration into the file with M204. These values fill in wherever the file sets none, or replace the file's values if you choose.

mm/s²

Marlin's default is 3000

mm/s

Klipper's default is 5

mm/s

Blank: the file's F values decide

Klipper's default 0.5. Use 0 for Marlin.

Filament

Turns the file's total E into grams. Density is from the spool's data sheet.

mm
g/cm³

PLA 1.24. Use your spool's data sheet for others.

Estimated print time

–

Slicer's own estimate in the file

–

Distance ÷ speed, no acceleration

–

Filament

–

Moves timed

–

Layers

–

The formula

The estimator reads every move in the file and times it the way printer firmware moves the head: speed up at a fixed acceleration, cruise, then slow down for the next corner. For one move of length d with speed v from its F value and acceleration a:

accel distance  = (v² − v_start²) / (2 × a)
decel distance  = (v² − v_end²) / (2 × a)
cruise distance = d − accel distance − decel distance
move time       = accel distance / ((v_start + v) / 2)
                + cruise distance / v
                + decel distance / ((v_end + v) / 2)

A move too short to reach v peaks at √((2 × a × d + v_start² + v_end²) / 2) and never cruises.

The speed allowed through each corner comes from the square corner velocity (scv), the way Klipper does it:

junction deviation = scv² × (√2 − 1) / a
R                  = sin(θ/2) / (1 − sin(θ/2))     θ = angle between the moves
corner speed²      = R × junction deviation × a

At a 90° corner this gives exactly the square corner velocity. The planner then makes two passes over the whole file. The backward pass lowers each move’s top speed so it can still brake in time for the next corner. The forward pass sets each move’s start speed. Both passes are Klipper’s look-ahead code, ported line for line. That includes its minimum cruise ratio, which caps the top speed of short zigzag moves.

total time = Σ move times + G4 dwells
filament   = net E (mm) × π × (diameter / 2)² / 1000 × density (g/cm³)

Corner speeds at the defaults

For long moves, the corner speed depends only on the square corner velocity and the angle, because the acceleration cancels out. At Klipper’s default of 5 mm/s:

Direction change Corner speed
30° 17.1 mm/s
45° 11.2 mm/s
60° 8.2 mm/s
90° 5.0 mm/s
120° 3.2 mm/s
135° 2.5 mm/s
150° 1.9 mm/s
180° (straight back) 0

Very short moves can corner slower than this, because Klipper also keeps the approximated curve inside the first half of each move.

What the tool reads

G-code What it does here
G0, G1 Line move. F is in mm/min and stays until the next F.
G2, G3 Arc, from I and J (center offset) or R. Firmware splits arcs into 1 mm segments, so the arc’s speed is capped at the corner speed between two segments.
G90, G91, M82, M83, G92, G20, G21 Absolute or relative axes, relative E, position resets, inches or millimeters.
G4 Dwell, timed: S in seconds wins over P in milliseconds.
M204 P for moves that extrude, T for travel, R for retractions, S sets both P and T.
M201, M203 Per-axis acceleration and speed limits, applied to each move by its direction.
SET_VELOCITY_LIMIT Klipper’s ACCEL, VELOCITY, SQUARE_CORNER_VELOCITY and MINIMUM_CRUISE_RATIO.
M109, M190, M191 Heat waits: counted, not timed.
G28, G29, G80, BED_MESH_CALIBRATE Homing and bed probing: counted, not timed.

Moves that only move the extruder, such as retractions, start and end at zero speed. A junction where the extrusion rate changes is held to 1 mm/s of extruder speed change, Klipper’s default instantaneous corner velocity.

The file is read in your browser in chunks, so files of 50 to 100 MB work without uploading anything. Binary .bgcode files are not read. PrusaSlicer exports binary G-code by default since version 2.7.0 for printers that support it. To get plain text, untick “Support binary G-code” on the General page of the Printer settings tab. File > Convert also turns a .bgcode file into plain G-code.

Where the defaults come from

  • Acceleration, 3,000 mm/s²: Marlin’s DEFAULT_ACCELERATION. It applies only where the file sets no M204 or SET_VELOCITY_LIMIT, unless you pick “These values for every move”.
  • Square corner velocity, 5 mm/s: Klipper’s default square_corner_velocity.
  • Minimum cruise ratio, 0.5: Klipper’s default minimum_cruise_ratio. Marlin has no such setting, so enter 0 for a Marlin printer.
  • Density, 1.24 g/cm³: Bambu Lab’s PLA Basic data sheet. Filament length is the file’s net extruder (E) distance, so retractions cancel out.

How do you estimate print time from G-code?

Add up the time of every move. Each move’s time depends on its length, its F speed, the acceleration and how fast the head can take the corners at each end. Distance divided by speed alone runs short: on Prusa’s MK3S Benchy file it gives 1 h 40 min, while PrusaSlicer says 2 h 4 min 50 s.

Worked example: one long move and one short one

A 100 mm move at 200 mm/s (F12000), starting and ending at rest, with 3,000 mm/s² acceleration:

  1. Distance to reach 200 mm/s: 200² / (2 × 3,000) = 6.67 mm. Braking takes the same.
  2. Cruise: 100 − 6.67 − 6.67 = 86.67 mm, which takes 86.67 / 200 = 0.433 s.
  3. Speeding up and slowing down: 6.67 mm at an average of 100 mm/s, twice, is 0.133 s.
  4. Total: 0.567 s. Distance over speed says 0.5 s, so this move takes 13% longer.

Now a 10 mm move at the same settings. It cannot reach 200 mm/s: it peaks at √(3,000 × 10) = 173 mm/s halfway and brakes straight away. It takes 2 × 173 / 3,000 = 0.115 s, 2.3 times the 0.05 s that distance over speed gives. Real prints are full of short moves, so the naive figure falls far short.

Tested on Prusa’s own G-code

Prusa Research posts sliced Benchy files with the model on Printables. Both were sliced in PrusaSlicer, which writes its own estimate into the file.

File PrusaSlicer’s estimate This tool, defaults This tool, scv 8 and cruise ratio 0 Distance ÷ speed
MK3S, 0.15 mm 2 h 4 min 50 s 2 h 16 min 13 s (+9.1%) 2 h 8 min 18 s (+2.8%) 1 h 40 min 16 s (−19.7%)
MINI, 0.15 mm 1 h 56 min 40 s 2 h 7 min 37 s (+9.4%) 2 h 2 min 13 s (+4.8%) 1 h 35 min 22 s (−18.3%)

Both files set M205 X8.00 Y8.00, an X and Y jerk of 8 mm/s. Prusa’s firmware for both printers is built on Marlin, whose planner has no cruise ratio.

Marlin’s configuration describes jerk as the speed change that can happen instantly. At a 90° corner each axis changes by the full corner speed, so a jerk of 8 behaves like a square corner velocity of 8. With those two settings, the estimate lands within 5% of PrusaSlicer’s.

The tool also counts 4.02 m of filament (12.0 g of PLA) for the MK3S file, where PrusaSlicer reports 3.97 m. The tool counts every E move in the file, including the 21.5 mm purge line in the start G-code.

Match the settings to your printer

  • Klipper: copy square_corner_velocity and minimum_cruise_ratio from the [printer] section of printer.cfg. If the file sets no acceleration, enter max_accel.
  • Marlin with junction deviation: square corner velocity = √(junction deviation × acceleration / 0.414). Marlin’s defaults, 0.013 mm at 3,000 mm/s², come to 9.7 mm/s. Set the cruise ratio to 0.
  • Marlin with classic jerk: enter the X/Y jerk from M205 as the square corner velocity, and a cruise ratio of 0.

Where the slicer’s figure comes from

The tool reads the slicer’s estimate from its comment and shows the difference.

Slicer Comment in the file
PrusaSlicer, OrcaSlicer ; estimated printing time (normal mode) = 2h 4m 50s
Bambu Studio, Bambu Lab printers ; model printing time: …; total estimated time: … (the tool uses the total, which includes Bambu Studio’s estimate of the preparation time)
Cura ;TIME:7490 (seconds)

Layers are counted from ;LAYER_CHANGE, ;LAYER: or ; CHANGE_LAYER comments. When a file has none, the tool counts each new height where plastic goes down.

Why does a print take longer than the G-code estimate?

The estimate covers moves only. Heat waits (M109, M190), homing and bed probing are not timed. The printer may also run lower limits than the file sets: firmware acceleration caps, Linear Advance limits, a speed override or a quiet mode. Time your start-up once and add it, then enter the limits your firmware uses.

Heating, homing and probing

A heat wait lasts until the hotend or bed reaches its temperature, and no file can say how long that takes. The MK3S Benchy file waits once for the bed (M190) and once for the hotend (M109), then homes (G28) and probes the bed (G80). The tool lists these under the result. Time your printer once from pressing print to the first extruded line and add that figure.

On Klipper, start G-code can call a macro defined in printer.cfg with [gcode_macro]. Its moves and waits run on the printer, so the file never shows them.

Firmware limits the file does not show

  • Stored limits. If the file sets no M201 or M203, a Marlin printer uses the limits stored in its settings, which M500 saves. Send M503 to read them, enter the acceleration and choose “These values for every move”.
  • Klipper and M204. Klipper does not support M201 or M203. With M204 P… T… and no S, it uses the lower of the two for every move, and with only P or only T it does nothing. This tool follows Marlin, using P for printing and T for travel. For a Klipper printer running such a file, pick “These values for every move” and enter the lower value.
  • Linear Advance. In Marlin’s planner, Linear Advance caps a printing move’s acceleration at the E jerk divided by (K × filament mm per mm of move). With K 0.06 and an E jerk of 2.5 mm/s, a 0.45 × 0.2 mm line (0.0374 mm of filament per mm) is held to 2.5 / (0.06 × 0.0374) = 1,114 mm/s². Klipper’s pressure advance changes only the extruder’s motion, so it adds no time.
  • Input shaping. It does not change the timing itself, but Klipper’s tuning guide has you choose max_accel from the shaper test. One of its examples suggests max_accel <= 3500 mm/sec^2 for the MZV shaper. If the file sets no acceleration, that printer.cfg value is what runs, so enter it.

Speed changes made at the printer

M220 sets a speed percentage for every move, in Marlin and in Klipper. At 50%, every move cruises at half speed and the print takes close to twice as long.

Quiet modes run on lower machine limits. PrusaSlicer writes a second estimate for the MK3S’s silent mode, 2 h 5 min 20 s in Prusa’s Benchy file. This tool compares against the normal-mode line.

For a time before you slice, the print time calculator works from an STL or slicer grams. To price the hours, use the printer hourly rate calculator.

Published · Figures last checked

Sources

  1. Klipper documentation, Kinematics (trapezoid generator, look-ahead, minimum cruise ratio) (accessed 2026-10-14)
  2. Klipper source, klippy/toolhead.py (junction speed and look-ahead flush) (accessed 2026-10-14)
  3. Klipper source, klippy/kinematics/extruder.py (instantaneous corner velocity) (accessed 2026-10-14)
  4. Klipper documentation, Configuration reference (accessed 2026-10-14)
  5. Klipper documentation, G-Codes (accessed 2026-10-14)
  6. Klipper documentation, Measuring resonances (accessed 2026-10-14)
  7. Klipper documentation, Resonance compensation (selecting max_accel) (accessed 2026-10-14)
  8. Marlin, Configuration.h (default acceleration, jerk and junction deviation) (accessed 2026-10-14)
  9. Marlin source, planner.cpp (acceleration limits and Linear Advance) (accessed 2026-10-14)
  10. Marlin documentation, M204: Set starting acceleration (accessed 2026-10-14)
  11. Marlin documentation, M201: Print / travel move limits (accessed 2026-10-14)
  12. Marlin documentation, M203: Set max feedrate (accessed 2026-10-14)
  13. Marlin documentation, G2-G3: Arc or circle move (accessed 2026-10-14)
  14. Marlin documentation, G4: Dwell (accessed 2026-10-14)
  15. Marlin documentation, M109: Wait for hotend temperature (accessed 2026-10-14)
  16. Marlin documentation, G28: Auto home (accessed 2026-10-14)
  17. Marlin documentation, M220: Set feedrate percentage (accessed 2026-10-14)
  18. PrusaSlicer source 2.8.1, GCodeProcessor.cpp (time estimate comments) (accessed 2026-10-14)
  19. OrcaSlicer source, GCodeProcessor.cpp (time estimate comments) (accessed 2026-10-14)
  20. Bambu Studio source, GCodeProcessor.cpp (time estimate comments) (accessed 2026-10-14)
  21. CuraEngine source, gcodeExport.cpp (;TIME and ;LAYER comments) (accessed 2026-10-14)
  22. Prusa Knowledge Base, Binary G-code (accessed 2026-10-14)
  23. Prusa Research, 3D Benchy on Printables (G-code for MK3S and MINI) (accessed 2026-10-14)
  24. Prusa Research, Prusa-Firmware README (MK3S, based on Marlin 1.0.x) (accessed 2026-10-14)
  25. Prusa Research, Prusa-Firmware-Buddy README (MINI, Marlin core) (accessed 2026-10-14)
  26. Bambu Lab, PLA Basic technical data sheet V3.0 (accessed 2026-10-14)