viewhack

See a 3D print’s G-code layer by layer

Drop a .gcode file from PrusaSlicer, OrcaSlicer, BambuStudio, SuperSlicer, Cura or Simplify3D, or a Prusa .bgcode, to walk its toolpath one layer at a time or turn the whole print in 3D. Next to it: the print time the slicer estimated, the filament in metres and grams, the layer height, the temperatures, the thumbnail and every slicer setting, searchable.

The file is read by this tab on your device and is not uploaded, so a 100 MB print file opens without waiting for a transfer. Nothing is sent to a printer.

What it shows

Reading a G-code file

A worked example
A calibration cat sliced in PrusaSlicer 2.9.2 for a Prusa MINI is 635 KB and 28,635 lines. It holds four thumbnails (16×16, 220×124 and 200×240 in QOI, 380×285 in PNG), 174 layers of 0.2 mm, an estimate of 37 minutes 15 seconds and 2,224.99 mm of filament, which the slicer weighs at 6.64 g. Adding up the extrusion moves gives 2,222.5 mm: the 2.5 mm difference is the slicer counting differently around retractions. The print is 28.2 × 28.0 × 34.8 mm, the nozzle is set to 170 °C for bed levelling and then 230 °C and 220 °C, the bed to 60 °C, and 233 of its moves are arcs (G2/G3).
Why the time is the slicer’s
How long a print takes depends on the firmware’s acceleration, jerk or junction deviation and input shaper settings, which the G-code does not fully carry. The slicer simulates them for the printer profile it knows; this page shows that estimate, and does not invent its own.
How layers are found
When the slicer marks layers (;LAYER_CHANGE in PrusaSlicer and OrcaSlicer, ;LAYER: in Cura), those marks are used. Otherwise a new layer starts when printing resumes at a new height, so a Z-hop between islands is not counted as a layer.
Filament weight
Grams are the slicer’s figure when it wrote one. Otherwise the length is turned into volume with the filament diameter and into weight with the density the file states, or 1.75 mm and 1.24 g/cm³ (typical PLA) when it states none; PETG is about 1.27 and ABS about 1.04, so an ABS print weighs about 16% less than this estimate.
Large files
The file is read in 4 MB pieces by a background worker, so the page keeps responding while a 100 MB file loads. The layer view draws every move of the chosen layer. The 3D view merges runs of short moves into single lines once a print passes 400,000 lines (150,000 on a phone) so it stays smooth; it says when it has.
Written for this site
The G-code reader, the QOI decoder and the binary G-code reader are viewhack’s own, written from the G-code conventions of Marlin, Prusa and Klipper firmware, the QOI specification and the libbgcode file specification. The binary reader was checked against the sample files in Prusa’s libbgcode repository: unpacked here, they give the same layers and filament as Prusa’s own text conversion. The 3D view uses three.js (MIT), served from this site.

What this cannot do

Other ways to look inside

Slicers
PrusaSlicer and OrcaSlicer have a G-code preview (File, G-code preview, or drag the file in) that also shows speeds, fan and flow, for files they or another slicer made.
Command line
bgcode from Prusa’s libbgcode converts .bgcode to text and back; any text editor opens a .gcode.