bg

G and M codes for machining centers (Fanuc-type mills)

This page lists the G codes of Fanuc-type machining centres (vertical and horizontal mills) and the M codes that matter most on them. Most mill controls follow the Fanuc numbering, but cycles, options and a few code numbers differ between machine builders and control versions, so check your machine's programming manual before you rely on a code. For the full list of standard M codes see the M code list; for lathes see the lathe G codes, where several numbers mean something else.

G codes for machining centres

CodeFunction
G00Rapid positioning
G01Linear interpolation (feed)
G02Circular interpolation, clockwise
G03Circular interpolation, counterclockwise
G04Dwell
G09Exact stop (one block)
G10Programmable data input (offsets, work coordinates)
G15 / G16Polar coordinates off / on
G17 / G18 / G19Plane selection XY / ZX / YZ
G20 / G21Inch / metric input
G28Return to reference point (machine zero)
G30Return to 2nd reference point
G31Skip function (probing)
G40Cutter radius compensation cancel
G41 / G42Cutter radius compensation left / right
G43 / G44Tool length compensation + / -
G49Tool length compensation cancel
G50 / G51Scaling off / on
G50.1 / G51.1Programmable mirror image off / on
G52Local coordinate system
G53Machine coordinate system (one block)
G54 - G59Work coordinate systems 1 to 6
G61Exact stop mode
G64Cutting mode (cancels G61)
G65Macro call
G66 / G67Modal macro call / cancel
G68 / G69Coordinate rotation on / off
G73High-speed peck drilling cycle
G74Left-hand (reverse) tapping cycle
G76Fine boring cycle
G80Canned cycle cancel
G81Drilling cycle (spot drilling)
G82Drilling cycle with dwell (counterboring)
G83Peck drilling cycle
G84Tapping cycle
G85Boring cycle (feed in, feed out)
G86Boring cycle (spindle stop, rapid out)
G87Back boring cycle
G88Boring cycle (dwell, spindle stop, manual retract)
G89Boring cycle (dwell, feed out)
G90 / G91Absolute / incremental programming
G92Work coordinate system setting (shift)
G94 / G95Feed per minute / per revolution
G98 / G99Canned cycle return to the initial point / to the R point

Builders differ in places. For example, Haas mills use G77 for back boring and G87 for a boring cycle with manual retract, and the meaning of their G52 depends on a setting. On mills G98 and G99 select the return level of drilling cycles; on lathes with G code system A the same numbers set feed per minute and per revolution.

M codes on machining centres

CodeFunction on most Fanuc-type millsNote
M00Program stop
M01Optional stoponly when the optional stop switch is on
M02End of program
M03 / M04Spindle on, clockwise / counterclockwise
M05Spindle stop
M06Tool change
M07Second coolant onoften mist or air; set by the builder
M08Coolant on (flood)
M09Coolant off
M19Spindle orientationstops the spindle at a fixed angle
M29Rigid tapping modeon many Fanuc-type mills; the number is set by a parameter, and Haas mills use M29 for an output relay
M30End of program and rewind
M98Subprogram callhandled by the control itself
M99Subprogram end / returnhandled by the control itself

All other M codes are defined by the machine builder. Examples from Haas mills: M10 / M11 engage / release the 4th-axis brake, M12 / M13 engage / release the 5th-axis brake, M31 / M33 start / stop the chip conveyor, M88 / M89 switch through-spindle coolant on / off. The M code list compares more codes on mills and lathes.

CNC Syntax Editor highlights these codes in mill programs and, in the Enterprise edition, backplots the tool path so you can check a program before it runs (G-code simulator). For a quick look in your browser use the free online G-code viewer. The Free Edition is on the download page.

Sources: Fanuc-type G and M code conventions; builder examples from the Haas mill M-codes and mill G-codes pages, checked 2 November 2026.

M codes | G codes | G and M codes for mills | ISO tape codes | EIA tape codes | Online G-code viewer

Product Buy Download Support Contacts Site map
Copyright © 1999 - 2026, AGG Software.
All rights reserved.. Terms of use | Privacy policy