Milling M Codes Definitions

M codes use to control the overall machine and use to perform specific action in CNC programs such as to start & stop the machine, turn ON the spindle, turn coolant ON/OFF and etc. Most of the M codes have default function but can be customized with the use of macro files including the predefined M codes except M02, M06 & M25.

These are some of default M codes used on most CNC Milling Machines types. The M codes are user customizable, the user can edit, change, modify, add, delete or customize base on the application and definition.

M00 = Stop for operator
M01 = Optional stop for operator
M02 = Restart program
M03 = Spindle ON CW
M04 = Spindle ON CCW
M05 = Spindle OFF
M06 = Start tool change
M07 = Mist coolant ON
M08 = Flood coolant ON
M09 = Coolant OFF
M10 = Clamp ON
M11 = Clamp OFF
M14 = Swing arm pot up
M15 = Unclamp tool (air ON)
M16 = Unclamp tool (air OFF)
M18 = Home tool changer
M19 = Orient spindle
M20 = Pickup tool
M21 = Move head up
M22 = Move head to ATC level
M23 = Rotate carousel
M24 = Start too put back
M25 = Move to Z home
M26 = Set axis home
M39 = Air drill
M50 = Index tool plus
M51 = Index tool minus
M60 = Probing macro
M80 = Carousel in
M81 = Carousel out
M91 = Move to minus home
M92 = Move to plus home
M93 = Release motor power
M94 = Turn ON input X
M95 = Turn OFF input X
M98 = Call subprogram
M99 = Return from subprogram
M100 = Wait for input to open
M101 = Wait for input to close
M102 = Restart program
M103 = Programmed action timer
M104 = Cancel programmed action timer
M105 = Move minus to switch
M106 = Move plus to switch
M107 = Output BCD tool number
M108 = Enable override control
M109 = Disable override control
M115 = Protected probing move
M116 = Protected probing move
M120 = Open data file (overwrite existing file)
M121 = Open data file (append to existing file)
M122 = Record position(s) and/or comment in the data field
M123 = Record value and/or comment in data field
M125 = Protected probing move
M126 = Protected probing move