3D printing · G-code
G-code print time and filament estimator.
Choose a sliced .gcode file, or paste G-code, and the page reads it in your browser: filament used in millimetres, grams and cost, the time the moves take at their commanded speeds, the footprint and the layer count. Checked against the sample file in PrusaSlicer’s own repository: this tool counted 675.96 mm of filament where the slicer’s footer says 676.57 mm, and 17 min 0 s of movement where the slicer estimated 17 min 27 s.
How the estimate is calculated
G-code is a list of instructions. A G1 move carries a target position, an optional E value for how far the extruder feeds filament and an optional F feedrate. Marlin’s documentation defines F as “the requested movement rate for this move and any following moves” in units per minute, so it persists until changed. M83 puts the extruder in relative mode, where each E is an increment; with M82 E is a position and the tool uses the difference between moves. G92 E0 resets that position. This page follows those rules (all read 26 October 2026).
Filament is the sum of every forward extruder move after the first layer marker (;LAYER_CHANGE or ;LAYER:0), which leaves out the priming lines in the start G-code. Retractions are not subtracted: that matches PrusaSlicer’s own total (see below). Mass is length × cross-section area × density. Move time is each move’s length divided by its feedrate, with arcs (G2/G3) measured along the arc, plus any G4 dwell. There is no acceleration, cornering or heating model, so on a real printer the time is longer; treat it as a lower bound. If the slicer left an estimate in a comment (PrusaSlicer’s “estimated printing time (normal mode)” or Cura’s ;TIME: in seconds) the page shows it beside ours.
Worked example with real numbers
PrusaSlicer’s repository ships a test file, resources/test_data/test_vase.gcode, generated by PrusaSlicer 2.9.0-alpha1 with 1.75 mm ABS at 1.08 g/cm³. Its footer reads ; filament used [mm] = 676.57, [cm3] = 1.63, [g] = 1.76 and ; estimated printing time (normal mode) = 17m 27s. Run through this tool: 675.96 mm of forward extrusion across 126 layers, 25 mm tall, a 30.1 mm square footprint, 1.76 g, and 17 min 0 s of move time. The filament figure is 0.09% below the slicer’s and the time 2.6% below, the direction expected from ignoring acceleration. The maths checks by hand: π × 0.875² × 676.57 mm = 1,627 mm³ = 1.63 cm³, and × 1.08 = 1.76 g.
What this estimator leaves out
Heating and homing, filament changes, pauses, firmware speed limits and acceleration, and any slicer-specific commands it does not recognise. Different slicers write different comments, and Klipper macros or Bambu binary files will not parse. For firmware-accurate times, use the slicer’s own estimate or the printer’s.
Common mix-ups
-
Often assumedThe filament a slicer reports is what is left after subtracting retractions.
What the source saysIn PrusaSlicer’s own 2.9.0-alpha1 sample file the forward extrusions after the first layer marker add up to 675.96 mm, the retractions to 65.4 mm, and the footer reports 676.57 mm, so the slicer counts the forward feed and does not subtract the retractions. (Our measurement of the public file.) [1]
Checked against these sources on .
Frequently asked questions
How do I calculate print time from a G-code file?
Divide each move's length by its feedrate and add them up. That gives the time at the commanded speeds. Real prints take longer because the printer accelerates and decelerates, so slicers model that too. This tool shows the simple figure and the slicer's own estimate when it is in the file.
How accurate is the estimate?
On PrusaSlicer's sample file it gave 17 min 0 s against the slicer's 17 min 27 s, 2.6% lower, and filament within 0.09%. Files with many tight corners or slow acceleration will differ more. Treat it as a lower bound.
Is my file uploaded?
No. The file is read by your browser and the arithmetic runs on the page. Nothing is sent or stored.
Why does filament used differ from my slicer?
Slicers differ on whether they count priming lines, wipes and retractions. This tool counts forward extruder moves after the first layer marker, which matched PrusaSlicer to 0.09% on its sample file.
Which slicers does it read comments from?
PrusaSlicer-style footers and Cura-style ;TIME: and ;Filament used: headers. Any plain-text G-code works for the arithmetic regardless of slicer.
Can it read .bgcode files?
No. Binary G-code is not supported; export plain text G-code.
Sources
Retrieved
- Marlin: G0-G1 Linear Move — E and F parameters, feedrate in units per minute and persistent (read 2026-10-26)
- Marlin: M83 Extruder Relative Mode — relative extruder moves (read 2026-10-26)
- Marlin: G92 Set Position — resetting the extruder position (read 2026-10-26)
- PrusaSlicer repository: test_vase.gcode — footer comment format and the worked-example figures (read 2026-10-26)
- Duet3D forum: Cura gcode print time estimates — Cura header comments ;TIME: and ;Filament used: (read 2026-10-26)
- PLA technical data sheet (Harvard 3D printing) — PLA solid density 1.24 g/cc (read 2026-10-26)
A simple estimate, read in your browser
Not affiliated with Prusa Research, Ultimaker or the Marlin project. The estimate ignores acceleration and heating, so real prints take longer. Your file never leaves your device.