CNC mill · M-code

M03 / M04 / M05: spindle forward, reverse, stop

M03 starts the spindle clockwise (forward), M04 counterclockwise (reverse), at the speed S; M05 stops it. Formats below from Haas and LinuxCNC, each from its maker.

Worked example

Start at 1,500 RPM, stop before a tool change. Written for this page in the Haas format.

S1500 M03(… cut …)M05

How each control writes it

Haas S- M03 / M04 / M05

One source: Haas Automation, the control's maker

S
Spindle speed, RPM
  • On a geared machine the S value selects the gear unless M41/M42 override it.

Source: Haas Automation, mill M03

LinuxCNC M3 / M4 / M5 <$->

One source: the LinuxCNC project, the control's maker

$
Spindle number; $-1 is all spindles (optional)
  • M3 or M4 with S0 is allowed: the spindle just does not turn.

Source: LinuxCNC documentation, "M3, M4, M5 Spindle Control" (archived Oct 24, 2026)

How the controls differ

  • Only Haas takes S.
  • Only LinuxCNC takes $.
  • A word two controls share can still mean different things: read each control's list above.

No Fanuc row yet: that chapter of the 0i manual has not been read.

Haas follows Fanuc's numbering, but options and parameters differ between controls: check your control's manual.