G-Code Reference Viewer

G & M codes

CodeGroupMeaningExampleNotes
G00Rapid motionMove at maximum rateG00 X25.4 Y10.Never position to a feature with G00 — always a clearance plane first.
G01Linear feedStraight cut at feed rateG01 X25.4 Y10. F300F is per-minute feed. G01 cancels G00/G02/G03.
G02 / G03Circular feedArc CW (G02) / CCW (G03)G02 X10. Y10. I5. J0 F200I/J = arc centre offset from start. R format (G02 X.. Y.. R..) is simpler but ambiguous past 180°.
G04DwellPause for P millisecondsG04 P1000Used to let a spindle reach speed or a tool clean a hole bottom.
G17 / G18 / G19Plane selectXY / XZ / YZ work planeG17G17 (XY) is the default for most milling.
G20 / G21UnitsInch / metricG21G21 = mm. Confirm before running — the most common unit mistake is a missing G21.
G28Return homeRapid to machine referenceG28 G91 Z0G91 Z0 first lifts to the tool-change position, then rapids home.
G40 / G41 / G42Cutter compensationOff / left / rightG41 D1Comp is applied on a lead-in move ≥ tool radius; D holds the offset. G40 cancels.
G43 / G49Tool lengthCompensate / cancelG43 H1 Z10.H holds the length offset. Never cut without an active G43.
G54 – G59Work offsetsFixture coordinate systemsG54G54 is the primary fixture. A program with one part per fixture repeats on G55, G56…
G80Canned cycle cancelCancel drill/bore cyclesG80Always cancel after the cycle block or the next move will repeat the cycle.
G81Drill cycleSpot / through drillG81 X10. Y10. Z-12. R2. F150R = rapid plane above the part; Z = hole bottom.
G83Peck drill cycleDeep-hole peckingG83 X10. Y10. Z-40. R2. Q5. F120Q = peck depth per pass. Needed below ~3× diameter in most materials.
G84Tap cycleRigid tappingG84 X10. Y10. Z-15. R2. F450F must equal lead × spindle speed. Rigid tapping synchronises spindle and axis.
G90 / G91PositioningAbsolute / incrementalG90Absolute (G90) is the norm for CAM output; G91 appears inside cycles and at G28.
G94 / G95Feed modePer minute / per revolutionG94G95 (feed per rev) is standard for turning; milling posts usually emit G94.
M00 / M01Program stopFull stop / optional stopM00M01 stops only when the optional-stop switch is on — used for mid-program inspection.
M03 / M04 / M05SpindleCW / CCW / stopM03 S8000S = spindle speed (rev/min). Never reverse a spindle with the tool in the cut.
M06Tool changeExchange toolM06 T3Most machines require G28 or a safe Z before M06.
M08 / M09CoolantOn / offM08Flood (M08) vs mist (M07) is machine dependent.
M30Program endEnd + rewindM30Ends the program, returns to the top, clears modal state.

Modal codes (G00/G01, G90/G91, G21, cutter comp, work offsets) stay active until changed — a program is read top-down, so an early G21 or G90 without a later switch applies to the whole file. This is a Fanuc-style summary: check the control's own manual for dialect differences.

What is G-Code Reference Viewer

G-Code Reference Viewer is a searchable table of the twenty-one everyday G and M codes a milling-centre user actually sees in posted CAM output — the ISO 6983 / Fanuc-style dialect that dominates the industry. Each row gives the code, its group, its meaning, a worked example line, and the note that keeps people out of trouble: never position with G00, confirm G21 before running, always cancel a canned cycle with G80.
The table is deliberately the common core rather than the full control's vocabulary — rapid and feed motion, arcs, dwell, plane and unit selection, home return, cutter compensation, tool length, work offsets, the drill cycles, positioning and feed modes, spindle and coolant commands, stops and program end. The note reminds the reader that this is a Fanuc-style summary: dialects differ, and the control's own manual is the final authority.

How to Use G-Code Reference Viewer

  1. Step 1: Search by code (G83, M06) or by keyword (peck, coolant, offset) — the search filters the whole table including the meaning and notes columns.
  2. Step 2: Read the group column to see what kind of thing the code controls: motion, units, offsets, cycles, spindle, coolant, program flow.
  3. Step 3: Study the example line for the codes you are proving out — the argument structure of G81, the I/J offsets of G02, the Q peck of G83.
  4. Step 4: Heed the notes column when posting or editing: they carry the failure modes — no G00 to a feature, no cut without G43, cancel cycles after the last use.
  5. Step 5: Confirm the modal state of the whole program before running: an early G21 or G90 without a later switch applies to every line that follows.
Modal codes are the table's underlying theme: G00 and G01, G90 and G91, G21, cutter compensation and the work offsets all stay active until changed. Because a program is read top-down, a single G21 early in the file sets units for the entire program — which is why the units row carries the table's most repeated warning.

Why Use G-Code Reference Viewer

A CAM user's relationship with G-code is mostly reading, not writing: posted output has to be checked before it runs, and the check is only as good as the reader's command of the codes that appear in it. A reference that names each code's group, shows its argument structure in a real line, and states its failure mode turns the prove-out pass from decoding into verification.
The table also settles the disagreements that waste shop time — I/J versus R for arcs, when G95 is standard, what G28 actually does with G91 Z0 — by stating the convention and the reason for it in the same row. That makes it a useful teaching reference as well as a lookup: the example lines are written the way posted code actually reads.

Privacy & Security

This tool runs entirely in your browser — no data ever leaves your device. There is no server round-trip, no upload, no logging, and no account required. Your input is processed locally using client-side JavaScript and is never stored, transmitted, or accessible to anyone else. When you close the tab, everything disappears.

Frequently Asked Questions

What does it mean for a code to be modal?

A modal code stays active until another code in its group replaces it, rather than applying to only the line it appears on. The motion group is the clearest example: once G01 is commanded, every subsequent coordinate move cuts at feed rate until G00 or G02 or G03 appears. The same applies to positioning mode (G90 absolute versus G91 incremental), units (G20 inch versus G21 metric), cutter compensation and the work offsets. Reading a program means tracking modal state line by line, because an early modal setting governs the whole rest of the file.

When should an arc use I/J offsets instead of the R format?

I and J specify the arc centre as offsets from the start point, which is unambiguous: the centre is exactly one position. The R format (G02 X.. Y.. R..) lets the control compute the centre from the radius, but a given radius and endpoint admit two arcs — one going one way, one the other — and past 180 degrees the ambiguity becomes a real problem. Posted CAM output for milling normally uses I/J, and the R format is best reserved for simple, small arcs where the direction is obvious.

Why must a canned cycle be cancelled with G80?

The drill cycles G81, G83 and G84 are modal — once commanded, the control repeats the cycle at every subsequent position block until something cancels it. G80 cancels the cycle so the next motion block behaves as a normal move. Leaving a cycle active is a classic source of surprise holes: a positioning block after the cycle gets drilled instead of moved to. The table's rule is to cancel immediately after the cycle's last use.

Why is a missing G21 the most common unit mistake?

Because units are modal and inherited from program state, not from the drawing. If a program never issues G21, the control keeps whatever unit mode was active from the previous program or from setup — often inch. A 10-millimetre hole posted without G21 machines as a 10-inch feature, or vice versa. The table's warning to confirm G21 before running is the cheapest possible insurance against a unit error that would otherwise scrap the first part.