# G-code viewer

> Open any G-code file and see each line become a move: the listing scrolls with the tool, the current line lights up on the 3D toolpath, and you can tap a line to see exactly what it does. Arcs, units and feeds are checked as you go.

Human page: https://unmakelabs.com/en-us/gcode-viewer/. This is the version for AI agents.

## What it does

G-code viewer online: read G-code as a picture, one line at a time Open any G-code file and see each line become a move: the listing scrolls with the tool, the current line lights up on the 3D toolpath, and you can tap a line to see exactly what it does. Arcs, units and feeds are checked as you go.

## What a G-code viewer shows

G-code is the language most CNC machines speak: G0 moves fast, G1 cuts in a straight line, G2 and G3 cut arcs, X, Y and Z are the target, F the feed. A G-code viewer turns those lines into the path the tool follows, so you can see the shape and understand each line in context, instead of picturing coordinates in your head.

## Who it's for

Anyone learning or debugging G-code: apprentices and students, CNC router and mill hobbyists using Grbl, Mach3 or LinuxCNC, people writing G-code by hand or with scripts, and programmers checking what a post-processor did to one tricky line.

## Facts

- **Line by line:** Listing and toolpath linked both ways: tap a line or a point of the path
- **Understands:** G0-G3, G17/18/19, G20/21, G90/91, G90.1/91.1, G4, G28/G53, G41/42, G43, G54-59, G81-89, G92-95, M3-M9, M6, M98/M99
- **Checks:** Arc end points on the circle, R arcs too short, missing feeds, missing units, unknown words
- **Downloads:** PNG, plan-view SVG at 1:1, summary JSON

## How a person does it

1. **Open the file.** Drop a .gcode, .nc, .ngc or .tap file, pick it, or paste a link. Nothing is uploaded.
2. **Step through it.** Use the ◀ ▶ buttons or the arrow keys to go one line at a time; the line is shown above the slider and highlighted in orange on the path. Press play to run it at a speed that fits about 30 seconds.
3. **Find the problem lines.** Warnings name each issue in plain words with a line number: tap it to jump there. The listing marks those lines in yellow or red.

## Open a file by link (works today)

The viewer runs in a browser. Any public file URL can be opened by adding `?src=` (URL-encoded): `https://unmakelabs.com/en-us/gcode-viewer/?src=https://unmakelabs.com/apps/nc/samples/bracket.nc`. The host must allow cross-origin reads (GitHub raw, most object storage and CDNs do). A camera view can be added after `#`: `#t=0.5&v=px,py,pz,tx,ty,tz&r=0&u=mm&rr=10000` (t position in machining time 0 to 1, default 1 = whole program; v camera; r=0 hides rapids; u units when the file states none; rr rapid rate in mm/min for the time estimate).

Embed: `<iframe src="https://unmakelabs.com/embed/nc/?src=<url-encoded file URL>" width="100%" height="480" style="border:0"></iframe>`.

## Send your own file (live)

`POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25` with the file as multipart `file` (or JSON `file_base64` + `filename`, or `file_url`), API tool `nc_inspect`: Inspect a CNC program (G-code, Heidenhain). The same engine code as this page. No sign-up; Free: 5 full results per IP per day without a key (resets at 00:00 UTC); POST /v1/keys gives an instant key with 25 more full results (one-time, not renewed); each accepted correction adds 1 free call (up to 20 a month). Options (JSON in `options`): `rapid_mm_min`: rapid feed for the time estimate in mm/min (default 10000); `tool_change_s`: seconds per tool change (default 6).

```bash
# NC program: tools, extents, run time
curl -s -F "file=@part.nc" "https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25"
```

## Good to know

G-code is modal: a G1 or G2 stays active until another motion code replaces it, so a line with only X and Y continues the last motion. If a G2 is still active when the next line has no centre, a real control stops; the viewer flags it as an arc without a centre and draws it straight. A G-code file without G20 or G21 is read as millimetres, with a switch to inches.

## Not done by this tool

- Doesn't evaluate macro variables (#100) or expressions in brackets
- Doesn't draw polar coordinates (G16), rotation (G68) or scaling (G51) yet: they are listed
- Doesn't edit G-code (open it in a text editor for that)

## Value

Opens an NC program (G-code: Fanuc, Haas, Mach3, Grbl, LinuxCNC and CAM post-processor output; Siemens Sinumerik and Heidenhain Klartext in part; 3D-printer G-code) in the browser with nothing to install and draws the 3D toolpath: cuts coloured per tool, rapids dashed, play and scrub with the running line highlighted in the listing. Reports the extents of the cutting moves, cutting and rapid travel, an estimated machining time from the programmed feeds (rapid rate and tool-change time adjustable), the tools with feeds, speeds and cutting time, and warnings with line numbers (arcs whose end is off the circle, missing feeds, missing units, unsupported codes, cycles and macros not drawn). Downloads a PNG, a 1:1 plan-view SVG and a JSON summary. Free, no sign-up.

## When it fits

- A machinist or setter wants to see what an NC program will do before running it, on a phone or shop PC with no CAM seat: shape, depth, extents against the stock, tools and roughly how long it takes.
- A CAM programmer wants to check post-processor output (arc format, units, tool changes, drilling cycles, feeds) or find the line that makes a control alarm on an arc.
- Someone has a .nc, .tap, .gcode, .ngc or .cnc file from a customer, a forum or a hobby CNC router and wants to know what it cuts, how big and in which units.

### When not

- Collision checking against the machine, fixtures or the stock model, material removal simulation, or verified cycle times on a specific machine (acceleration is not modelled): use the CAM's or the control's own simulation.
- Programs built mostly from macro variables, loops or control-specific cycles (Fanuc Macro B, Heidenhain Q parameters and CYCL DEF, Sinumerik CYCLE pockets): these parts are listed as warnings, not drawn.

## Why use it instead of the alternatives

- Nothing to install: the page opens a public NC program from a link (?src=, with #t= for the point in the program and #v= for the camera) and an embed shows the toolpath in any page.
- NCViewer (ncviewer.com) draws G-code locally in the browser with an editor, line stepping, 5-axis and lathe modes; its side panels are the code editor, a position readout and machine options (checked Dec 2026), with no tool list with feeds, speeds and per-tool times and no list of problems with line numbers. CAMotics and desktop editors such as CIMCO Edit need installing (CIMCO is paid); controls and CAM systems simulate only for their own users.
- This viewer: free in any browser incl. phones, nothing uploaded, line-by-line playback, tool list with feeds/speeds/times, plain warnings with line numbers (arcs a control would reject, missing units or feeds, codes not drawn), Heidenhain and Sinumerik read in part, plan-view SVG at 1:1, share link and embed.

### What rebuilding it would take

- Write a reader that handles modal G-code state (motion, plane, absolute/incremental, units, feed modes), arcs by I/J/K and by R including >180° and full circles, helical arcs, drilling cycles G81-G89 with G98/G99, subprograms (M98/M99, M97) and Sinumerik/Heidenhain variants.
- Draw millions of segments smoothly on a phone, scrub by machining time, highlight the running line, and time every move from its feed.
- Explain every unsupported code or broken arc in plain words with its line number, and export a scale-true plan view.
- A set of hand-worked test programs with known lengths, extents and times to keep the reader honest as dialects are added.

## Quality

No score published; the limits above say what it does not do. Check results that matter before you rely on them.

## Risk for the user

- Free and unlimited; no sign-up, no ads.
- A viewer, not a machine simulation: it does not check collisions, and some codes are not drawn (listed as warnings). Prove out every program on the machine as usual.

_Status: the NC viewer page works; agents send their own file to POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25._

## Privacy

- Files opened in the page are read on the user's device and not uploaded unless the user clicks Share.
- Files opened by link (?src=) are fetched from where they are stored.
- The page loads three.js from a public code server, which receives the visitor's IP address for that request.

## Data

Opens in your browser; your file stays on your device unless you share it. Shared files are kept 30 days.

## FAQ

- **What's the difference between G2 and G3?** G2 cuts an arc clockwise, G3 counter-clockwise, looking down on the plane (from +Z in G17). The centre is given by I, J, K (by default as an offset from the start point) or the radius by R (negative R for arcs over 180°). The viewer draws both forms and checks that the end point lies on the circle.
- **Why does my G-code look tiny or huge?** Usually units: G20 means inches, G21 millimetres. If the file has neither, the viewer reads millimetres and offers inches with one tap. Old Fanuc controls also read numbers without a decimal point as thousandths (X10 = 0.010 mm); CAM software always writes the point, so this rarely matters.
- **Why does it flag an arc my machine runs?** Each arc is checked the way a control checks it: the end point must lie on the circle around the centre (I/J/K) within 0.0127 mm or 0.1% of the radius, and an R arc can't be shorter than half its chord. Controls differ in tolerance (a parameter), so a flagged arc may still run, but it's the first place to look when a machine alarms on a post-processor's arcs. If every arc fails as incremental I/J but fits as absolute centres, the viewer switches and says so.
- **When is it the right tool, and when not?** Right for: A machinist or setter wants to see what an NC program will do before running it, on a phone or shop PC with no CAM seat: shape, depth, extents against the stock, tools and roughly how long it takes. A CAM programmer wants to check post-processor output (arc format, units, tool changes, drilling cycles, feeds) or find the line that makes a control alarm on an arc. Someone has a .nc, .tap, .gcode, .ngc or .cnc file from a customer, a forum or a hobby CNC router and wants to know what it cuts, how big and in which units. Not for: Collision checking against the machine, fixtures or the stock model, material removal simulation, or verified cycle times on a specific machine (acceleration is not modelled): use the CAM's or the control's own simulation. Programs built mostly from macro variables, loops or control-specific cycles (Fanuc Macro B, Heidenhain Q parameters and CYCL DEF, Sinumerik CYCLE pockets): these parts are listed as warnings, not drawn.
- **Is it really free?** Yes: no limit on files, no ads, no sign-up, no premium tier. Programs up to 200 MB open.
- **Do you upload my program?** Only if you share it. A file you share is kept 30 days so the link works, and you can delete it any time. Your programs and your customers' parts stay private otherwise.
- **Can my AI agent read NC programs here?** An agent can open any public program in this viewer with a link (add ?src= and the file's address to this page) and read the summary with Download > Summary (JSON). Agents can send their own file: POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25.
- **Who makes this?** Unmake Labs. Contact: hello@unmakelabs.com.

## Related pages

- [NC viewer](https://unmakelabs.com/en-us/nc-viewer/)
- [.tap file viewer](https://unmakelabs.com/en-us/tap-file-viewer/)
