Free tool
G-code explainer
Paste a CNC program and this tool explains every line in plain English, shows which codes are still active after each line, and flags well-known mistakes such as G91 left on or a drilling cycle still running at a tool change. It runs in your browser: nothing is uploaded.
13 lines explained, nothing flagged.
| # | Line | What it does |
|---|---|---|
| 1 | % | Start or end of the program file. |
| 2 | O1001 (FACE PLATE HOLES) | Program number O1001. Comment: FACE PLATE HOLES |
| 3 | G21 G17 G40 G49 G80 G90 | G21: Metric units. G17: XY plane selection. G40: Cutter compensation cancel. G49: Tool length compensation cancel. G80: Canned cycle cancel. G90: Absolute positioning. Active: G21 · G17 · G90 |
| 4 | T1 M06 (8 MM DRILL) | T1: tool 1. M06: Tool change. Comment: 8 MM DRILL Active: G21 · G17 · G90 · T1 |
| 5 | G54 G00 X0. Y0. S1200 M03 | G54: Work offset 1. G00: Rapid positioning. S1200: spindle speed 1200 RPM. M03: Spindle on, clockwise. Moves to X0 Y0 at rapid. Active: G21 · G17 · G90 · G54 · G00 · S1200 · T1 · spindle CW |
| 6 | G43 H01 Z25. M08 | G43: Tool length compensation +. H01: tool length offset 1. M08: Flood coolant on. Moves to Z25 at rapid. Active: G21 · G17 · G90 · G54 · G00 · G43 · S1200 · T1 · spindle CW · coolant on |
| 7 | G99 G81 X10. Y10. Z-5. R2. F120. | G99: Canned cycle return to R plane. G81: Drilling cycle (spot drill). Runs G81 at X10 Y10 (depth Z-5, R plane R2). Active: G21 · G17 · G90 · G54 · G00 · G81 active · G43 · F120 · S1200 · T1 · spindle CW · coolant on |
| 8 | X30. | Runs G81 at X30. Active: G21 · G17 · G90 · G54 · G00 · G81 active · G43 · F120 · S1200 · T1 · spindle CW · coolant on |
| 9 | G80 G00 Z25. M09 | G80: Canned cycle cancel. G00: Rapid positioning. M09: Coolant off. Moves to Z25 at rapid. Active: G21 · G17 · G90 · G54 · G00 · G43 · F120 · S1200 · T1 · spindle CW · coolant off |
| 10 | G91 G28 Z0. M05 | G91: Incremental positioning. G28: Return to reference position. M05: Spindle stop. Goes home in Z by way of the current position (incremental zero), so straight from here. Active: G21 · G17 · G91 · G54 · G00 · G43 · F120 · S1200 · T1 · spindle off · coolant off |
| 11 | G90 | G90: Absolute positioning. Active: G21 · G17 · G90 · G54 · G00 · G43 · F120 · S1200 · T1 · spindle off · coolant off |
| 12 | M30 | M30: End of program and rewind. Active: G21 · G17 · G90 · G54 · G00 · G43 · F120 · S1200 · T1 · spindle off · coolant off |
| 13 | % | Start or end of the program file. |
Fanuc-style programs, mill or lathe (G-code system A). An explanation, not a simulation: it cannot prove a program is safe. Your program never leaves this page.
What the explainer checks
- Every word: G- and M-codes from our code reference, plus positions, feed (F), speed (S), tool (T) and offsets (H, D).
- Modal state: units, plane, absolute or incremental, work offset, motion mode, active cycle, compensation, feed and speed, after every line.
- Known mistakes: a feed move before any F, an arc without R or I/J/K, G28 in absolute mode, a tool change with a cycle or cutter compensation still on, G43 without H, G96 without a G50 limit, and a program that ends in G91.
Reading programs fluently comes from knowing the codes without looking them up. Practise the core codes and this table becomes something you can do in your head.
More practice hubs
Frequently asked questions
- How do I read a G-code program line by line?
- Read each line as a set of words: the G-codes say how to move, the M-codes switch things on and off, and the letters with numbers (X, Y, Z, F, S, T, H) give positions, feed, speed and which tool or offset. Then keep track of what stays active from earlier lines, because most G-codes are modal. This tool does both for you, line by line.
- Is my program uploaded anywhere?
- No. The explanation runs in your browser. Nothing you paste is sent to a server or stored.
- Can this tool tell me if a program is safe to run?
- No. It flags a few well-known mistakes, such as G91 left on, a drilling cycle still active at a tool change or G96 without a speed limit, but it does not simulate the toolpath, check clearances or know your machine. Prove out every program on the machine with single block, reduced rapids and supervision.
- Which controls does it understand?
- Fanuc-style programs, which covers Fanuc, Haas, Okuma in EIA mode, Mitsubishi, LinuxCNC and most other controls for the common codes. Lathe mode uses Fanuc G-code system A. Machine-specific codes are marked as not in our reference.
G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.