G-codes command motion. M-codes handle the “miscellaneous” machine functions: turning the spindle and coolant on or off, changing tools, and ending the program. A beginner only needs a small set to start.
Spindle
- M03: spindle on, clockwise (forward).
- M04: spindle on, counterclockwise (reverse).
- M05: spindle stop.
These three are worth drilling together. See M03 vs M04 vs M05 for the full breakdown.
Coolant
- M08: coolant on.
- M09: coolant off.
Tool change and program control
- M06: tool change (usually with a
Tword, likeT02 M06). - M00: program stop (always pauses).
- M01: optional stop (pauses only if the switch is on).
- M30: program end and rewind. This is how most programs finish.
T02 M06 (change to tool 2)
M03 S1500 (spindle on, clockwise, 1500 rpm)
M08 (coolant on)
...
M05 (spindle stop)
M09 (coolant off)
M30 (end and rewind)
How to remember them
As with any reference, reading the list is not the same as recalling it. Drill these as quick code-to-meaning questions and review the ones you miss, the same practice-first way you learn the common G-codes. The whole approach is laid out in beginner CNC code practice.
Bottom line
Learn spindle (M03, M04, M05), coolant (M08, M09), tool change (M06), the stops (M00, M01), and the end (M30). That set covers most beginner programs.
G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.