Free G-code Viewer
Open G-code from a slicer or CAM program to see the toolpath layer by layer, with filament, temperatures, size and run time.
What is a G-code Viewer?
G-code is the list of moves a 3D printer or CNC machine follows, written by a slicer or CAM program. This viewer draws the toolpath in 3D and reads the file the way the machine’s firmware would, so you can check a job before it runs.
It handles slicer output from Cura, PrusaSlicer, OrcaSlicer and Bambu Studio, and CNC programs with inches, arcs and several commands per line. The parser follows Marlin’s rules for absolute and relative extrusion and G92 resets, which simpler viewers get wrong.
Key Features
3D Toolpath
Extrusion moves are drawn in 3D with a layer slider and playback, loaded only when the preview opens.
Print Stats
Layers, layer height, filament length and weight, retractions, temperatures, part size and time.
Slicer Details
The slicer and version and its own time estimate are read from the comments it writes.
CNC Programs Too
Inch units, arcs by I/J or R, modal moves, spindle speeds and tool changes are understood.
Command Reference
Commands lists every G and M code in the file, how often it appears, and what it does.
Perfect for everyone
- 3D printing hobbyists and print farms checking jobs
- CNC machinists reviewing CAM output
- Firmware and slicer developers
How to Use the G-code Viewer
Open a G-code file and check the toolpath, numbers and commands before you print or cut.
Open the File
Use Open G-code file for .gcode, .gco, .nc, .ngc or .tap files, or paste the text.
Check the Toolpath
Drag the layer slider or press Play layers to watch the part build up.
Read the Numbers
Summary gives size, filament, temperatures and time. Layers lists filament per layer.
Look Up Commands
Commands shows each code with its meaning, which helps when editing start and end scripts.
G-code, Read Line by Line
Each row is a short G-code program and each answer is this viewer’s output in the mode on the chip. Work out the filament length before you reveal it.
“; generated by PrusaSlicer 2.8.1+win64 on 2026-10-25 at 09:14:02 UTC M104 S215 M140 S60 G21 G90 M83 G92 E0 G1 Z0.2 F7800 G1 X10 Y10 F9000 G1 X30 Y10 E0.8 F1800 G1 X30 Y30 E0.8 G1 E-0.8 F2100 ; estimated printing time (normal mode) = 2m 10s”
“;FLAVOR:Marlin ;TIME:5432 ;Generated with Cura_SteamEngine 5.8.1 M82 G92 E0 ;LAYER:0 G0 X20 Y20 Z0.28 F6000 G1 X60 Y20 E1.6 F1500 G1 X60 Y60 E3.2 ;LAYER:1 G0 Z0.48 G1 X20 Y60 E4.8 G1 X20 Y20 E6.4”
“M82 G92 E0 G1 X0 Y0 Z0.2 G1 X50 Y0 E2.5 G92 E0 G1 X50 Y50 E2.5”
“(face 2 x 1 in) G20 G90 G17 T2 M6 M3 S10000 G0 X0 Y0 Z0.1 G1 Z-0.02 F15 G1 X2 F40 Y0.5 X0 Y1 X2 G0 Z0.5 M5 M30”
“G21 G90 G0 X0 Y0 Z1 M3 S18000 G1 Z-1 F200 G2 X20 Y0 R10 F600 G3 X40 Y0 R10 G0 Z5 M5”
“M83 G1 Z0.2 G1 X0 Y0 G1 X40 Y0 E1.33 F1500 G1 X40 Y40 E1.33 G1 Z0.4 G1 X0 Y40 E1.33 G1 X0 Y0 E1.33 G1 Z0.6 G1 X40 Y0 E1.33”
“M83 G1 X0 Y0 Z0.2 G1 X10 Y0 E0.4 F1800 G1 E-1.5 F2400 G0 X80 Y80 F9000 G1 E1.5 F2400 G1 X90 Y80 E0.4 F1800”
“N1 G21 *38 N2 G90 *46 N3 G1 X10 Y10 E1 F1200 *59 ; first line (G1 X999 skipped) N4 G1 X20 Y10 E2 *22”
“(face 2 x 1 in) G20 G90 G17 T2 M6 M3 S10000 G0 X0 Y0 Z0.1 G1 Z-0.02 F15 G1 X2 F40 Y0.5 X0 Y1 X2 G0 Z0.5 M5 M30”
“; start G-code M140 S60 M104 S210 M190 S60 M109 S210 G28 G29”
The G-code Commands That Matter Most
Most files use a few dozen codes. These ten decide where the tool goes and how much material comes out.
G0 and G1
G0 moves quickly without working, G1 moves at the feed rate while extruding or cutting.
“Which one extrudes?”
G2 and G3
Arcs, clockwise and counterclockwise, with the centre given by I and J or the radius by R.
“Which is clockwise?”
G90 and G91
Absolute and relative positioning. G91 makes every coordinate an offset from the current point.
“Which makes X10 mean 10 mm further on?”
M82 and M83
Absolute and relative extrusion. Most current slicers write M83, so each E is the amount for that move.
“Which do most slicers use now?”
G92
Sets the current position without moving. G92 E0 resets the extruder count, usually at each layer.
“Does G92 move the machine?”
G28
Homes the axes against their end stops, so positions mean something.
“Where does G28 usually appear?”
M104 and M109
Set the hotend temperature. M109 waits until it’s reached, M104 doesn’t.
“Which one waits?”
M140 and M190
Set the bed temperature, with M190 waiting like M109 does.
“Which sets the bed without waiting?”
G20 and G21
Units in inches or millimetres. Printers use millimetres, while many CNC programs use inches.
“Which means inches?”
M3, M5 and M6
CNC spindle on and off, and tool change. S sets the spindle speed in rpm.
“Which stops the spindle?”
What Slicers Write
Each slicer leaves its own comments, which this viewer reads for the slicer name and time estimate.
Cura
Writes ;FLAVOR, ;TIME in seconds, ;LAYER:n before each layer, and Generated with Cura_SteamEngine at the top.
PrusaSlicer
Writes generated by PrusaSlicer at the top, ;LAYER_CHANGE markers, and the estimated printing time at the end.
OrcaSlicer and Bambu Studio
Forks of PrusaSlicer with similar comments, plus a header block with filament use and layer count.
Simplify3D
Writes its settings as comments at the top and ; layer markers through the file.
CAM Programs
Fusion 360, Carbide Create and Vectric write parenthesised comments with the tool and operation names.
How the Numbers Are Worked Out
Knowing the assumptions explains why numbers differ from your slicer.
Time Ignores Acceleration
Run time is distance over feed rate. Real machines slow for corners, so the slicer’s estimate is usually longer.
Rapids at 3,000 mm/min or More
G0 moves use the feed rate or 3,000 mm/min, whichever is faster, since firmware doesn’t slow rapids to the last F.
Weight Assumes PLA
Filament weight uses 1.75 mm filament at 1.24 g/cm³. PETG and ABS weigh a little more or less.
Layers by Height
A layer is every extruding move at the same Z, so a Z hop or vase mode can add extra layers.
Size From Working Moves
The size covers extruding or cutting moves, arcs included, and ignores travel and homing.
Printer or CNC
A file is treated as a printer file if any move extrudes, and as a CNC program otherwise.
When to Open G-code
Whenever you want to see a job before a machine runs it.
Before a Long Print
Check layers, size and filament before committing many hours of printer time.
Shared Files
Inspect a .gcode file someone sent you to see which slicer and settings made it.
Editing Start Scripts
Check that your custom start and end G-code uses the right codes and order.
CAM Output Review
Check a CNC program’s depths, tools and extents before the first cut.
Learning G-code
Paste a few lines and see the toolpath and what each command does.
G-code Pitfalls
Problems that a quick look at the file can catch before a failed print or a broken bit.
Wrong Extrusion Mode
A start script with M82 in front of relative-E slicer output over-extrudes badly. Check that M82 or M83 matches the slicer.
Missing G92 E0
In absolute mode, forgetting to reset E after a purge line makes the first move push a huge amount of filament.
Wrong Printer Profile
G-code sliced for another machine can exceed your bed. Compare the size line with your build volume.
Inches Read as Millimetres
A CNC program without G20 run on a millimetre machine is 25.4 times too small.
Temperatures for Another Filament
A profile left on PETG prints PLA too hot. Check the hotend and bed lines.
Firmware Flavour
Klipper, Marlin and RepRapFirmware share most codes but differ on a few, so macros may not carry over.