M03, M04, and M05 are the spindle controls, and they are usually the first M-codes a beginner meets. M-codes are “miscellaneous” or machine functions: they switch things on and off rather than command motion the way G-codes do.
The three codes
- M03: spindle on, clockwise (forward). This is the workhorse. Standard right-hand tools cut running clockwise, so most programs use
M03. - M04: spindle on, counterclockwise (reverse). Used for left-hand tooling and operations like certain tapping setups.
- M05: spindle stop.
They almost always travel with a speed value:
M03 S1200 (spindle on, clockwise, at 1200 rpm)
...
M05 (spindle stop)
The spindle codes at a glance
| Code | Action | Direction | Typical use |
|---|---|---|---|
M03 | Spindle on | Clockwise (forward) | Standard right-hand tools (most cutting) |
M04 | Spindle on | Counterclockwise (reverse) | Left-hand tooling, some tapping |
M05 | Spindle stop | None | End of an operation, before a tool change |
Why the mix-up happens
M03 and M04 differ by one digit and both start the spindle, so beginners reverse them. And because M03 is so common, M04 is easy to forget entirely until a left-hand or tapping job needs it. M05 is simpler, but under pressure students sometimes blank on which number is “stop.”
A memory hook: M03 is the default workhorse (3 is the one you will type most), M04 is the rare reverse, M05 is the full stop.
Learn them as a set
Spindle codes are easiest to remember as a group of three rather than one at a time, the same way you would drill M03, M04, and M05 as a mix-up set. They sit alongside coolant and program codes on the list of common M-codes every CNC beginner should know. The same spindle-style codes get reused to switch other outputs: a GRBL laser often uses M03/M04/M05 for the beam, and many hobby plasma tables map torch firing to them too.
Bottom line
M03 is clockwise on, M04 is counterclockwise on, M05 is stop. Most cutting uses M03. Drill the three together with their S value and they stop blurring.
Sources
- LinuxCNC M-code reference (M3, M4, M5)
- Wikipedia: G-code (M-code functions)
- CNCCookbook: G-code and M-code cheat sheet
Frequently asked questions
What is the difference between M03 and M04?
M03 runs the spindle clockwise (forward), which is what standard right-hand cutting tools need. M04 runs it counterclockwise (reverse), used for left-hand tooling and certain operations like some tapping cycles.
Does M05 turn off coolant too?
No. M05 only stops the spindle. Coolant is controlled separately by M08 (on) and M09 (off).
What is the best way to memorize M03, M04, and M05?
Drill the three as one spindle set, both directions, until the number-to-action link is instant. A free tool like G-Code Sprint has an M-code mode that quizzes M03 vs M04 vs M05 and repeats whichever you keep missing.
G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.