Haas M-codes22 codesLathe

Haas Lathe M-code List

The Haas lathe list here is shorter than the mill's: stops and ends, spindle and coolant, clamps, the parts catcher, gear ranges and the M97 and M98 subprogram calls. M21 to M23, M29, M50, M51 and M60 are missing because the reference ties them to milling, and M07, M48 and M49 are not on the Haas lathe code list.

Haas Lathe M-code: 22 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.
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.
M13Air Jet OffNot spindle and coolant on.
M14Main Spindle ClampNot 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.
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.
M36Parts Catcher OnNot a part counter.
M37Parts Catcher OffNot 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.
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

  • The lathe list drops M21 to M23, M29, M50, M51 and M60 because the reference marks those as mill codes. That is how the app's data is filtered, not a statement about the Haas lathe, where M21 and M22 advance and retract the tailstock, M23 turns on angle out of thread and M51 to M58 set optional user M codes.
  • M07 is not on the Haas lathe code list: coolant is M08 on and M09 off. On the mill M07 is the optional shower coolant, not mist.
  • M13 is air jet off and M14 main spindle clamp, not spindle-and-coolant codes, and M36 and M37 switch the parts catcher on and off rather than counting parts. M48 and M49 are not on the lathe code list.
  • M88 and M89 switch the optional high-pressure coolant on and off.
  • Setting 32 governs M08 and M88 on the lathe as well. On the mill Setting 32 is Coolant Override, where Ignore drops programmed coolant commands and Off alarms on them.
  • M97 P calls a local subprogram by N number inside the same program, with L as the repeat count. Haas only.
  • M41 and M42 are gear overrides: they hold the spindle in low or high gear on machines that have one, where the S word would otherwise pick the gear. The reference lists them for Fanuc, Haas and Mazak and notes that not every machine has a gearbox.
  • M19 spindle orientation is on the Haas lathe list as well as the mill's. On the lathe it is an option, with P or R for the angle.

Frequently asked questions

Why are there fewer M-codes on the lathe list than the mill list?

Because the reference marks M21 to M23, M29, M50, M51 and M60 as milling codes, so the lathe filter leaves them out. On a Haas lathe M21 to M23 are tailstock and threading codes instead. M07, M48 and M49 are left out as well, because the Haas lathe code list does not have them. The Haas mill M-code list has the rest.

Is M07 mist coolant on a Haas lathe?

No. M07 is not on the Haas lathe code list at all: M08 is coolant on, M09 is coolant off, and M88 and M89 switch the optional high-pressure coolant. On a Haas mill M07 is the optional shower coolant, not mist. See M07, M08 and M09: coolant.

How do I repeat a section of the program on a Haas lathe?

M97 P with the N number of the block to jump to and L for the repeat count, ending the section with M99. On a Fanuc lathe the usual way is M98 P and a separate subprogram. See M-code list.

Other controller lists

Last updated 11 Oct 2026