Printed from Kezuriba (kezuriba.net/en/nc/)
G-code and M-code list
G and M codes for machining centers and lathes, centered on the common FANUC-type assignments. The same number can mean different things on different machines (M codes in particular are assigned by the machine builder). Always confirm against your machine’s manual before running a program.
Same number,
different machine?
Check the manual!

GG codes
| Code | Machining center | Lathe (system A) | Modal |
|---|---|---|---|
| G00 | Rapid positioning (rapid traverse) | Rapid positioning (rapid traverse) | Modal (01) |
| G01 | Linear interpolation (cutting feed) | Linear interpolation (cutting feed) | Modal (01) |
| G02 | Circular interpolation, clockwise (CW) / helical interpolation | Circular interpolation, clockwise (CW) / helical interpolation | Modal (01) |
| G03 | Circular interpolation, counterclockwise (CCW) / helical interpolation | Circular interpolation, counterclockwise (CCW) / helical interpolation | Modal (01) |
| G04 | Dwell (pause) | Dwell (pause) | One-shot (00) |
| G09 | Exact stop (this block only) | Exact stop (this block only) | One-shot (00) |
| G10 | Programmable data input (writes offset values and work coordinates from the program) | Programmable data input (writes offset values and work coordinates from the program) | One-shot (00) |
| G17 | XY plane selection | XY plane selection (used on lathes with milling capability) | Modal (02) |
| G18 | ZX plane selection | ZX plane selection (lathe standard) | Modal (02) |
| G19 | YZ plane selection | YZ plane selection (lathes with a Y axis and live tooling) | Modal (02) |
| G20 | Inch input | Inch input | Modal (06) |
| G21 | Metric (mm) input | Metric (mm) input | Modal (06) |
| G28 | Automatic return to reference point (zero return) | Automatic return to reference point (zero return) | One-shot (00) |
| G30 | 2nd (3rd, 4th) reference point return | 2nd (3rd, 4th) reference point return | One-shot (00) |
| G40 | Cutter compensation cancel (lathe: tool nose radius compensation cancel) | Tool nose radius compensation cancel | Modal (07) |
| G41 | Cutter compensation left (tool is on the left of the direction of travel) | Tool nose radius compensation, left | Modal (07) |
| G42 | Cutter compensation right (tool is on the right of the direction of travel) | Tool nose radius compensation, right (used for typical OD turning toward –Z) | Modal (07) |
| G43 | Tool length compensation + (adds the offset) | (Not used on typical FANUC-type lathes. The tool offset is selected by the last 2 digits of the T code) | Modal (08) |
| G44 | Tool length compensation – (subtracts the offset) | — | Modal (08) |
| G49 | Tool length compensation cancel | — | Modal (08) |
| G50 | Scaling cancel | Maximum spindle speed setting (also sets the coordinate system in system A) | Modal (11) |
| G52 | Local coordinate system setting | Local coordinate system setting | One-shot (00) |
| G53 | Machine coordinate system selection (positioning in machine coordinates) | Machine coordinate system selection (positioning in machine coordinates) | One-shot (00) |
| G54–G59 | Work coordinate systems 1–6 selection | Work coordinate systems 1–6 selection | Modal (14) |
| G61 | Exact stop mode | Exact stop mode | Modal (15) |
| G64 | Cutting mode (continuous cutting; cancels exact stop) | Cutting mode (continuous cutting; cancels exact stop) | Modal (15) |
| G65 | Macro call (simple call, with arguments) | Macro call (simple call, with arguments) | One-shot (00) |
| G66 | Modal macro call | Modal macro call | Modal (12) |
| G67 | Modal macro call cancel | Modal macro call cancel | Modal (12) |
| G68 | Coordinate rotation | Meaning differs by machine (see variants below) | Modal (16) |
| G69 | Coordinate rotation cancel | Meaning differs by machine (see G68) | Modal (16) |
| G70 | — | Finishing cycle (finishes the profile rough-cut with G71–G73) | One-shot (00) |
| G71 | — | OD/ID rough turning cycle (cuts along Z) | One-shot (00) |
| G72 | — | Face rough turning cycle (cuts along X) | One-shot (00) |
| G73 | High-speed peck drilling cycle (chip breaking, small retract) | Pattern repeating (closed-loop cutting) cycle (cuts following the stock shape, e.g. castings) | Modal (09) |
| G74 | Left-hand tapping cycle (reverse tapping) | End face grooving cycle / Z-direction deep hole peck drilling | Modal (09) |
| G75 | — | OD/ID grooving (cut-off) cycle | One-shot (00) |
| G76 | Fine boring cycle | Multiple thread cutting cycle (compound thread cutting cycle) | Modal (09) |
| G80 | Canned cycle cancel | Drilling canned cycle cancel (for live tooling, face drilling) | Modal (09) |
| G81 | Drilling cycle (spot drilling) | — | Modal (09) |
| G82 | Drilling cycle (counter boring, dwell at hole bottom) | — | Modal (09) |
| G83 | Deep hole drilling cycle (peck drilling, full retract to the R point each time) | End face deep hole drilling cycle (live tooling, lathe with C axis) | Modal (09) |
| G84 | Tapping cycle (right-hand thread) | Face tapping cycle (lathe with live tooling) | Modal (09) |
| G85 | Boring cycle (feed in, feed out) | Face boring (drilling) cycle (live tooling) | Modal (09) |
| G86 | Boring cycle (spindle stops at the hole bottom, rapid out) | — | Modal (09) |
| G87 | Back boring cycle (reverse spot facing) | Side deep hole drilling cycle (live tooling, systems A/B) | Modal (09) |
| G88 | Boring cycle (dwell at the hole bottom, spindle stop, manual retract) | Side tapping cycle (live tooling, systems A/B) | Modal (09) |
| G89 | Boring cycle (dwell at the hole bottom, feed out) | Side boring (drilling) cycle (live tooling) | Modal (09) |
| G90 | Absolute command | OD/ID cutting cycle (single canned cycle, G-code system A) | Modal (03) |
| G91 | Incremental command | (Not used in system A. Incremental values are written with U/W) | Modal (03) |
| G92 | Coordinate system setting (assigns coordinate values to the current position) | Thread cutting cycle (single canned cycle, G-code system A) | One-shot (00) |
| G94 | Feed per minute (mm/min) | Face cutting cycle (single canned cycle, G-code system A) | Modal (05) |
| G95 | Feed per revolution (mm/rev) | — | Modal (05) |
| G96 | Constant surface speed control | Constant surface speed control | Modal (13) |
| G97 | Constant surface speed control cancel (constant spindle speed) | Constant surface speed control cancel | Modal (13) |
| G98 | Canned cycle: return to initial point | Feed per minute (mm/min) (G-code system A) | Modal (10) |
| G99 | Canned cycle: return to R point | Feed per revolution (mm/rev) (G-code system A) | Modal (10) |
Yellow underline = the meaning differs between machining centers and lathes.
MM codes
| Code | Meaning | Machine |
|---|---|---|
| M00 | Program stop | Machining center, Lathe |
| M01 | Optional stop (conditional stop) | Machining center, Lathe |
| M02 | Program end | Machining center, Lathe |
| M03 | Spindle on, clockwise (CW) | Machining center, Lathe |
| M04 | Spindle on, counterclockwise (CCW) | Machining center, Lathe |
| M05 | Spindle stop | Machining center, Lathe |
| M06 | Tool change (ATC) | Machining center |
| M08 | Coolant (cutting fluid) ON | Machining center, Lathe |
| M09 | Coolant OFF | Machining center, Lathe |
| M19 | Spindle orientation (oriented spindle stop) | Machining center, Lathe |
| M29 | Rigid tapping (switches the spindle to position control) *machine-dependent* | Machining center, Lathe |
| M30 | Program end and rewind (end of tape) | Machining center, Lathe |
| M98 | Subprogram call | Machining center, Lathe |
| M99 | Subprogram end (return to the caller) | Machining center, Lathe |