G-code and M-code cheat sheet (Fanuc milling)

Meanings are typical for Fanuc-style milling controls. Other controls and machine builders may differ – follow the machine documentation.

Download PDF

G-codes

CodeMeaning
G00Rapid traverse
G01Linear interpolation (feed)
G02Circular interpolation clockwise
G03Circular interpolation counter-clockwise
G04Dwell
G17 / G18 / G19Plane XY / ZX / YZ
G20 / G21Inch / metric input
G28Return to reference point
G40Cutter compensation cancel
G41 / G42Cutter compensation left / right
G43 / G49Tool length offset / cancel
G53Machine coordinate move
G54–G59Work coordinate systems
G73High-speed peck drilling
G74 / G84Left-hand / right-hand tapping
G76Fine boring
G80Canned cycle cancel
G81 / G82Drilling / drilling with dwell
G83Deep-hole peck drilling
G85–G89Boring cycles
G90 / G91Absolute / incremental
G94 / G95Feed per minute / per revolution
G96 / G97Constant surface speed / constant RPM
G98 / G99Return to initial level / R plane

M-codes

CodeMeaning
M00Program stop
M01Optional stop
M02End of program
M03 / M04Spindle clockwise / counter-clockwise
M05Spindle stop
M06Tool change
M08 / M09Coolant on / off
M19Spindle orientation
M29Rigid tapping
M30End of program and rewind
M98 / M99Subprogram call / return

M19, M29 and some cycle meanings depend on the machine builder.

Printable CNC charts (PDF)