GHaas G-Code Field Guide Get the book

Haas M-codes

Haas M-Codes for Mill and Lathe

Miscellaneous functions switch things on and off: spindle, coolant, doors, chucks, conveyors and subprograms. Many are options — if your machine does not have the hardware, the code will alarm.

Haas mill M-codes

CodeDescription
M00Program stop
M01Optional program stop
M02Program end
M03Spindle on, forward (CW)
M04Spindle on, reverse (CCW)
M05Spindle stop
M06Tool change
M07Shower coolant on (option)
M08Coolant on
M09Coolant off
M104th axis brake engage
M114th axis brake release
M125th axis brake engage
M135th axis brake release
M16Tool change (same as M06)
M19Orient spindle
M30Program end and reset
M31Chip conveyor forward
M33Chip conveyor stop
M34Coolant spigot increment
M35Coolant spigot decrement
M41Low gear override
M42High gear override
M46Jump if pallet loaded
M50Execute pallet change
M59Set output relay
M69Clear output relay
M80Automatic door open
M81Automatic door close
M83Auto air gun on
M84Auto air gun off
M86Tool clamp
M88Through-spindle coolant on
M89Through-spindle coolant off
M95Sleep mode
M96Jump if no input
M97Local subprogram call
M98Subprogram call
M99Subprogram return or loop
M109Interactive user input

Haas lathe M-codes

CodeDescription
M00Program stop
M01Optional program stop
M02Program end
M03Spindle forward
M04Spindle reverse
M05Spindle stop
M08Coolant on
M09Coolant off
M10Chuck clamp
M11Chuck unclamp
M12Auto air jet on
M13Auto air jet off
M14Main spindle clamp
M15Main spindle unclamp
M19Orient spindle
M21Tailstock advance
M22Tailstock retract
M23Chamfer out of thread on
M24Chamfer out of thread off
M30Program end and reset
M31Chip auger forward
M33Chip auger stop
M36Parts catcher on
M37Parts catcher off
M41Low gear
M42High gear
M59Set output relay
M69Clear output relay
M85Automatic door open
M86Automatic door close
M88High-pressure coolant on
M89High-pressure coolant off
M95Sleep mode
M97Local subprogram call
M98Subprogram call
M99Subprogram return or loop
M110Secondary spindle chuck clamp
M111Secondary spindle chuck unclamp
M133Live tool forward
M134Live tool reverse
M135Live tool stop
M143Secondary spindle forward
M144Secondary spindle reverse
M145Secondary spindle stop
M154C axis engage
M155C axis disengage

Subprograms: M97 vs M98 vs M99

M97 jumps to an N block inside the current program and M99 returns from it — ideal for repeated hole patterns. M98 calls a separate O-number program. M99 at the end of a main program loops back to the top, which is how bar-fed lathe jobs run continuously.

O01000 (MAIN)
G00 G90 G54 X0. Y0.
M97 P100 L1   (call local sub at N100)
G55
M97 P100 L1
M30
N100 (HOLE PATTERN SUB)
G81 G99 X1. Y1. Z-0.25 R0.1 F10.
X2.
G80
M99

M-code questions

What is the difference between M30 and M02 on a Haas?

Both end the program. M30 also resets to the top of the program and is the normal way to end a Haas program.

What is the difference between M97 and M98?

M97 calls a subprogram inside the same program using an N block number. M98 calls a separate program by its O number.

What does M01 do?

M01 stops the program only when Optional Stop is switched on at the control. It is used to check parts or tools during prove-out.

How do I turn on coolant on a Haas?

M08 turns flood coolant on and M09 turns it off. Through-spindle coolant on a mill is M88 / M89.

Independent reference. Not affiliated with, sponsored by or endorsed by Haas Automation, Inc. Haas is a trademark of its respective owner. Always confirm codes against your machine's operator manual — options and settings vary by model and software version.