G-Code Viewer
Open a .gcode, .nc or .ngc file, or paste G-code, and see the toolpath in 2D or 3D. Step through layers, replay the moves, tell rapids from cutting or extrusion, and get the bounding box, distances, filament use and an estimated run time. Your file never leaves your browser.
Last updated:
Edit or paste G-code
How to use the G-Code Viewer
- Open a G-code file with the button, drop it on the viewer, or paste code into the Edit or paste G-code box. A 3D print sample loads automatically.
- Switch views between Top (2D), 3D and Front. Drag to rotate in 3D or to pan in 2D, and use the mouse wheel, pinch or the +/− buttons to zoom.
- Move the Layer slider to inspect each layer or cutting depth, and tick Current layer only to isolate it.
- Press Play or drag the Moves shown slider to watch the toolpath build up move by move.
- Read the stats for size, ranges, distances, filament and estimated time, then copy the summary or download a PNG of the view.
Reading a G-code program
G-code is a list of plain-text commands, one per line. Each line holds words made of a letter and a number: G1 X20 Y10 F1200 means “move in a straight line to X 20, Y 10 at 1,200 mm per minute”. Comments start with a semicolon or sit inside parentheses. Motion commands are modal, so a following line with only X30 repeats the last G1.
| Code | Meaning | How the viewer shows it |
|---|---|---|
G0 | Rapid move (no cutting) | Dashed red line; uses the rapid speed for CNC time |
G1 | Linear move at feed rate F | Solid line (cut or extrusion), travel if it does not extrude in a print |
G2 / G3 | Clockwise / counterclockwise arc, center I J or radius R | Smooth arc split into short segments, helical if Z changes |
G4 P… | Dwell (pause) | Added to the estimated time |
G20 / G21 | Inch / millimeter units | Converted internally; display units follow the file |
G90 / G91 | Absolute / relative coordinates | Applied to X, Y, Z (and E) |
M82 / M83 | Absolute / relative extrusion | Used to work out filament use |
G92 | Set current position (often G92 E0) | Resets the axis without moving |
G28 | Home axes | Rapid move to 0 on the homed axes |
F, S, T | Feed rate, spindle speed or temperature, tool number | Feed rate used for time; tools listed in the stats |
What to check before you run a file
- Bounding box vs. machine travel: compare the X, Y and Z ranges with your bed or table size, and confirm the program starts where you expect relative to your work zero.
- Rapids through the part: in CNC programs, dashed rapid lines should stay above the stock. A rapid that dips below the top surface is a crash risk.
- Cut depths: each layer of a CNC program is a distinct Z depth. Step through them to confirm the final depth and the number of passes.
- First layer: for prints, isolate layer 1 to check that the skirt, brim and first perimeter sit inside the bed.
- Units: a file written in inches (G20) but run in millimeters would be 25.4 times too small; the stats show which unit system the file uses.
Frequently asked questions
Is my G-code uploaded anywhere?
No. The file is read and drawn entirely in your browser with JavaScript, so it never leaves your computer. That also means very large files are limited only by your device's memory.
Which G-code commands are supported?
Linear moves G0 and G1, arcs G2 and G3 in the XY plane with I/J centers or an R radius, dwell G4, inch and millimeter units G20/G21, absolute and relative positioning G90/G91, extruder modes M82/M83, position resets G92 and homing G28. Codes such as canned drilling cycles or cutter compensation are listed as not simulated rather than guessed.
How is the time estimate calculated?
Each move's length is divided by its feed rate (F, in units per minute), and dwells and extruder-only retract moves are added. CNC rapids use the rapid speed you enter. Real machines accelerate and slow down at corners, so actual run times are usually somewhat longer, especially for prints with many short segments.
How does the viewer tell a 3D print from a CNC program?
If any move extrudes filament (E increases while the head moves), the file is treated as a print: extruding moves are drawn solid and non-extruding moves are shown as travel, and layers follow the Z height of the extrusion. Otherwise G1/G2/G3 moves are cuts, G0 moves are rapids, and layers are the distinct cutting depths.
How is filament weight estimated?
The net length of filament pushed by the extruder is converted to volume using the filament diameter you enter (1.75 mm by default) and multiplied by 1.24 g/cm³, a typical density for PLA. Other materials differ: PETG is about 1.27 g/cm³ and ABS about 1.04 g/cm³.
Why do some arcs look wrong?
Arc centers given with I and J are relative to the start point by default (G91.1 mode), which is what almost all CAM software outputs. Arcs in the XZ or YZ plane (G18/G19) are drawn as straight lines and flagged in the notes.
Which file types can I open?
Any plain-text G-code file, including .gcode, .gco, .g, .nc, .ngc, .tap and .cnc. Binary formats such as compressed .bgcode files are not supported; export plain G-code from your slicer instead.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.