M codes

Fanuc CNC M-Codes List

Fanuc CNC – Complete M-Codes List (English)

M-Code Function Description
M00Program stopStops the machine until the operator restarts
M01Optional stopStops machine if optional stop switch is ON
M02End of programEnds the program normally without rewind
M03Spindle on clockwiseTurns spindle on in clockwise direction
M04Spindle on counterclockwiseTurns spindle on in counterclockwise direction
M05Spindle stopStops the spindle
M06Tool changeInitiates automatic tool change
M07Coolant on (mist)Turns on mist coolant
M08Coolant on (flood)Turns on flood coolant
M09Coolant offTurns off all coolant
M10Chuck clampClamps the chuck (used in lathes)
M11Chuck unclampReleases the chuck
M12Tool clampClamps the tool in the spindle
M13Spindle on CW and coolant onStarts spindle clockwise and coolant on
M14Spindle on CCW and coolant onStarts spindle counterclockwise and coolant on
M15Tailstock advanceMoves tailstock forward (turning)
M16Tailstock retractMoves tailstock back
M19Spindle orientationOrients spindle to a fixed position
M20Manual pulse generator enableEnables MPG handwheel
M21Manual pulse generator disableDisables MPG handwheel
M30End of program with rewindEnds program and rewinds to start
M41Low gear (feed range)Sets machine to low feed gear (lathe)
M42High gear (feed range)Sets machine to high feed gear (lathe)
M43Mid gear (feed range)Sets machine to mid feed gear (lathe)
M44Gear shift upShifts gear up
M45Gear shift downShifts gear down
M48Feed override enableEnables feedrate override
M49Feed override cancelDisables feedrate override
M60Automatic pallet changeStarts pallet change cycle
M98Call subprogramCalls a subprogram (e.g., O1234)
M99Return from subprogramReturns to main program after subprogram