A quick reference to the G-codes and M-codes you use most. G-codes control geometry and motion; M-codes control machine functions like the spindle and coolant. Exact behavior can vary by controller, so always confirm against your machine post.
Common G-codes
| Code | Function |
|---|---|
| G00 | Rapid positioning (non-cutting move) |
| G01 | Linear feed move (straight cut) |
| G02 | Circular interpolation, clockwise (arc) |
| G03 | Circular interpolation, counterclockwise |
| G04 | Dwell (timed pause) |
| G17 / G18 / G19 | Select XY / XZ / YZ working plane |
| G20 / G21 | Units in inches / millimeters |
| G28 | Return to machine home |
| G40 | Cancel cutter compensation |
| G41 / G42 | Cutter compensation left / right |
| G43 | Apply tool length offset |
| G54–G59 | Work coordinate systems (part zero) |
| G80 | Cancel canned cycle |
| G81 | Standard drilling cycle |
| G83 | Peck drilling cycle |
| G90 / G91 | Absolute / incremental positioning |
Common M-codes
| Code | Function |
|---|---|
| M00 | Program stop |
| M01 | Optional stop |
| M03 / M04 | Spindle on clockwise / counterclockwise |
| M05 | Spindle stop |
| M06 | Tool change |
| M08 / M09 | Coolant on / off |
| M30 | Program end and rewind |
Reference set for milling controls. Lathe and multi-axis machines add codes (constant surface speed, tool nose comp); check your controller manual.
For the spoken vocabulary behind the codes, see the Machining Glossary, and run setup numbers in G-code & CNC calculators.
