CNC G-Code and M-Code List
Common Fanuc-style codes used on most CNC mills. Codes vary by control and builder - always confirm in your machine's programming manual.
G-codes
| Code | Function |
|---|---|
| G00 | Rapid positioning |
| G01 | Linear feed move |
| G02 / G03 | Circular interpolation CW / CCW |
| G04 | Dwell |
| G17 / G18 / G19 | Plane select XY / XZ / YZ |
| G20 / G21 | Inch / metric units |
| G28 | Return to reference (home) |
| G40 | Cutter comp cancel |
| G41 / G42 | Cutter comp left / right |
| G43 / G49 | Tool length comp + / cancel |
| G54 - G59 | Work coordinate systems |
| G80 | Cancel canned cycle |
| G81 | Drill cycle |
| G82 | Spot drill with dwell |
| G83 | Peck drill |
| G84 | Tapping cycle |
| G85 | Boring (feed out) |
| G90 / G91 | Absolute / incremental |
| G94 / G95 | Feed per minute / per rev |
| G98 / G99 | Canned cycle return: initial / R plane |
M-codes
| Code | Function |
|---|---|
| M00 | Program stop |
| M01 | Optional stop |
| M03 / M04 | Spindle CW / CCW |
| M05 | Spindle stop |
| M06 | Tool change |
| M08 / M09 | Coolant on / off |
| M30 | Program end and rewind |
| M98 | Subprogram call |
| M99 | Subprogram return |
Formulas
RPM = (SFM × 3.82) / Dia
IPM = RPM × Flutes × Chip load
Tap feed (IPM) = RPM / TPI
Printable PDF version - G & M Code Quick Card
Clean letter-size sheet for the toolbox or shop wall. Instant download, $3.99.
Clean letter-size sheet for the toolbox or shop wall. Instant download, $3.99.