Cross-control comparison of the G and M codes supported by LinuxCNC, GRBL (1.1), Centroid (CNC12 — Acorn / Allin1DC / Oak; mill unless called out), FANUC (0i / 30i, mill-focused with lathe specifics flagged), Mach 3 (Mill Rev 1.84-A2), and Mach 4 (Mill v1.0).
Legend for the support columns:
- Y — supported, behaves as the "Purpose" column describes
- N — not supported (sending the code is an error or silently ignored)
- P — partial / supported with notable differences (see Notes)
- ? — could not verify against a public source; treat as unknown
Caveat: every manufacturer's manual wins over this chart. FANUC behavior varies between 0i / 16i / 30i and between mill (M-series) and lathe (T-series). The "FANUC" column below describes mill behavior unless noted.
Read the Divergent codes section before porting between platforms. Some codes have the same number on every control but do completely different things depending on the platform or mode. Those traps are called out in their own section after the main tables — they're the most common source of "this worked on my lathe, why is it crashing on the mill" surprises.
Sources used for fact-checking are listed at the bottom of this doc.
#G-codes
#Motion & interpolation
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G00 | Rapid positioning | Y | Y | Y | Y | Y | Y | Non-cutting traverse at machine max rate |
| G01 | Linear feed move | Y | Y | Y | Y | Y | Y | Feed-controlled cut; requires F |
| G02 | Clockwise arc (in active plane) | Y | Y | Y | Y | Y | Y | I/J/K center offsets or R radius |
| G03 | Counter-clockwise arc | Y | Y | Y | Y | Y | Y | Same conventions as G02 |
| G04 | Dwell | Y | Y | Y | Y | Y | Y | Mach3/4: decimal P = seconds, integer P = milliseconds (explicitly documented for Mach4) |
| G05 | Spline / NURBS / HSM look-ahead | P | N | N | Y | N | N | LinuxCNC: G5 cubic spline. FANUC: G05.1 Q1 AI contour on, Q0 off. Some 30i-B use G05.4. Older FANUC: G08 P1 |
| G07 | Imaginary axis designation | N | N | N | Y | N | N | FANUC cylindrical/polar interpolation prep |
| G09 | Exact stop (non-modal) | Y | N | Y | Y | Y | Y | One-shot version of G61 |
| G10 | Programmable data input | Y | P | Y | Y | Y | Y | LinuxCNC/GRBL: G10 L2/L20 for work offsets. Mach4: must be closed by G11. Centroid CNC12: rich L-value set (see Macro section below) plus a no-L G10 P_ R_ form for setting internal parameters like the G73/G83 peck-retract distance |
| G12 | Full-circle CW (from current pos as center) | N | N | N | N | P | Y | Mach4 documented; Mach3 partial |
| G13 | Full-circle CCW | N | N | N | N | P | Y | Same as G12 sense reversed |
| G15 | Polar coordinates off | N | N | N | Y | N | Y | Mach4 supports polar; Mach3 does not |
| G16 | Polar coordinates on | N | N | N | Y | N | Y | Encodes X as radius, Y as angle; plane-aware on Mach4 |
| G31 | Probe (FANUC-style) | Y | N | Y | Y | Y | Y | FANUC syntax: G31 P1-P4 for multi-step skip. Mach4 adds G31.0–G31.3 for multiple probe inputs |
| G32 | Threading (single block) | N | N | N | N | P | Y | Mach4 documented; disables overrides while cutting |
| G33 | Synchronous threading (constant pitch) | Y | N | P | Y | N | N | FANUC lathe primarily; Centroid optional |
| G33.1 | Rigid tapping (LinuxCNC) | Y | N | N | N | N | N | LinuxCNC-specific; FANUC uses G84 rigid mode |
| G38.2 | Probe toward, error if no contact | Y | Y | Y | N | N | N | FANUC uses G31 instead |
| G38.3 | Probe toward, no error if no contact | Y | Y | Y | N | N | N | |
| G38.4 | Probe away, error if still in contact | Y | Y | P | N | N | N | |
| G38.5 | Probe away, no error | Y | Y | P | N | N | N |
#Planes & coordinate frames
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G17 | XY plane select | Y | Y | Y | Y | Y | Y | Default; arcs in I/J |
| G18 | ZX plane select | Y | Y | Y | Y | Y | Y | Arcs in I/K |
| G19 | YZ plane select | Y | Y | Y | Y | Y | Y | Arcs in J/K |
| G52 | Local coordinate offset | Y | N | Y | Y | Y | Y | Temporary frame shift on top of active WCS |
| G53 | Move in machine coords (non-modal) | Y | Y | Y | Y | Y | Y | One-shot machine-frame move |
| G54 | Work coord system 1 | Y | Y | Y | Y | Y | Y | Default WCS after power-on (most controls) |
| G55 | Work coord system 2 | Y | Y | Y | Y | Y | Y | |
| G56 | Work coord system 3 | Y | Y | Y | Y | Y | Y | |
| G57 | Work coord system 4 | Y | Y | Y | Y | Y | Y | |
| G58 | Work coord system 5 | Y | Y | Y | Y | Y | Y | |
| G59 | Work coord system 6 | Y | Y | Y | Y | Y | Y | |
| G59.1 | WCS 7 | Y | N | Y | N | Y | Y | LinuxCNC / Centroid / Mach. FANUC uses G54.1 P1+ instead |
| G59.2 | WCS 8 | Y | N | Y | N | Y | Y | |
| G59.3 | WCS 9 | Y | N | Y | N | Y | Y | |
| G54.1 | Extended WCS (P-addressed bank) | N | N | P | Y | N | Y | FANUC: P1–P48 (0i) or P1–P300 (30i). Mach4: P1–P248. Mach3 has no extended bank — 9 fixtures total |
| G92 | Set position (coord offset) | Y | Y | Y | Y | Y | Y | FANUC has G92.1 / G92.2 to clear or restore; Mach has G92.1 |
#Units, distance & feed modes
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G20 | Programming units = inches | Y | Y | Y | Y | Y | Y | |
| G21 | Programming units = millimeters | Y | Y | Y | Y | Y | Y | |
| G90 | Absolute distance mode | Y | Y | Y | Y | Y | Y | |
| G91 | Incremental distance mode | Y | Y | Y | Y | Y | Y | |
| G90.1 | Absolute arc-center mode | Y | N | P | N | Y | Y | I/J/K become absolute coords (not offsets) |
| G91.1 | Incremental arc-center mode (default) | Y | Y | Y | Y | Y | Y | |
| G93 | Inverse-time feed mode | Y | Y | Y | Y | Y | Y | F = 1/minutes; required for some rotary moves |
| G94 | Units-per-minute feed | Y | Y | Y | Y | Y | Y | Default on mills. On FANUC lathe G94 ≠ feed/min — use G98 there |
| G95 | Units-per-revolution feed | Y | N | Y | Y | Y | Y | On FANUC lathe G95 ≠ feed/rev — use G99 there |
| G96 | Constant surface speed (lathe) | Y | N | P | Y | P | Y | S in m/min (G21) or sfm (G20) |
| G97 | Constant spindle RPM (cancel CSS) | Y | N | P | Y | P | Y | |
| G98 | Mill: canned-cycle return to initial Z | Y | N | Y | Y | Y | Y | FANUC lathe: feed per minute — completely different meaning |
| G99 | Mill: canned-cycle return to R-level | Y | N | Y | Y | Y | Y | FANUC lathe: feed per revolution |
#Tool length / cutter compensation
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G40 | Cutter compensation OFF | Y | Y | Y | Y | Y | Y | Default state |
| G40.1 | Cutter-comp corner style: arc rounded | N | N | N | N | N | Y | Mach4 only |
| G40.2 | Cutter-comp corner style: square | N | N | N | N | N | Y | Mach4 only |
| G41 | Cutter comp left of path | Y | N | Y | Y | Y | Y | D word selects offset register |
| G42 | Cutter comp right of path | Y | N | Y | Y | Y | Y | |
| G41.1 | Dynamic cutter comp left | Y | N | N | N | N | N | LinuxCNC: D in source instead of register |
| G42.1 | Dynamic cutter comp right | Y | N | N | N | N | N | LinuxCNC-only |
| G43 | Tool length offset (positive, from H register) | Y | N | Y | Y | Y | Y | H word selects TLO register |
| G43.1 | Dynamic TLO (offset in source, not register) | Y | Y | N | N | N | N | LinuxCNC / GRBL |
| G44 | TLO negative | N | N | P | Y | N | N | Rarely used; FANUC-style only |
| G49 | Cancel TLO | Y | Y | Y | Y | Y | Y |
#Canned cycles (drilling / boring / tapping)
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G73 | High-speed peck drilling | Y | N | Y | Y | Y | Y | Short retract between pecks |
| G74 | Counter-tapping (left-hand) — mill | Y | N | Y | Y | Y | Y | FANUC lathe: face grooving cycle — different meaning |
| G76 | Fine boring (mill) | N | N | P | Y | Y | Y | FANUC lathe: threading cycle (Type I or Type II) — different meaning |
| G80 | Cancel canned cycle | Y | Y | Y | Y | Y | Y | Required to exit drill/bore modes |
| G81 | Standard drilling | Y | N | Y | Y | Y | Y | Z down at feed, rapid out |
| G82 | Drilling with dwell at bottom | Y | N | Y | Y | Y | Y | Spot / counterbore use |
| G83 | Peck drilling (full retract) | Y | N | Y | Y | Y | Y | Q = peck depth |
| G84 | Right-hand tapping | Y | N | Y | Y | P | Y | Mach3 needs OEM plugin for rigid tap |
| G84.2 | Rigid RH tap | N | N | N | N | N | Y | Mach4 |
| G84.3 | Rigid LH tap | N | N | N | N | N | Y | Mach4 |
| G85 | Boring (feed in, feed out) | Y | N | Y | Y | Y | Y | |
| G86 | Boring (feed in, stop, rapid out) | N | N | ? | Y | Y | Y | Centroid: unverified across CNC12 versions |
| G87 | Back boring | N | N | ? | Y | Y | Y | |
| G88 | Boring with manual retract | N | N | ? | Y | Y | Y | |
| G89 | Boring with dwell (feed out) | Y | N | Y | Y | Y | Y |
#Lathe-specific (FANUC T-series convention)
These are FANUC T-series codes. Centroid M-series (mill) does not implement them; Centroid T-series (lathe) does. Mach3/4 Mill don't; Mach4 Turn does some. LinuxCNC supports its own lathe set.
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G7 | Diameter mode (LinuxCNC lathe) | Y | N | N | N | N | N | |
| G8 | Radius mode (LinuxCNC lathe) | Y | N | N | N | N | N | |
| G50 | Spindle max RPM clamp (lathe) | P | N | P | Y | P | Y | FANUC lathe: G50 X Z sets work coords; G50 S____ clamps RPM. Mill: scaling cancel |
| G70 | Finishing turning cycle | N | N | T-only | Y | N | P | Uses profile defined by G71/G72 |
| G71 | Stock-removal turning, longitudinal | N | N | T-only | Y | N | P | FANUC: Type I (single-block) or Type II (multi-block P/Q/R) — different parameter syntax |
| G72 | Stock-removal turning, facing | N | N | T-only | Y | N | P | Type I / Type II split same as G71 |
#Coordinate rotation, scaling, mirror
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G50 | Scaling OFF (mill) | N | N | P | Y | Y | Y | See lathe table — same code has lathe meaning too |
| G51 | Scaling ON (mill) | N | N | P | Y | Y | Y | P/I/J/K = scale factors. Mach4 manual warns arc scaling can be unpredictable |
| G50.1 | Mirror image OFF | N | N | P | Y | N | N | Newer Centroid CNC12 only |
| G51.1 | Mirror image ON | N | N | P | Y | N | N | |
| G68 | Coord rotation on | Y | N | Y | Y | Y | Y | Rotates the active plane around a center; XY plane only on Mach3/4 |
| G69 | Coord rotation off | Y | N | Y | Y | Y | Y |
#Motion behavior / blending
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G61 | Exact stop modal | Y | Y | Y | Y | Y | Y | Decelerates fully at every endpoint |
| G61.1 | Exact stop (variant) | Y | N | N | N | Y | Y | |
| G64 | Path blending / continuous mode | Y | Y | Y | P | Y | Y | LinuxCNC: G64 P |
| G05.1 | AI contour control / HPCC | N | N | N | Y | N | N | FANUC look-ahead; Q1 on, Q0 off |
| G05.4 | Nano smoothing / HPCC variant | N | N | N | P | N | N | Some FANUC 30i-B |
| G08 | Look-ahead acc/dec enable | N | N | N | Y | N | N | Older FANUC; G08 P1 on, G08 P0 off |
#Reference returns
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G27 | Reference-position check | N | N | N | Y | N | N | FANUC-only; verifies machine is at home |
| G28 | Return to reference position (home) | Y | Y | Y | Y | Y | Y | GRBL/Mach: pre-defined position stored |
| G28.1 | Set G28 reference (GRBL / LinuxCNC / Mach) | Y | Y | N | N | Y | Y | |
| G29 | Return from reference | Y | N | Y | Y | Y | Y | Via intermediate point |
| G30 | Return to secondary reference | Y | Y | Y | Y | Y | Y | |
| G30.1 | Set G30 reference | Y | Y | N | N | Y | Y |
#Macro / subroutine / data
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| G65 | Macro call (one-shot) | P | N | Y | Y | N | Y | LinuxCNC uses O-codes. Centroid: L = repeat count, not feed. Mach4: macro file must be .nc extension; A–Z args map to #1–#26 |
| G66 | Modal macro call | N | N | ? | Y | N | Y | Centroid macro PDF references modal-style macros but exact G66/G67 syntax not verified |
| G67 | Cancel modal macro | N | N | ? | Y | N | Y | |
| G10 L1 | Set tool-table entry directly (length/radius) | P | N | Y | Y | Y | Y | P = tool number, R = value. Centroid documents this in CNC12 |
| G10 L2 | Set work offset value (absolute) | Y | Y | Y | Y | Y | Y | P1=G54 … P6=G59. Active WCS does not have to match P |
| G10 L10 | Set tool length so current pos = entered value | P | N | Y | Y | Y | Y | Centroid CNC12 documents L10/L11/L12/L13 family |
| G10 L11 | Set tool length wear | N | N | Y | P | P | P | Centroid CNC12 explicit; varies on others |
| G10 L12 | Set tool radius | N | N | Y | P | P | P | |
| G10 L13 | Set tool radius wear | N | N | Y | P | P | P | |
| G10 L20 | Set work offset so current pos = entered value | Y | Y | Y | Y | Y | Y | "Set to here" form. Modal/non-modal: G10 is non-modal (Group 0) on all controls |
| G10 P_ R_ | Set internal control parameter (Centroid) | N | N | Y | N | N | N | Centroid-specific. E.g. G10 P73 R0.02 configures G73 peck-retract before the cycle call. Same pattern for G83 |
| O-codes | Named/numbered subroutines | Y | N | N | N | N | N | LinuxCNC's subroutine model — o100 sub / o100 endsub / o100 call |
#M-codes
#Program flow
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M00 | Compulsory program stop | Y | Y | Y | Y | Y | Y | Cycle-start to resume |
| M01 | Optional stop | Y | Y | Y | Y | Y | Y | Skipped unless OSTOP switch on |
| M02 | Program end | Y | Y | Y | Y | Y | Y | No rewind; modal state stays |
| M30 | Program end + rewind | Y | Y | Y | Y | Y | Y | Most CAM emits this at file end |
| M47 | Re-run program from start | N | N | N | N | Y | P | Mach-specific |
| M60 | Pallet change & stop | Y | N | N | Y | N | N | Multi-pallet machines only |
| M98 | Call subprogram | N | N | Y | Y | Y | Y | LinuxCNC uses O-codes. FANUC/Centroid/Mach: PMach3\subroutines\ |
| M99 | Return from subprogram / end of macro | N | N | Y | Y | Y | Y | |
| M1000/M1001 | Alternate mandatory / optional stop | N | N | N | N | N | Y | Mach4 only |
#Spindle
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M03 | Spindle on, clockwise | Y | Y | Y | Y | Y | Y | S word sets speed |
| M04 | Spindle on, counter-clockwise | Y | Y | Y | Y | Y | Y | GRBL laser mode: dynamic power |
| M05 | Spindle stop | Y | Y | Y | Y | Y | Y | |
| M19 | Spindle orient (oriented stop) | N | N | Y | Y | P | Y | Mach3: depends on builder VBScript |
#Coolant
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M07 | Mist coolant on | Y | Y | Y | Y | Y | Y | |
| M08 | Flood coolant on | Y | Y | Y | Y | Y | Y | |
| M09 | All coolant off | Y | Y | Y | Y | Y | Y |
#Tool change
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M06 | Tool change | Y | N | Y | Y | Y | Y | Pairs with prior Tn. GRBL pauses and prompts |
| M61 | Set current tool number (no change) | Y | N | N | N | N | N | LinuxCNC: declares loaded tool without a swap |
#Feed / spindle override
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M48 | Enable feed & speed overrides | Y | N | N | Y | Y | Y | |
| M49 | Disable feed & speed overrides | Y | N | N | Y | Y | Y | Often used inside tapping cycles |
| M50 | Feed override control (P0=off, P1=on) | Y | N | N | N | N | N | LinuxCNC granular control |
| M51 | Spindle override control | Y | N | N | N | N | N | |
| M52 | Adaptive feed control | Y | N | N | N | N | N | |
| M53 | Feed-stop control | Y | N | N | N | N | N |
#I/O & probing helpers
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M62 | Set digital output, synchronized with motion | Y | N | P | N | P | Y | Mach3: typically routed through OEM scripts; Mach4 native |
| M63 | Clear digital output, synchronized with motion | Y | N | P | N | P | Y | |
| M64 | Set digital output immediately | Y | N | P | N | P | Y | |
| M65 | Clear digital output immediately | Y | N | P | N | P | Y | |
| M66 | Wait for input | Y | N | P | N | P | Y | Mach4: P<input> L<timeout-sec> |
| M67 | Synchronized analog output | Y | N | N | N | N | P | |
| M68 | Immediate analog output | Y | N | N | N | N | P | |
| M100 | PLC-bit wait (Centroid) / user script (LinuxCNC, Mach) | varies | N | varies | N | varies | varies | Means completely different things per control — see Divergent codes |
| M101 | PLC-bit wait (Centroid) / user script (LinuxCNC, Mach) | varies | N | varies | N | varies | varies | Paired with M100 — see Divergent codes |
| M102–M199 | User-script slots (LinuxCNC) / partly reserved (Centroid) | varies | N | varies | N | varies | varies | LinuxCNC reserves whole range for user scripts; Centroid has additional builtin meanings — check before assuming a slot is free |
| M200–M219 | Direct output bit on/off pairs | N | N | N | N | N | Y | Mach4 |
| M220–M224 | Generalized output/input macros | N | N | N | N | N | Y | Mach4 |
| M228 | Park | N | N | N | N | N | Y | Mach4 |
#Modal state (LinuxCNC-specific)
| Code | Purpose | LinuxCNC | GRBL | Centroid | FANUC | Mach3 | Mach4 | Notes |
|---|---|---|---|---|---|---|---|---|
| M70 | Save modal state | Y | N | N | N | N | N | |
| M71 | Invalidate stored state | Y | N | N | N | N | N | |
| M72 | Restore modal state | Y | N | N | N | N | N | Pairs with M70 |
| M73 | Save autoreturn modal state | Y | N | N | N | N | N | Restored on subroutine end |
#User-defined / scripting
| Code | Mechanism | Notes |
|---|---|---|
LinuxCNC M100–M199 |
External script file (any executable) in config dir | Filename matches the M number; called like any other M-code. Collides with Centroid's reserved M100/M101 PLC-wait codes — same number, completely different behavior |
| FANUC custom M-codes | Custom macros via G65 / G66 macro calls or PMC ladder |
Machine-builder-specific |
| Centroid custom M-codes | CNC12 macro programs invoked via G65 |
Section 12.24 of the Mill operator's manual; full Macro-B style #-variables, IF/WHILE/DO |
| Mach3 custom M-codes | VBScript files named Mxx.M1S in Mach3\macros\<profile>\ |
Param1(), Param2(), Param3() read P/Q/S from the M-code call line |
| Mach4 custom M-codes | Lua scripts (ZeroBrane debugger supported) | Mach3 .M1S macros do not port — full rewrite required |
#Divergent codes — same number, different meaning
Most codes in the tables above behave the same way across all platforms that support them, or differ only in minor details captured in the Notes column. The codes in this section are different: the same number does fundamentally different things on different controls or modes, and a program that runs cleanly on one will produce wrong output (or worse, a crash) on another.
If you're porting G-code between platforms, this is the section to read twice.
#M100 / M101 — PLC-bit wait vs user-script slot
A FANUC-trained operator and a Centroid-trained operator will write
M100 for two completely incompatible reasons.
| Control | M100 | M101 |
|---|---|---|
| Centroid CNC12 | Pause program until referenced PLC bit / input is open (off / 0). Pair with M101. Custom prompt via cncxmsg.txt |
Pause until PLC bit is closed (on / 1) |
| LinuxCNC | Runs external user-script file named M100 from config dir (the whole M100–M199 range is reserved this way) |
Runs user-script M101 |
| FANUC | Not assigned in the standard. Typically machine-builder-defined via PMC ladder | Same |
| Mach 3 | Free slot — runs M100.M1S VBScript macro if present, otherwise undefined |
Same for M101.M1S |
| Mach 4 | Free slot — runs M100.mcs Lua macro if present, otherwise undefined |
Same for M101.mcs |
| GRBL | Not supported | Not supported |
Portability impact: A Centroid program using M100 /5000 to wait on
a vacuum-ready PLC signal will, on LinuxCNC, try to execute an external
script literally named M100 — completely different runtime. On a stock
Mach3 install with no M100.M1S written, the same line silently does
nothing. Always rewrite explicit PLC waits when moving between controls.
#G98 / G99 — canned-cycle return (mill) vs feed mode (FANUC lathe)
The single biggest mill-vs-lathe trap on FANUC.
| Control / mode | G98 | G99 |
|---|---|---|
| FANUC mill | Canned-cycle return to initial Z | Canned-cycle return to R-plane |
| FANUC lathe (T-series) | Feed per minute (the role G94 plays on the mill) | Feed per revolution (the role G95 plays on the mill) |
| LinuxCNC (mill or lathe) | Canned-cycle return to initial Z | Canned-cycle return to R-plane |
| Centroid CNC12 (mill) | Canned-cycle return to initial Z | Canned-cycle return to R-plane |
| Mach 3 / Mach 4 | Canned-cycle return to initial Z | Canned-cycle return to R-plane |
Portability impact: A FANUC T-series lathe program that sets G98
expecting feed-per-minute will, on every other platform here, be parsed
as a canned-cycle return-mode change. The lathe-feed-mode interpretation
is FANUC-T-series-exclusive.
#G50 — three completely different meanings depending on platform/mode
| Control / mode | G50 |
|---|---|
| FANUC mill | Scaling OFF (cancels G51) |
| FANUC lathe | Two distinct sub-uses on the same control: G50 X_ Z_ sets work-coord origin; G50 S_____ clamps maximum spindle RPM under G96 CSS mode |
| Mach 3 / Mach 4 | Scaling OFF (mill) |
| LinuxCNC | Not implemented (LinuxCNC does not support FANUC-style G50/G51 scaling) |
| Centroid CNC12 mill | Partial scaling-off support; varies across CNC12 versions |
| Centroid CNC12 lathe (T-series) | Follows FANUC lathe convention |
| GRBL | Not supported |
Portability impact: A FANUC lathe program that issues G50 S3000 to
cap a CSS-driven spindle will be a no-op or error on mill controls,
because the mill-side G50 takes no S word.
#G74 — counter-tapping (mill) vs face grooving (FANUC lathe)
| Control / mode | G74 |
|---|---|
| FANUC mill | Left-hand (counter) tapping canned cycle |
| FANUC lathe | Face grooving / peck face turning cycle |
| LinuxCNC | Left-hand tapping (mill) |
| Centroid CNC12 mill | Left-hand tapping |
| Centroid CNC12 lathe (T-series) | Face grooving |
| Mach 3 / Mach 4 | Left-hand tapping (mill) |
| GRBL | Not supported |
Portability impact: Same code, same control vendor (FANUC), totally different machining operation depending on whether the control is a mill or a lathe. Posts targeting a lathe always assume the FANUC lathe meaning.
#G76 — fine boring (mill) vs threading (FANUC lathe)
| Control / mode | G76 |
|---|---|
| FANUC mill | Fine boring cycle (oriented spindle stop at bottom, retract by shift amount to avoid scoring the wall) |
| FANUC lathe | Multi-pass threading cycle — Type I (older single-block syntax) or Type II (modern multi-block P_ Q_ R_ syntax). The block layout is completely different from the mill version |
| LinuxCNC mill | Not supported |
| LinuxCNC lathe | Threading cycle |
| Centroid CNC12 mill | Partial — verify against the specific control version |
| Centroid CNC12 lathe (T-series) | Threading cycle |
| Mach 3 / Mach 4 mill | Fine boring |
| GRBL | Not supported |
Portability impact: A lathe-threading G76 block has a completely different argument list than a mill-boring G76 block. They are not interchangeable.
#G05 / G05.1 / G05.4 — different high-speed look-ahead implementations
| Control | G05 family |
|---|---|
| FANUC | G05.1 Q1 = AI contour control on; G05.1 Q0 = off. Some 30i-B variants use G05.4. Older controls use G05 (no decimal) or G08 P1 for the same look-ahead/acceleration smoothing |
| LinuxCNC | G5 (no decimal) = cubic spline interpolation — a totally different operation, not a HSM look-ahead toggle |
| Centroid / Mach 3 / Mach 4 / GRBL | Not supported |
Portability impact: Same number, completely different math. A
LinuxCNC G5 block defines a spline curve through control points; a
FANUC G05 toggles a look-ahead acceleration mode. Output is unrelated.
#Quick differences cheat sheet
GRBL intentionally omits canned cycles, cutter comp, polar coords, scaling, rotation, macros, and subprograms. CAM posts targeting GRBL expand cycles into raw G01 moves and skip G41/G42 entirely.
FANUC is the lineage everyone else copies, but it's where most divergence happens at the high end. The single biggest cross-control trap: G98/G99 are canned-cycle return modes on the mill, but feed-mode modes on the lathe. G50, G70–G76 also reassign on lathe. High-speed machining options (G05.1, G05.4, G08, G64 tuning) vary by controller generation and machine builder.
LinuxCNC is closest to a clean superset of standard RS-274/NGC. It adds first-class probing variants (G38.2–G38.5), digital/analog HAL I/O M-codes (M62–M68), user-defined M100–M199 scripts, and uses O-codes for subroutines rather than FANUC-style M98/M99.
Centroid (CNC12) is mostly FANUC-compatible for the canonical drill, bore, and macro codes. Macro programming uses FANUC Macro-B style (#-vars, IF/WHILE/DO). G70–G76 lathe cycles only apply on T-series. G87/G88 back-bore and modal-macro G66/G67 support varies across CNC12 versions and could not be fully verified for this chart.
Mach 3 is the lowest-feature commercial control here — no G65 macros
(custom M-codes are VBScript .M1S files instead), no polar coordinates,
no extended fixture offsets beyond G59.3, no G31 multi-probe. M62–M66
typically need OEM scripts rather than working natively. Subroutines via
M98/M99 work.
Mach 4 is a substantial superset of Mach 3: adds G65 macros (with
.nc macro-file extension required), G54.1 P1–P248 extended fixtures,
G31.0–G31.3 multi-probe, G12/G13 full-circle, polar coords, G84.2/G84.3
rigid tap, G40.1/G40.2 cutter-comp corner styles, native M62–M68 I/O,
and an M200–M228 family. Lua replaces VBScript for custom M-codes —
Mach3 macros do not port directly.
#How this app handles non-supported codes
G54.APP's parser is permissive — unrecognized G or M codes are kept
verbatim in the source and just don't affect the visualization. So a
file written for FANUC with G68 rotation or M98 subprogram calls
will render the linear/arc moves it does understand and silently skip
the rest. Always sanity-check the simulation against the target control's
expected behavior before cutting.
#Sources
These are the public references consulted while building this chart. Vendor manuals (FANUC, Centroid) ship with the controller and may not be publicly archived; where a vendor PDF was used, the URL is the one that served at the time of writing.
LinuxCNC (free, online):
- G-code quick reference — https://linuxcnc.org/docs/html/gcode/g-code.html
- M-code quick reference — https://linuxcnc.org/docs/html/gcode/m-code.html
- Main user manual — https://linuxcnc.org/docs/
GRBL 1.1 (open source):
- Supported commands wiki — https://github.com/gnea/grbl/wiki/Grbl-v1.1-Commands
commands.mdsource-of-truth — https://github.com/gnea/grbl/blob/master/doc/markdown/commands.md
Centroid CNC12 (vendor PDFs):
- Macro Programming guide — https://www.centroidcnc.com/centroid_diy/downloads/acorn_documentation/centroid_cnc_macro_programming.pdf
- M-Series (Oak / Allin1DC) Operator's Manual v4.14 — https://www.centroidcnc.com/centroid_diy/downloads/CNC12-v414_operator_manuals/centroid-cnc12-oak-allin1dc-mill-operator-manual-v4.14.pdf
- v3.16 Mill Operator Manual — https://www.centroidcnc.com/downloads/centroid_v3.16_mill_operator_manual.pdf
- G and M codes extract — https://www.centroidcnc.com/centroid_diy/downloads/centroid_G_and_M_codes.pdf
- PLC + CNC Functions Programming Manual (CNC12 v5.x+) — https://www.centroidcnc.com/centroid_diy/downloads/centroid_plc_programming_manual.pdf
- Helman CNC mirror of Centroid Mill M-code list — https://www.helmancnc.com/centroid-m-code-cnc-mill/
- Centroid forum post on G10 P/R parameter-setting form — https://centroidcncforum.com/viewtopic.php?t=3429
FANUC (third-party aggregators of vendor manuals; vendor PDFs are generally not freely hosted):
- FanucWorld "Ultimate M-Code & G-Code List for Fanuc Controls" — https://content.fanucworld.com/m-code-g-code-list/
- REACO CNC FANUC Machining Center G/M codes — https://reacocnc.com/blogs/fanuc-g-code-m-code-list/g-code-m-code-machining-center
- REACO CNC FANUC CNC Lathe G/M codes — https://reacocnc.com/blogs/fanuc-g-code-m-code-list/g-code-m-code-lathe
- Helman CNC "Fanuc 31i G Codes Machining Center" — https://www.helmancnc.com/fanuc-31i-g-codes-machining-center-fanuc-30i-31i-32i/
- Cross-checked against: FANUC Series 0i-MD Operator's Manual, FANUC Series 30i/31i/32i-MODEL B Operator's Manual, FANUC Macro Compiler / Macro Executor Programming Manual (titles only — these are not openly hosted)
Mach 3 (ArtSoft / MachMotion):
- MachMotion "G and M-code Reference Using Mach3Mill Rev 1.84-A2" — https://machmotion.com/documentation/Software/Mach3/Mach3%20GCode%20Language%20Reference.pdf
- Mach3 G-Code Manual (MachMotion) — https://machmotion.com/documentation/Software/Mach3/Mach3%20G-Code%20Manual.pdf
- Mach3 V3.x Macro Programmer's Reference (ArtSoft) — https://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf
- Helman CNC "Mach3 Mill G Code List" — https://www.helmancnc.com/mach3-mill-g-code-list/
- CNCCookbook on Mach3 + G65 — https://www.cnccookbook.com/m98-m99-g-code-cnc-subprograms/
Mach 4 (ArtSoft / MachMotion):
- Mach4 Mill GCode Manual v1.0 (ArtSoft) — https://www.machsupport.com/wp-content/uploads/2014/05/Mach4%20Mill%20GCode%20Manual.pdf
- MachMotion Mach4 G & M Code Reference Manual — https://machmotion.com/documentation/Software/Mach4/Mach4-G-and-M-Code-Reference-Manual.pdf
- MachMotion BookStack Mach4 G/M Code Reference — https://support.machmotion.com/books/software/page/mach4-g-code-and-m-code-reference
- Mach4 Lathe Programming Guide — https://www.machsupport.com/wp-content/uploads/2014/05/Mach4%20Lathe%20GCode%20Manual.pdf
- Warp9 Mach3 vs Mach4 FAQ — https://www.warp9td.com/index.php/faq/faq-g-code-m-code
#Known unverifiable / uncertain entries
These are marked ? in the support columns above:
- Centroid G66 / G67 (modal macro call/cancel) — Centroid's macro PDF references modal-style macros, but neither the search snippets nor the WebFetch text extracts produced an explicit G66/G67 syntax page. Treat these as unknown rather than confirmed.
- Centroid G86 / G87 / G88 boring variants — listed inconsistently across CNC12 versions. The canonical list confirmed in the manuals is G81–G85 and G89. Verify against the specific control before relying.
- FANUC G05.4 nano smoothing — present on some 30i-B variants, not universal across the 30i family.