Code  DescriptionMilling
( M )
( T )
Corollary info
M00Compulsory stopMTNon-optional—machine will always stop upon reaching M00 in the program execution.
M01Optional stopMTMachine will only stop at M01 if operator has pushed the optional stop button.
M02End of programMTNo return to program top; may or may not reset register values.
M03Spindle on (clockwise rotation)MTThe speed of the spindle is determined by the address S, in surface feet per minute. The right-hand rule can be used to determine which direction is clockwise and which direction is counter-clockwise.
Right-hand-helix screws moving in the tightening direction (and right-hand-helix flutes spinning in the cutting direction) are defined as moving in the M03 direction, and are labeled "clockwise" by convention. The M03 direction is always M03 regardless of local vantage point and local CW/CCW distinction.
M04Spindle on (counterclockwise rotation)MTSee comment above at M03.
M05Spindle stopMT 
M06Automatic tool change (ATC)MT (some-times)Many lathes do not use M06 because the T address itself indexes the turret.
Programming on any particular machine tool requires knowing which method that machine uses. To understand how the T address works and how it interacts (or not) with M06, one must study the various methods, such as lathe turret programming, ATC fixed tool selection, ATC random memory tool selection, the concept of "next tool waiting", and empty tools. These concepts are taught in textbooks such as Smid,[1] and online multimedia (videos, simulators, etc); the latter are usually paywalled to pay back the costs of their development. They are used in training classes for operators, both on-site and remotely (e.g., Tooling University).
M07Coolant on (mist)MT 
M08Coolant on (flood)MT 
M09Coolant offMT 
M10Pallet clamp onM For machining centers with pallet changers
M11Pallet clamp offM For machining centers with pallet changers
M13Spindle on (clockwise rotation) and coolant on (flood)M This one M-code does the work of both M03 and M08. It is not unusual for specific machine models to have such combined commands, which make for shorter, more quickly written programs.
M19Spindle orientationMTSpindle orientation is more often called within cycles (automatically) or during setup (manually), but it is also available under program control via M19. The abbreviation OSS (oriented spindle stop) may be seen in reference to an oriented stop within cycles.
M21Mirror, X-axisM  
M21Tailstock forward T 
M22Mirror, Y-axisM  
M22Tailstock backward T 
M23Mirror OFFM  
M23Thread gradual pullout ON T 
M24Thread gradual pullout OFF T 
M30End of program with return to program topMT 
M41Gear select - gear 1 T 
M42Gear select - gear 2 T 
M43Gear select - gear 3 T 
M44Gear select - gear 4 T 
M48Feedrate override allowedMT 
M49Feedrate override NOT allowedMTThis rule is also called (automatically) within tapping cycles or single-point threading cycles, where feed is precisely correlated to speed. Same with spindle speed override and feed hold button.
M52Unload Last tool from spindleMTAlso empty spindle.
M60Automatic pallet change (APC)M For machining centers with pallet changers
M98Subprogram callMTTakes an address P to specify which subprogram to call, for example, "M98 P8979" calls subprogram O8979.
M99Subprogram endMTUsually placed at end of subprogram, where it returns execution control to the main program. The default is that control returns to the block following the M98 call in the main program. Return to a different block number can be specified by a P address. M99 can also be used in main program with block skip for endless loop of main program on bar work on lathes (until operator toggles block skip).