M code list
M-Codes (Miscellaneous Codes) are commands used in CNC programming to control machine functions that aren’t
related to movement. While G-codes handle motion, M-codes tell the machine what else to do—like turning the
spindle on or off, activating coolant, or stopping the program.
| Name | Function | Machine type |
|---|---|---|
| M00 | Stop executing program | Mill / Lathe |
| M01 | Optional stop executing program | Mill / Lathe |
| M02 | End of program | Mill / Lathe |
| M03 | Spindle clockwise rotation | Mill / Lathe |
| M04 | Spindle counterclockwise rotation | Mill / Lathe |
| M05 | Spindle stop | Mill / Lathe |
| M08 | Coolant on | Mill / Lathe |
| M09 | Coolant off | Mill / Lathe |
| M10 | C axis clamp (HAAS) | Lathe |
| M11 | C axis unclamp (HAAS) | Lathe |
| M13 | Spindle clockwise rotation and coolant on | Mill / Lathe |
| M14 | Spindle counterclockwise rotation and coolant on | Mill / Lathe |
| M30 | End of program and return to the beginning of the program | Mill / Lathe |
| M33 | live tool cw | Lathe |
| M34 | live tool ccw | Lathe |
| M35 | C axis clamp | Lathe |
| M36 | C axis unclamp | Lathe |
| M50 | C axis mode off | Lathe |
| M51 | C axis mode on | Lathe |
| M90 | C axis mode off | Lathe |
| M91 | C axis mode on | Lathe |
| M97 | Local subroutine call | Mill / Lathe |
| M98 | Subroutine call | Mill / Lathe |
| M99 | Subroutine end and return to the main program | Mill / Lathe |
| M109 | C axis mode off | Lathe |
| M110 | C axis mode on | Lathe |
| M133 | live tool cw (HAAS) | Lathe |
| M134 | live tool ccw (HAAS) | Lathe |
| M154 | C axis mode on (HAAS) | Lathe |
| M155 | C axis mode off (HAAS) | Lathe |