Haas M-codes28 codesMill

Haas Mill M-code List

Most M-codes on a Haas mill match Fanuc, which is why a Fanuc program usually runs. The table lists the codes the reference marks for a Haas mill, with the Haas meaning where the operator's manual gives another. The exceptions worth learning are M07, the M88 and M89 through-spindle pair, M97 and three settings.

Haas Mill M-code: 28 codes

Codes in colour link to a full page with a worked example and controller differences; the rest link to their row on the M-code list, except codes whose Haas meaning differs from that list, which have no link.

CodeFunctionNotes
M00Program StopUnconditional program stop. Machine stops and waits for operator to press cycle start. Spindle, coolant, and feed are stopped.Use for mandatory operator intervention: part flip, inspection, manual deburr.
M01Optional StopConditional program stop. Machine stops only if Optional Stop switch is ON. Allows operator to skip stops during production runs.Controlled by Optional Stop switch on control panel. Ignored when switch is off.
M02Program EndEnds the program. Stops spindle, coolant, and feed. Cursor stays at M02 line. Does not rewind program.Use M30 instead for most applications - it rewinds to program start.
M03Spindle On CWStarts the spindle rotating clockwise (when viewed from above on a vertical mill, or from the tailstock on a lathe). Standard direction for right-hand tooling.Always verify S value is set before M03. Allow dwell (G04) after spindle start for heavy cuts.
M04Spindle On CCWStarts the spindle rotating counter-clockwise. Used for left-hand tooling, left-hand tapping, and specific operations.Used with left-hand taps (G74), left-hand helix end mills, and specific boring operations.
M05Spindle StopStops the spindle rotation. Should be called before tool changes and at program end.Spindle continues to coast - may need dwell for complete stop before tool change.
M06Tool ChangeExecutes automatic tool change. Swaps the current tool for the tool specified by the preceding T command. Machine goes through its tool change sequence.CRITICAL: Ensure safe Z position before M06. Many machines auto-retract, but always verify.
M07Shower CoolantThe optional shower pump, not mist. M09 turns it off together with the standard coolant.
M08Flood Coolant OnActivates flood coolant. Standard coolant delivery for most machining operations. Provides cooling, lubrication, and chip evacuation.Turn on after spindle start, turn off before spindle stop to prevent splashing.
M09Coolant OffTurns off all coolant (both mist and flood). Should be called before tool changes and at program end.Always turn off coolant before spindle stop to prevent coolant spray.
M10ClampActivates workholding clamp or 4th axis clamp. Specific function varies by machine configuration.Function is machine-specific. May control rotary axis clamp, pallet clamp, or custom fixture.
M11UnclampReleases workholding clamp or 4th axis clamp. Specific function varies by machine configuration.Function is machine-specific. May control rotary axis clamp, pallet clamp, or custom fixture.
M13Release 5th Axis BrakeNot spindle and coolant on.
M19Spindle OrientationOrients the spindle to a specific angular position and locks it. Required for tool changes with orientation, some boring cycles, and live tooling operations.Required before G76 fine boring, some ATC machines, and B-axis live tooling on lathes.
M21Optional User M Function with M-FinA user relay, one of M21 to M28. Not mirror image, which is G100 and G101 on a Haas mill.
M22Optional User M Function with M-FinA user relay, one of M21 to M28. Not mirror image, which is G100 and G101 on a Haas mill.
M23Optional User M Function with M-FinA user relay, one of M21 to M28. Not mirror image, which is G100 and G101 on a Haas mill.
M30Program End and RewindEnds the program and rewinds to the beginning. Stops spindle, coolant, and feed. Standard program ending code.Preferred over M02 for most applications. Program ready to run again after M30.
M36Pallet Part ReadyNot a part counter.
M41Low Gear SelectSelects low gear range on machines with gear-driven spindles. Provides higher torque at lower RPM.Not all machines have gear ranges. Required on some older or heavy-duty machines.
M42High Gear SelectSelects high gear range on machines with gear-driven spindles. Provides higher RPM at lower torque.High gear for finishing operations and smaller tools that need high RPM.
M48Check Validity of Current ProgramNot feedrate override.
M49Set Status of PalletNot feedrate override.
M50Execute Pallet ChangeNot pallet clamp.
M51Set Optional User M CodeM51 to M58 set the user M codes and M61 to M68 clear them. Not pallet unclamp.
M97Local Subprogram CallCalls a local subprogram within the same program file. Jumps to a block with the specified N number and executes until M99 is encountered, then returns.Haas-specific. Subprogram must end with M99. L parameter specifies repeat count. Simpler than M98, no separate program file needed.
M98Subprogram CallCalls a subprogram. Execution transfers to the subprogram and returns to the next line after M98 completes.Subprogram must end with M99. Useful for repeated patterns and tool paths.
M99Subprogram ReturnReturns from a subprogram to the calling program. Execution continues at the line after the M98 call.Must be at end of every subprogram. In main program, M99 loops back to start.

Where Haas differs

  • M07 is Shower Coolant, the optional shower pump, not mist. M09 stops the shower and the standard coolant together. A post that writes M07 for mist runs the shower pump on a Haas.
  • Through-spindle coolant is M88 on and M89 off. M88 goes before the spindle speed command. TSC comes as a 21 bar (300 psi) or a 69 bar (1,000 psi) system.
  • M34 and M35 move the P-Cool programmable coolant spigot one position away from and towards home.
  • Setting 32, Coolant Override, has three positions: Normal, Ignore (programmed M08 and M88 are ignored and the job runs dry, although the pump still switches on by hand) and Off (an alarm on any attempt to switch coolant on, by hand or from the program).
  • M06 stops the spindle and switches coolant off, through-spindle included, before the changer moves. Setting 81, Tool At Power Up, is the tool the changer loads when Power Up/Restart is pressed; at 0 no tool change happens.
  • M97 P calls a local subprogram by N number inside the same file, with L as the repeat count, and ends with M99. It is Haas only.
  • There is no rigid tapping M-code on the Haas mill list, M29 included, and G84 taps without one, so the M29 a Fanuc post writes ahead of G84 does not belong in a Haas program.
  • M13 releases the 5th axis brake and M21 to M28 are optional user M functions with M-Fin, not spindle-and-coolant or mirror image codes; mirror image on a Haas mill is G100 and G101. M36 is Pallet Part Ready, M48 checks the validity of the current program, M49 sets the status of a pallet, M50 executes a pallet change and M51 to M58 set the optional user M codes. There is no M14, M37 or M60 on the Haas mill list.
  • Setting 56, M30 Restore Default G, decides whether M30 puts modal G codes back to their defaults, G80 and G54 included, so a program that leans on modal state carrying over runs differently with the setting on and off.

Frequently asked questions

Is M07 mist coolant on a Haas?

No. On a Haas mill M07 is the optional shower coolant. Flood is M08, through-spindle is M88, and M09 turns the shower and the flood off. A program posted for a Fanuc mist output will run the shower pump instead. See M07, M08 and M09: coolant.

Why did my Haas run dry with M08 in the program?

Check Setting 32, Coolant Override. In the Ignore position programmed M08 and M88 are ignored, although the coolant still switches on by hand. In the Off position the same block raises an alarm instead.

What is M97 and why does it not work on a Fanuc?

M97 P calls a block inside the same program by its N number, so a repeated pattern lives in the same file rather than in a separate O program. Fanuc has no M97; the usual Fanuc way is M98 P with a separate subprogram. See M-code list.

Does M06 turn the coolant off on a Haas?

Yes. M06 stops the spindle and switches coolant off, through-spindle included, before the changer moves, so the M08 has to be written again after the change. See M06: tool change.

Other controller lists

Last updated 11 Oct 2026