G54.APP

G54.APP reference

G-code & M-code Reference by Operation: LinuxCNC, GRBL, Centroid, FANUC, Mach 3, Mach 4, Haas

A cross-control G-code and M-code reference grouped by what you want to do — feed moves, arc moves, probing, drilling cycles, work offsets — with the exact code each control uses in every cell. Toggle off the controls you don't run, and watch out for the false friends: codes that share a number across platforms but do completely different things.

Open the G-code viewer → Free, runs in your browser. Drag in a .nc or .gcode file to visualize toolpaths and simulate stock removal in real time.

A cross-control G-code and M-code reference, organized by operation — what you actually want the machine to do — rather than by code number. Each row is one operation (a feed move, an arc, a probe, a drilling cycle, a work-offset select…) and each control's column shows the exact code that control uses for it.

Covers 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), Mach 4 (Mill v1.0), and Haas (mill, current control). Haas is Fanuc-compatible at its core — G0–G3, planes, units, G54–G59, and the G81–G89 canned cycles match — but it layers on proprietary codes (G12/G13 pocket milling, G150 general pocket, G154 P1–P99 fixtures, G187 smoothness) and reuses a few numbers differently (G70–G72 are bolt-hole patterns on a Haas mill).

How to read the tables:

Sources used for fact-checking are listed at the bottom of this doc.


Codes by operation

Show controls:

Motion & interpolation

The moves that actually cut. These are the most portable codes — G0–G3 mean the same thing on every control here.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Rapid positioningdetails → G0 G0 G0 G0 G0 G0 G0 Non-cutting traverse at the machine's max rate.
Linear feed movedetails → G1 G1 G1 G1 G1 G1 G1 Feed-controlled straight cut; requires an F word.
Clockwise arc / helixdetails → G2 G2 G2 G2 G2 G2 G2 I/J/K center offsets or R radius, in the active plane. Add a Z move for a helix.
Counter-clockwise arc / helixdetails → G3 G3 G3 G3 G3 G3 G3 Same conventions as the CW arc, opposite direction.
Dwell (pause)details → G4 G4 G4 G4 G4 G4 G4 Mach3/4: decimal P = seconds, integer P = milliseconds.
Full-circle CW (current pos as center)details → G12 G12 G12 Mach3: partial Haas: Circular Pocket Milling CW
Full-circle CCWdetails → G13 G13 G13 Mach3: partial Haas: Circular Pocket Milling CCW
Cubic-spline interpolation G5 LinuxCNC only. NOT the same as FANUC G5 (look-ahead) — see the false-friends note. LinuxCNC: G5 = cubic spline through control points
Imaginary-axis designation G7.1 FANUC cylindrical / polar interpolation prep.
Uni-directional positioning (Haas) G60 Approaches each point from one direction to take up backlash.

Plane selection

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Select XY planedetails → G17 G17 G17 G17 G17 G17 G17 Default. Arcs use I/J.
Select ZX planedetails → G18 G18 G18 G18 G18 G18 G18 Arcs use I/K.
Select YZ planedetails → G19 G19 G19 G19 G19 G19 G19 Arcs use J/K.

Work coordinates & offsets

Where the part zero lives. Extended fixtures past the first six are where the controls diverge the most.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Select work coord system 1–6details → G54 / G55 / G56 / G57 / G58 / G59 G54 / G55 / G56 / G57 / G58 / G59 G54 / G55 / G56 / G57 / G58 / G59 G54 / G55 / G56 / G57 / G58 / G59 G54 / G55 / G56 / G57 / G58 / G59 G54 / G55 / G56 / G57 / G58 / G59 G54 / G55 / G56 / G57 / G58 / G59 G54 is the default WCS after power-on on most controls.
Work coord systems 7–9details → G59.1 / G59.2 / G59.3 G59.1 / G59.2 / G59.3 G59.1 / G59.2 / G59.3 The LinuxCNC / Mach way to get three more fixtures.
Extended fixture bank (P-addressed)details → G54.1 G54.1 G154 FANUC: P1–P48 (0i) or P1–P300 (30i). Mach4: P1–P248. Centroid uses a different, NO-decimal form below. FANUC: G54.1 P1–P48 (0i) / P1–P300 (30i) Mach4: G54.1 P1–P248 Haas: G154 P1–P99
Extended work offsets (Centroid)details → G54 P1–P12 Centroid's 12 optional extended fixtures (WCS #7–#18). Note the space and NO decimal — distinct from FANUC's G54.1 Pn. Centroid: also addressable as E7–E18
Additional work coord systems 7–26 (Haas legacy) G110–G129 Older Haas extra fixtures #7–#26, one dedicated code each. Superseded by G154 Pn on current controls. Haas: G110 = #7 … G129 = #26
Set work offset value (absolute)details → G10 L2 G10 L2 G10 L2 G10 L2 G10 L2 G10 L2 G10 L2 P1 = G54 … P6 = G59. The active WCS need not match P.
Set work offset to current positiondetails → G10 L20 G10 L20 G10 L20 G10 L20 G10 L20 G10 L20 G10 L20 "Set to here" form.
Local coordinate offsetdetails → G52 G52 G52 G52 G52 G52 Temporary frame shift on top of the active WCS. Haas: Haas G52 = global work-coordinate shift
Move in machine coordinates (non-modal)details → G53 G53 G53 G53 G53 G53 G53 One-shot move in the machine frame.
Set position / coordinate offsetdetails → G92 G92 G92 G92 G92 G92 G92 FANUC has G92.1 / G92.2 to clear or restore; Mach has G92.1. Haas: sets the global coordinate-system shift value

Units & distance modes

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Program in inchesdetails → G20 G20 G20 G20 G20 G20 G20
Program in millimetersdetails → G21 G21 G21 G21 G21 G21 G21
Absolute distance modedetails → G90 G90 G90 G90 G90 G90 G90
Incremental distance modedetails → G91 G91 G91 G91 G91 G91 G91
Absolute arc-center modedetails → G90.1 G90.1 G90.1 G90.1 I/J/K become absolute coordinates, not offsets. Centroid: varies by CNC12 version
Incremental arc-center mode (default)details → G91.1 G91.1 G91.1 G91.1 G91.1 G91.1

Feed & speed modes

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Feed per minute G94 G94 G94 G94 G94 G94 Default on mills. On a FANUC LATHE this role is played by G98 — see the false-friends note.
Feed per revolution G95 G95 G95 G95 G95 G95 On a FANUC LATHE this role is played by G99.
Inverse-time feed mode G93 G93 G93 G93 G93 G93 G93 F = 1/minutes; required for some rotary moves. Centroid: G93 on, G94 off.

Tool length & cutter compensation

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Cutter compensation OFFdetails → G40 G40 G40 G40 G40 G40 G40 Default state.
Cutter comp LEFT of pathdetails → G41 G41 G41 G41 G41 G41 D word selects the offset register.
Cutter comp RIGHT of pathdetails → G42 G42 G42 G42 G42 G42
Dynamic cutter comp (offset in source)details → G41.1 / G42.1 LinuxCNC puts the D value in the source line instead of a register.
Cutter-comp corner styledetails → G40.1 / G40.2 Mach4 only: G40.1 arc-rounded, G40.2 square.
Tool length offset (positive)details → G43 G43 G43 G43 G43 G43 H word selects the TLO register.
Tool length offset (negative)details → G44 G44 G44 Rarely used; FANUC-style. Centroid documents G44 in CNC12.
Dynamic tool length offset (in source)details → G43.1 G43.1
Cancel tool length offsetdetails → G49 G49 G49 G49 G49 G49 G49
Set tool-table entry directlydetails → G10 L1 G10 L1 G10 L1 G10 L1 G10 L1 P = tool number, R = value. Centroid documents this in CNC12. LinuxCNC: partial
Set tool length so current pos = valuedetails → G10 L10 G10 L10 G10 L10 G10 L10 G10 L10 G10 L10 LinuxCNC: partial
Set tool length / radius wear & radius G10 L11 / G10 L12 / G10 L13 G10 L11 / G10 L12 / G10 L13 G10 L11 / G10 L12 / G10 L13 G10 L11 / G10 L12 / G10 L13 G10 L11 / G10 L12 / G10 L13 Centroid CNC12 documents the L11/L12/L13 family explicitly; support varies on others. FANUC: varies Mach3: varies Mach4: varies
3D+ cutter compensation (Haas) G141 Haas 3-axis simultaneous cutter comp for ball-nose / contour work.

Drilling, boring & tapping cycles

Canned hole cycles. GRBL has none — CAM posts expand these into raw G1 moves.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Cancel canned cycledetails → G80 G80 G80 G80 G80 G80 Required to exit drill/bore/tap modes.
Standard drillingdetails → G81 G81 G81 G81 G81 G81 Z down at feed, rapid out.
Drilling with dwell at bottomdetails → G82 G82 G82 G82 G82 G82 Spot / counterbore use.
Peck drilling (full retract)details → G83 G83 G83 G83 G83 G83 Q = peck depth; full retract clears chips.
High-speed peck drilling (short retract)details → G73 G73 G73 G73 G73 G73
Right-hand tappingdetails → G84 G84 G84 G84 G84 G84 Mach3: needs OEM plugin for rigid tap
Left-hand / counter tappingdetails → G74 G74 G74 G74 G74 G74 FANUC LATHE reassigns G74 to a face-grooving cycle — see false friends. Haas: Reverse Tap canned cycle
Rigid tappingdetails → G33.1 G84.2 / G84.3 Dedicated rigid-tap codes; otherwise rigid mode is a flag on G84. LinuxCNC: LinuxCNC rigid-tap code
Boring (feed in, feed out)details → G85 G85 G85 G85 G85 G85
Boring (feed in, stop, rapid out) G86 G86 G86 G86 Centroid's CNC12 canned set is G81–G85 + G89; G86/G87/G88 are not in the manual.
Back boring G87 G87 G87 G77 Haas: Haas uses G77 for back-bore
Boring with manual retract G88 G88 G88
Boring with dwell (feed out)details → G89 G89 G89 G89 G89 G89
Fine boring (oriented stop, shift, retract) G76 G76 G76 G76 G76 FANUC LATHE reassigns G76 to a threading cycle — see false friends. Centroid: partial; verify per version
Bolt-hole patterns (Haas mill) G70 / G71 / G72 MILL-only pattern cycles used with a canned drill cycle. FANUC / lathe reuse G70–G72 for turning cycles — see false friends. Haas: G70 circle, G71 arc, G72 along an angle
General-purpose pocket milling (Haas) G150 Haas canned pocket routine (rough + finish, with ramp / island options).
Text engraving (Haas) G47 Engrave a literal string or an auto-incrementing serial number.
Broaching cycle (Haas) G156
Non-vertical rigid tapping (Haas 5-axis) G174 / G184 Rigid tap along a tilted / rotary axis on a UMC. Haas: G174 CCW, G184 CW

Probing & tool setting

The biggest divergence on the page. LinuxCNC/GRBL use G38.x, FANUC/Mach use G31, and Centroid uses M-codes entirely.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Probe toward work, error if no contactdetails → G38.2 G38.2 M115 / M116 G31 G31 G31 G31 FANUC syntax: G31 P1–P4 for multi-step skip. Centroid has NO G31/G38 — it probes with protected-move M-codes. Centroid: protected-move probing; M115 minus, M116 plus Haas: Feed Until Skip
Probe toward work, no error if no contactdetails → G38.3 G38.3 M115/M116 L1 Centroid: L1 suppresses the no-contact error
Probe away from surfacedetails → G38.4 / G38.5 G38.4 / G38.5 M125 / M126 G38.4 errors if still in contact; G38.5 does not. Centroid: probe-away variants
Multiple probe inputsdetails → G31.1 / G31.2 / G31.3 Select among several probe inputs.
Move an axis until a switch tripsdetails → M105 / M106 Feeds the named axis until a PLC switch/input opens (P > 0) or closes (P < 0). Centroid: M105 minus, M106 plus
Automatic tool / work measurement (Haas) G35 / G36 / G37 / G136 Spindle- and table-probe measuring cycles. Haas: G35 tool diameter, G36 work offset, G37 tool offset, G136 work-offset center
Probe support M-codes (Haas) M75 / M78 / M79 / M104 Helpers used inside Haas probing / tool-setting routines. Haas: M75 set G35/G136 ref point; M78 alarm if skip found; M79 alarm if skip not found; M104/M105 probe-arm extend/retract

Coordinate transforms — rotation, scaling, mirror, polar

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Coordinate rotation ON G68 G68 G68 G68 G68 G68 Rotates the active plane around a center. XY plane only on Mach3/4.
Coordinate rotation OFF G69 G69 G69 G69 G69 G69
Scaling ON G51 G51 G51 G51 G51 P or I/J/K = scale factors. Mach4 warns arc scaling can be unpredictable. Centroid: Centroid folds scaling AND mirroring into G51
Scaling OFF G50 G50 G50 G50 G50 FANUC LATHE reassigns G50 entirely — see false friends. Centroid: also mirroring-off; partial/version-dependent Haas: Cancel Scaling
Mirror image ON / OFF G51.1 / G50.1 G101 / G100 Centroid has no separate mirror codes — mirroring rides on G50/G51. Haas: G101 enable, G100 cancel
Polar coordinates ON / OFF G16 / G15 G16 / G15 Encodes X as radius, Y as angle.
Cylindrical mapping / wrapping (Haas) G107 Wraps a flat XY toolpath around a rotary (A/B) axis.

Look-ahead, smoothing & exact stop

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Exact stop (non-modal, one block) G9 G9 G9 G9 G9 G9 One-shot version of G61.
Exact stop (modal) G61 G61 G61 G61 G61 G61 G61 Decelerates fully at every endpoint.
Exact stop (variant) G61.1 G61.1 G61.1
Path blending / continuous mode G64 G64 G64 G64 G64 G64 G64 LinuxCNC: G64 P<tol>. FANUC tunes this via G5.1 HPCC instead. FANUC: partial; HPCC tuning differs Haas: cancels G61 exact-stop mode
AI contour control / HPCC (look-ahead) G5.1 FANUC look-ahead: Q1 on, Q0 off. NOT the same as LinuxCNC G5 spline — see false friends.
Nano smoothing / HPCC variant G5.4 FANUC: some 30i-B only
Look-ahead acc/dec enable (older FANUC) G8 G8 P1 on, G8 P0 off.
Look-ahead block limit (Haas) G103 Caps how many blocks the control buffers ahead; P0 = maximum look-ahead. Haas: G103 P_ (block limit)
Smoothness / accuracy level (Haas) G187 Haas HSM accuracy control; analogous to FANUC G05.1 look-ahead tuning. Haas: G187 E_ / P_ trades smoothness against accuracy

Homing & reference returns

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Return to reference position (home)details → G28 G28 G28 G28 G28 G28 G28 GRBL/Mach: pre-defined stored position.
Store the G28 reference pointdetails → G28.1 G28.1 G28.1 G28.1
Return from reference (via intermediate point)details → G29 G29 G29 G29 G29 G29
Return to secondary referencedetails → G30 G30 G30 G30 G30 G30
Store the G30 reference pointdetails → G30.1 G30.1 G30.1 G30.1
Reference-position checkdetails → G27 Verifies the machine is at home.

Program flow & subprograms

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Compulsory program stopdetails → M0 M0 M0 M0 M0 M0 M0 Cycle-start to resume.
Optional stopdetails → M1 M1 M1 M1 M1 M1 M1 Skipped unless the OSTOP switch is on.
Program end (no rewind)details → M2 M2 M2 M2 M2 M2 M2
Program end + rewinddetails → M30 M30 M30 M30 M30 M30 M30 What most CAM emits at file end.
Call subprogram M98 M98 M98 M98 M98 FANUC/Centroid/Mach: P<file> L<reps>. LinuxCNC uses O-codes instead.
Return from subprogram / end of macro M99 M99 M99 M99 M99 Haas: sub-program return or loop
Named / numbered subroutines O-codes LinuxCNC's model: o100 sub / o100 endsub / o100 call. LinuxCNC: o<n> sub / endsub / call
Macro call (one-shot) G65 G65 G65 G65 G65 Centroid: L = repeat count, not feed. Mach4: macro file must be .nc; A–Z args map to #1–#26. LinuxCNC: via O-code subs
Modal macro call / cancel G66 / G67 G66 / G67 Centroid's CNC12 list documents only one-shot G65 — no G66/G67.
Re-run program from startdetails → M47 M47 Mach4: partial
Local subprogram call (Haas) M97 Calls a labeled block in the SAME program (P = line/label, L = repeats). FANUC has no M97. Haas: M97 P<line> L<reps>
Conditional jump (Haas) M96 / M46 Haas: M96 P_ Q_ jump if no input; M46 Q_ P_ jump to line

Macros, variables & flow control

How each control does branching and loops. These are language constructs, not G-codes — shown for porting macros. Centroid is the notable one: no WHILE/DO.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Parametric variables #<named> #vars #vars VBScript Lua #vars LinuxCNC: named & numbered params Centroid: Macro-B style FANUC: Macro-B Mach3: Param1/2/3() Mach4: scripted Haas: FANUC-style Macro-B
Conditional (IF / THEN) O… if/elseif/else/endif IF/THEN/ELSE IF[…] THEN / GOTO VBScript Lua IF[…] THEN / GOTO Centroid: supported
Loop (WHILE / DO) O… while/endwhile WHILE[…] DO / END VBScript Lua WHILE[…] DO / END Centroid CNC12 has NO WHILE/DO loop — use IF + GOTO instead.
Branch (GOTO) GOTO Nnnn GOTOn GOTOn Centroid: jump to a block number
Set internal control parameter G10 P_ R_ Centroid-specific. E.g. G10 P73 R0.02 configures the G73 peck-retract before the cycle call. Centroid: no L word
Modify a Setting from the program (Haas) G167 Haas: G167 changes a machine Setting mid-program

Spindle & coolant

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Spindle on, clockwisedetails → M3 M3 M3 M3 M3 M3 M3 S word sets speed.
Spindle on, counter-clockwisedetails → M4 M4 M4 M4 M4 M4 M4 GRBL laser mode: dynamic power.
Spindle stopdetails → M5 M5 M5 M5 M5 M5 M5
Spindle orient (oriented stop)details → M19 M19 M19 M19 M19 Centroid: needs a custom M19 macro. Mach3: depends on builder VBScript. Mach3: builder-dependent
Mist coolant ondetails → M7 M7 M7 M7 M7 M7 M7 Haas: Haas M07 = shower/wash-down coolant, not mist
Flood coolant ondetails → M8 M8 M8 M8 M8 M8 M8
All coolant offdetails → M9 M9 M9 M9 M9 M9 M9

Tool change

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Tool changedetails → M6 M6 M6 M6 M6 M6 / M16 Pairs with a prior Tn. GRBL pauses and prompts. Haas: M16 also commands a tool change
Set current tool number (no change)details → M61 Declares the loaded tool without a swap.

Feed & spindle overrides

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Enable feed & speed overrides M48 M108 M48 M48 M48 Centroid uses M108 for this instead of M48.
Disable feed & speed overrides M49 M109 M49 M49 M49 Often used inside tapping cycles. Centroid uses M109.
Granular override control (LinuxCNC) M50 / M51 / M52 / M53 Feed (M50), spindle (M51), adaptive feed (M52), feed-stop (M53).

Digital & analog I/O

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Set digital output M62 / M64 M94 M62 / M64 M62 / M64 Centroid uses M94 (e.g. M94/1 sets output 1). Mach3: usually via OEM scripts. Centroid: M94/n Mach3: partial
Clear digital output M63 / M65 M95 M63 / M65 M63 / M65 Centroid uses M95 (e.g. M95/1 clears output 1). Centroid: M95/n Mach3: partial
Wait for input M66 M100 / M101 M66 M66 Centroid uses M100/M101 (PLC-bit wait). Mach4: P<input> L<timeout-sec>. Mach3: partial
Analog output M67 / M68 M67 / M68 M67 synchronized, M68 immediate. Mach4: partial
PLC-bit wait (Centroid) M100 / M101 M100 waits until a PLC bit is open/off; M101 until closed/on. SAME numbers run user scripts on LinuxCNC/Mach — see false friends. Centroid: M100 open, M101 closed
Direct output / IO macro family (Mach4) M200–M219 / M220–M224 / M228

Modal state (LinuxCNC)

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Save / restore modal state M70 / M71 / M72 / M73 M70 save, M71 invalidate, M72 restore, M73 save autoreturn state.

Turning / lathe cycles

Lathe (T-series) territory. The columns above describe MILL behavior; several codes mean something different on a lathe.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Diameter / radius mode (LinuxCNC lathe) G7 / G8
Spindle max RPM clamp (CSS) G50 G50 G50 G50 G50 FANUC lathe: G50 S____ clamps RPM under G96. Mill G50 means scaling-off — a true false friend. LinuxCNC: partial Centroid: partial FANUC: G50 S____ Mach3: partial
Set work-coord origin (FANUC lathe) G50 G50 X_ Z_ on a FANUC lathe sets the work origin (the other G50 sub-use). FANUC: G50 X_ Z_
Constant surface speed (CSS) on G96 G96 G96 G96 G96 S in m/min (G21) or sfm (G20). Centroid: partial Mach3: partial
Constant spindle RPM (cancel CSS) G97 G97 G97 G97 G97 Centroid: partial Mach3: partial
Synchronous threading (constant pitch) G33 G33 G33 Centroid: optional
Finishing turning cycle G70 G70 G70 Uses a profile defined by G71/G72. Centroid: T-series only Mach4: partial
Stock-removal turning (roughing) G71 / G72 G71 / G72 G71 / G72 G71 longitudinal, G72 facing. FANUC: Type I or Type II syntax. Centroid: T-series only Mach4: partial
Face grooving (FANUC lathe G74) G74 G74 Same G74 that means left-hand tapping on a mill. Centroid: T-series
Threading cycle (FANUC lathe G76) G76 G76 G76 Same G76 that means fine boring on a mill. Type I (single-block) or Type II (P/Q/R). LinuxCNC: lathe Centroid: T-series
Feed per minute (FANUC lathe) G98 On a FANUC LATHE, G98 means feed/min — the role G94 plays on the mill. FANUC: lathe only
Feed per revolution (FANUC lathe) G99 On a FANUC LATHE, G99 means feed/rev — the role G95 plays on the mill. FANUC: lathe only

Canned-cycle return mode (mill)

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Return to initial Z after a cycledetails → G98 G98 G98 G98 G98 G98 FANUC LATHE reassigns G98 to feed-per-minute — see the Turning group and false friends.
Return to R-plane after a cycledetails → G99 G99 G99 G99 G99 G99 FANUC LATHE reassigns G99 to feed-per-revolution.

5-axis positioning & compensation (Haas)

UMC / 5-axis features. FANUC and others use different codes (or options) for the equivalents; these are the Haas spellings.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Tool center point control (TCPC) G234 Keeps the tool tip on the path while the rotary axes move.
5-axis tool length compensation + G143
Dynamic Work Offset (DWO) G254 / G255 Compensates the work offset for the current rotary-axis position. Haas: G254 enable, G255 cancel
Feature coordinate system G268 / G269 / G253 Define / orient a coordinate system to a tilted feature. Haas: G268 enable, G269 disable, G253 orient spindle normal to feature
Visible-axes rapid rate (%) G266 Haas: linear rapid % for the visible axes

Machine automation & accessories (Haas)

Haas machine-function M-codes: coolant, doors, conveyors, pallets, probes, relays. Several numbers collide with other controls' meanings — see false friends.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4HaasNotes
Chip conveyor M31 / M33 Haas: M31 forward, M33 stop
Programmable coolant spigot (P-Cool) M34 / M35 Haas: M34 increment position, M35 decrement
Through-spindle coolant (TSC) M88 / M89 Haas: M88 on, M89 off
Auto air gun / tool air blast M83 / M84 / M73 / M74 Haas: M83/M84 auto air gun on/off; M73/M74 tool air blast (TAB) on/off
Automatic door M80 / M81 Haas: M80 open, M81 close
Automatic window M180 / M181 Haas: M180 open, M181 close
Axis brakes (4th / 5th) M10 / M11 / M12 / M13 Haas: M10/M11 4th-axis brake engage/release; M12/M13 5th-axis
Spindle gear range M41 / M42 Haas: M41 low gear, M42 high gear
Spindle tool clamp / unclamp M82 / M86 Haas: M82 unclamp, M86 clamp
Workholding / fixture clamp M70 / M71 / M90 / M91 M70 shares its number with LinuxCNC's modal-state save — see false friends. Haas: M70/M71 workholding clamp/unclamp; M90/M91 fixture clamp input on/off
Rotate tool turret M39
Spindle speed variation (SSV) M138 / M139 Haas: M138 on, M139 off
Mist condenser M158 / M159 Haas: M158 on, M159 off
Vise / chip air blast M116 / M117 Centroid uses M116 to probe — see false friends. Haas: M116 on, M117 off
Sleep mode M95
Display media on screen M130 / M131 Haas: M130 display image / video, M131 cancel
Interactive operator input M109 Centroid uses M109 to disable overrides — see false friends. Haas: single-keystroke operator input
PulseJet MQL lubrication M160 / M161 / M162 / M163 Haas: M160 cancel, M161 continuous, M162 single event, M163 modal
Pallet changer M36 / M48 / M50 / M199 Haas: M36 part ready; M48 validate program for loaded pallet; M50 change sequence; M199 pallet/part load or program end
User M-code outputs & relays M21–M25 / M29 / M51–M55 / M59 / M61–M65 / M69 M51–M55 / M61–M65 and M59 / M69 collide with LinuxCNC and other controls' M-code meanings — see false friends. Haas: M21–M25 optional user M w/ M-Fin; M29 set relay w/ M-Fin; M51–M55 set user outputs, M61–M65 clear; M59 set relay, M69 clear
APL / robot custom sequence M300

False friends — same number, different meaning

The operation tables above already handle the "different code, same job" case — each row lists every control's spelling, so you can't miss it. This section is about the opposite and more dangerous case: the same number does fundamentally different things on different controls or modes. A program that runs cleanly on one will produce wrong output — or 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.


G5 / G5.1 / G5.4 — different high-speed look-ahead implementations

Control G5 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.


G70 / G71 / G72 — bolt-hole patterns (Haas mill) vs turning cycles (FANUC lathe)

On a Haas mill these are pattern cycles, not turning cycles.

Platform G70 G71 G72
Haas mill Bolt-hole circle Bolt-hole arc Bolt holes along an angle
FANUC lathe (T-series) Finishing cycle Stock-removal (roughing) in turning Stock-removal in facing
Centroid / Mach lathe Follows the FANUC lathe convention (T-series only)
LinuxCNC / GRBL Not assigned Not assigned Not assigned

Portability impact: A Haas mill program that drills a bolt circle with G70 I_ J_ L_ is meaningless on a lathe post, and a lathe roughing program using G71 will not pattern-drill on a Haas mill. These cycles are combined with a canned drill cycle (G81–G83) on the Haas.


Haas M-codes that collide with other controls

Haas assigns several M-numbers to machine functions that mean something different elsewhere. None of these port cleanly.

Code On Haas Elsewhere
M48 Validate the current program matches the loaded pallet FANUC / LinuxCNC / Mach: feed & spindle override enable
M51–M55 / M61–M65 Set / clear optional user M-code outputs LinuxCNC: M51 spindle-speed override, M61 set current tool number; LinuxCNC granular M50–M53 override control
M70 / M71 Workholding clamp / unclamp LinuxCNC: M70 save modal state, M71 invalidate saved state
M73 / M74 Tool air blast on / off LinuxCNC: M73 save-and-autorestore modal state
M95 Sleep mode Centroid: clear digital output (M95/n)
M109 Interactive operator input (single keystroke) Centroid: disable feed & speed overrides
M116 / M117 Vise / chip air blast on / off Centroid: M116 protected-move probe (plus direction)

Portability impact: an override-enable M48 copied from a FANUC program onto a pallet-equipped Haas triggers a program-validation check instead. A Centroid probing routine that relies on M116 becomes an air blast on a Haas. Always re-map machine M-codes when moving between controls.

Note also M07: on a Haas, M07 is shower / wash-down coolant, not the mist coolant it selects on FANUC and most other controls. And M97 is a Haas-specific local subprogram call (P = a line/label in the same program) — FANUC has no M97 and uses M98 with an external subprogram for the same job.


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 #-variables with IF/THEN/ELSE and block-number GOTO branching — it does not have WHILE/DO loops. Probing is done with M-codes (M105/M106, M115/M116/M125/M126), not G31/G38. Extended work offsets use G54 Pn (no decimal), not G59.1+ or G54.1. G70–G76 lathe cycles only apply on T-series. The canonical mill canned-cycle set is G81–G85 + G89; G86/G87/G88 back-bore and modal-macro G66/G67 are not in the CNC12 manual.

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.

Haas is Fanuc-compatible at the core, so most Fanuc mill programs run with little change, but it has a large proprietary layer. Milling extras: G12/G13 circular pocket, G150 general pocket, G47 text engraving, G70–G72 bolt-hole patterns (mill — not the lathe turning cycles), G73–G89 canned cycles plus G77 back-bore. Work offsets extend via G154 P1–P99 (and legacy G110–G129 for #7–#26). High-speed machining is tuned with G187 (not Fanuc's G05.1). Rich machine M-codes cover conveyors, doors, pallets, TSC, and probing — several of which collide with other controls' meanings (see false friends). Subprograms use M98/M99; M97 adds a Haas-only local call by line number. 5-axis (UMC) adds G234 TCPC, G143 5-axis TLC, and G254/G255 Dynamic Work Offset.


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):

GRBL 1.1 (open source):

Centroid CNC12 (vendor PDFs):

FANUC (third-party aggregators of vendor manuals; vendor PDFs are generally not freely hosted):

Mach 3 (ArtSoft / MachMotion):

Mach 4 (ArtSoft / MachMotion):

Haas (official Haas Automation documentation — the primary source for the Haas column; verified against the live pages and the Mill Operator's Manual index):

Known unverifiable / uncertain entries

Visualize your G-code in 3D

G54.APP is a free in-browser G-code viewer and CNC stock simulator. Drop in any .nc, .gcode, .tap, or .cnc file to play back the toolpath at 60+ fps with real-time stock removal — no install, no account.

Try G54.APP →