G-code explainer & checker
Free G-code explainer and checker for Fanuc and Haas style programs: plain-English meaning of every block, modal state tracking, warnings for missing feeds, tool length offsets, bad arcs and canned cycle mistakes, and an XY backplot. Runs in your browser.
G-code explainer & checker
Paste a Fanuc or Haas style program. Every line gets a plain-English read, the modal state is tracked through the program, common mistakes get flagged, and the XY path is drawn so you can see it before the machine does.
Dashed grey: rapids. Green: feed moves and arcs. Orange dots: canned cycle positions. Looking down the Z axis.
| # | Block | What it does | State after |
|---|---|---|---|
| 1 | % | Program start or end marker (tape format). | G0 G17 G90 G40 G49 54 X0.000 Y0.000 Z0.000 |
| 2 | O1001 (FACE AND DRILL SAMPLE) | Program number O1001. Comment: FACE AND DRILL SAMPLE | G0 G17 G90 G40 G49 54 X0.000 Y0.000 Z0.000 |
| 3 | (T1 2.0 FACE MILL, T2 0.25 DRILL) | Comment: T1 2.0 FACE MILL, T2 0.25 DRILL | G0 G17 G90 G40 G49 54 X0.000 Y0.000 Z0.000 |
| 4 | G20 G17 G40 G49 G80 G90 | G20: Inch units. G17: XY plane. G40: Cutter compensation off. G49: Tool length compensation off. G80: Canned cycle cancel. G90: Absolute positioning. | G0 G17 G90 G20 G40 G49 54 X0.000 Y0.000 Z0.000 |
| 5 | T1 M6 | M6: Tool change. Loads tool 1. | G0 G17 G90 G20 G40 G49 54 T1 X0.000 Y0.000 Z0.000 |
| 6 | G54 G0 X-1.5 Y0.5 S3500 M3 | G54: Work offset 1. G0: Rapid traverse to the position. M3: Spindle on clockwise. Spindle speed 3500 RPM. | G0 G17 G90 G20 G40 G49 G54 T1 S3500 M3 X-1.500 Y0.500 Z0.000 |
| 7 | G43 H1 Z1. M8 | G43: Tool length compensation on, plus direction. M8: Flood coolant on. Moves with the modal motion G0. | G0 G17 G90 G20 G40 G43 G54 T1 H1 S3500 M3 M8 X-1.500 Y0.500 Z1.000 |
| 8 | G1 Z0 F50. | G1: Linear feed move. Feed 50. per min. | G1 G17 G90 G20 G40 G43 G54 T1 H1 S3500 F50 M3 M8 X-1.500 Y0.500 Z0.000 |
| 9 | X3.5 | Moves with the modal motion G1. | G1 G17 G90 G20 G40 G43 G54 T1 H1 S3500 F50 M3 M8 X3.500 Y0.500 Z0.000 |
| 10 | G0 Z1. | G0: Rapid traverse to the position. | G0 G17 G90 G20 G40 G43 G54 T1 H1 S3500 F50 M3 M8 X3.500 Y0.500 Z1.000 |
| 11 | T2 M6 | M6: Tool change. Loads tool 2. | G0 G17 G90 G20 G40 G49 G54 T2 H1 S3500 F50 M3 M8 X3.500 Y0.500 Z1.000 |
| 12 | G0 X0.5 Y0.5 S4000 M3 | G0: Rapid traverse to the position. M3: Spindle on clockwise. Spindle speed 4000 RPM. | G0 G17 G90 G20 G40 G49 G54 T2 H1 S4000 F50 M3 M8 X0.500 Y0.500 Z1.000 |
| 13 | G43 H2 Z1. M8 | G43: Tool length compensation on, plus direction. M8: Flood coolant on. Moves with the modal motion G0. | G0 G17 G90 G20 G40 G43 G54 T2 H2 S4000 F50 M3 M8 X0.500 Y0.500 Z1.000 |
| 14 | G83 Z-0.6 R0.1 Q0.15 F12. | G83: Peck drilling cycle. Feed 12. per min. Canned cycle G83 at X0.5 Y0.5. | G0 G17 G90 G20 G40 G43 G54 G83 T2 H2 S4000 F12 M3 M8 X0.500 Y0.500 Z1.000 |
| 15 | X2.5 | Canned cycle G83 at X2.5 Y0.5. | G0 G17 G90 G20 G40 G43 G54 G83 T2 H2 S4000 F12 M3 M8 X2.500 Y0.500 Z1.000 |
| 16 | Y1.5 | Canned cycle G83 at X2.5 Y1.5. | G0 G17 G90 G20 G40 G43 G54 G83 T2 H2 S4000 F12 M3 M8 X2.500 Y1.500 Z1.000 |
| 17 | X0.5 | Canned cycle G83 at X0.5 Y1.5. | G0 G17 G90 G20 G40 G43 G54 G83 T2 H2 S4000 F12 M3 M8 X0.500 Y1.500 Z1.000 |
| 18 | G80 | G80: Canned cycle cancel. | G0 G17 G90 G20 G40 G43 G54 T2 H2 S4000 F12 M3 M8 X0.500 Y1.500 Z1.000 |
| 19 | G0 Z1. M9 | G0: Rapid traverse to the position. M9: Coolant off. | G0 G17 G90 G20 G40 G43 G54 T2 H2 S4000 F12 M3 X0.500 Y1.500 Z1.000 |
| 20 | G91 G28 Z0. | G91: Incremental positioning. G28: Return to reference point through the intermediate position. Axis words here are the intermediate point, then the machine goes to home. | G0 G17 G91 G20 G40 G43 G54 T2 H2 S4000 F12 M3 X0.500 Y1.500 Z1.000 |
| 21 | G28 X0 Y0 | G28: Return to reference point through the intermediate position. Axis words here are the intermediate point, then the machine goes to home. | G0 G17 G91 G20 G40 G43 G54 T2 H2 S4000 F12 M3 X0.500 Y1.500 Z1.000 |
| 22 | M30 | M30: Program end and rewind. | G0 G17 G91 G20 G40 G43 G54 T2 H2 S4000 F12 M3 X0.500 Y1.500 Z1.000 |
| 23 | % | Program start or end marker (tape format). | G0 G17 G91 G20 G40 G43 G54 T2 H2 S4000 F12 M3 X0.500 Y1.500 Z1.000 |
The parser reads G and M codes as a Fanuc-style control would: modal groups carry forward, G90/G91 sets how axis words are read, I and J are incremental from the arc start, R picks the short arc (negative R the long one).
Checks: feed moves before any F, G43 without H, no G43 after a tool change, arcs with no centre or with mismatched radii, R too small for the chord, G28 in G90 with axis words, canned cycles missing R or Z, cutter comp active through a tool change, unbalanced comments, missing program end, mixed G20/G21.
Feed time is the sum of feed moves at the programmed F, no accel or dwell. Rapids are not timed. Tap pitch is F divided by S when both are on the tap line.
Macro calls, subprograms and canned cycle internals are described, not simulated. The plot shows cycle positions as dots.
This is a reader, not a verifier. It knows nothing about your tooling, fixtures or travel limits. Prove out on the machine the same way you always would. Nothing you paste leaves your browser.
Related tools
More in CNC programming & probing: Fanuc Macro B reference, Probing & tool setting cycle finder, Probe result to offset write
Software & Shop Tools
Want one of these built around your parts and your process? I build shop tools.