Spindle Control G-codes: M03, M04, and M05 (or M3, M4, M5)

Last modified: March 23, 2024

CNCCookbook’s G-code Tutorial

The spindle control G-codes control when the spindle is spinning and which direction it spins:

Use the S word to control how many rpms the spindle turns at.

Most M03 and M04 G-codes are issued right after the S word establishes the rpm.  For example:

S2000 M03

That G-code will start the spindle running clockwise at 2000 rpm.

Example

Black arrow in circular shape surrounded by green and black text.

Note:  For most G-code dialects, the leading 0 is optional.  You may refer to M03 as M3, M04 as M4, and M05 as M5 G-code.

Be the first to know about updates at CNC Cookbook

Join our newsletter to get updates on what's next at CNC Cookbook.