M05 stops spindle rotation. It is called before tool changes, before retracting out of a part by hand, and as part of a safe program ending.
Format
How it works
- The spindle decelerates to a stop; motion commands can continue once stopped.
- Always stop the spindle before a tool change (M06 usually forces this anyway).
- It pairs with M03 or M04 that started rotation.
Example
M30 (end program)
FAQ
Does M05 also stop coolant? No, M05 only stops spindle rotation. Coolant is controlled separately with M08 (flood on) and M09 (coolant off), so a program typically calls M09 alongside or before M05 rather than relying on M05 to shut off coolant automatically.
Should M05 be called before or after a tool change? Before, generally as part of the same sequence that also retracts the tool. Most tool change cycles include an implicit or explicit spindle stop, since changing tools with the spindle running would be unsafe.
Related: M03 Spindle On and the M-Code Reference.
Why stop the spindle
M05 stops spindle rotation. It belongs in the program before tool changes, before the operator reaches into the machine, and as part of a safe program ending. Stopping the spindle before retracting prevents damage to the part and the tool, and avoids hazards from a rotating cutter.
Practical notes
Large spindles can take several seconds to coast to a stop, so do not open the door or touch the tool until rotation has stopped completely. On many machines the tool change command or program end code also stops the spindle, but this varies, so check how your control behaves rather than assuming it. Writing an explicit M05 is a good habit and removes any doubt.
