Reference

M-Code List — CNC Miscellaneous Codes Explained

Complete CNC M-code list: spindle, coolant, tool change, program stop, subprogram and machine-specific codes for Fanuc and Haas, with examples.

CodeFunctionMachine
M00Program StopBoth
M01Optional StopBoth
M02End of ProgramBoth
M03Spindle On ClockwiseBoth
M04Spindle On Counter-ClockwiseBoth
M05Spindle StopBoth
M06Tool ChangeMill
M07Mist Coolant OnBoth
M08Flood Coolant OnBoth
M09Coolant OffBoth
M10Clamp / Brake On (builder specific)Both
M11Clamp / Brake Off (builder specific)Both
M13Spindle CW + Coolant On (builder specific)Both
M14Spindle CCW + Coolant On (builder specific)Both
M19Spindle OrientationBoth
M23Thread Chamfer (Pull-Out) On — LatheLathe
M24Thread Chamfer (Pull-Out) Off — LatheLathe
M29Rigid Tapping Mode (Fanuc)Both
M30Program End and RewindBoth
M31Chip Conveyor Forward (Haas)Both
M33Chip Conveyor Stop (Haas)Both
M41Low GearBoth
M42High GearBoth
M48Feed/Speed Override EnableBoth
M49Feed/Speed Override DisableBoth
M50Pallet Change Sequence (Haas)Mill
M60Pallet Change / Automatic Work ChangeMill
M62Digital Output On, Synchronised (LinuxCNC)Mill
M66Wait for Input (LinuxCNC)Mill
M83Auto Air Jet On (Haas)Mill
M84Auto Air Jet Off (Haas)Mill
M88Through-Spindle Coolant On (Haas)Mill
M89Through-Spindle Coolant Off (Haas)Mill
M95Sleep Mode (Haas)Both
M96Jump if Input Is Zero (Haas)Both
M97Local Subprogram Call (Haas)Both
M98Subprogram CallBoth
M99Subprogram Return / LoopBoth
M109Interactive User Input (Haas)Both
M198Subprogram Call from External MemoryBoth