M-codeCoolant ControlMill · Lathe · 3D printer

M07, M08 & M09: Coolant On and Off

M08 starts the flood pump, M07 starts mist on a machine that has it fitted, and M09 stops both. All three are switches rather than moves, and they hold: coolant runs until an M09, the end of the program, a reset, or a tool change on a machine that shuts it off for you. The numbers themselves are wired by the machine builder and not defined by the control, so M07 finds mist on one machine and a shower pump on the next.

Syntax

M07     Mist coolant on
M08     Flood coolant on
M09     Coolant off, mist and flood together

Parameters

AddressMeaningNotes
noneM07, M08 and M09 each stand alonePressure, pump number and nozzle position are machine data or separate builder M codes, never addresses on these blocks

Where the block sits matters more than anything written on it. A coolant M code shares a block with a move on most controls, and the builder's logic decides whether the pump is switched at the start of that move or at the end of it, so the safe habit is to command coolant one block before the cut rather than on it.

Example

O0008 (MANIFOLD BLOCK, 80 X 45 X 40 IN 6082)
G21 G17 G40 G49 G80 G90          (safe start block)
T06 M06                          (50mm face mill, four inserts)
G54                              (part zero at the top left corner)
S2500 M03                        (390m/min in aluminium)
G00 X-40. Y-22.5                 (clear of the block, on the centreline)
G43 H06 Z50. M07                 (tool 6 length, mist for a 0.5mm skim)
G01 Z-0.5 F600                   (down to the finished height)
X120. F2000                      (one pass across the 45mm width)
G00 Z50. M09                     (clear of the job, mist off)
M05                              (spindle stopped for the change)
G49                              (drop the face mill's length)
G91 G28 Z0.                      (Z to machine home, X and Y stay put)
G90 T09 M06                      (8.5mm carbide drill, 5xD)
S5000 M03                        (133m/min)
G00 X20. Y-22.5                  (first hole)
G43 H09 Z50. M08                 (tool 9 length, flood to flush a 44mm hole)
G83 Z-44. R3. Q5. F1000          (peck through 40mm plus the drill point)
X40.                             (the cycle repeats at each position)
X60.
G80 M09                          (cycle off, coolant off)
G00 Z50.
G49
G91 G28 Z0.
M30

Controller differences

ControlBehaviour
FanucThe control does not own these numbers. The M code goes out to the builder's PMC ladder, which pulls in the pump contactor and sends the completion signal back, so whether the pump switches at the start of a block or at the end of it, and whether M30 leaves it running, is ladder logic. Two machines on the same 0i control take different coolant codes when their builders wired them differently.
HaasOn a mill M07 is Shower Coolant, not mist: it runs the optional shower pump, and M09 stops the shower and the standard coolant together. M07 is not on the Haas lathe list. Through-spindle coolant is M88 on and M89 off, M88 goes before the spindle speed command, and the system is either 21 bar (300 psi) or 69 bar (1,000 psi). M34 and M35 move the P-Cool spigot one position away from and towards home. Setting 32, Coolant Override, has three positions: Normal; Ignore, which ignores every programmed M08 and M88 so the job runs dry, although the pump still switches on by hand; and Off, which alarms on any attempt to switch coolant on, by hand or from the program.
Siemens 840DM7, M8 and M9 are not control functions. The NCK predefines M0 to M6, M17, M19, M30, M40 to M45 and M70 and leaves the rest to the machine manufacturer. In ShopMill 7.2 on the 840D sl the coolant M functions sit in display machine data: MD 9680 coolant I (default 8), MD 9681 coolant II (default 7), MD 9668 both at once and MD 9686 coolant off (default 9). The ISO dialect manual lists M08 and M09 among the M functions the machine manufacturer defines, so an ISO M08 runs coolant only where the builder assigned it.
MazakA Mazatrol program carries coolant as M-codes: in an M-code unit, in the M-code items of each tool sequence, or in a manual program unit written in EIA/ISO form. Mazak's EIA/ISO list for machining centres gives M7 mist, M8 coolant, M9 all coolant and air off, and M51 spindle-through coolant; numbers above the common set change from model to model.
GrblM8 and M9 are in the v1.1 supported list. M7 is not compiled in: ENABLE_M7 in config.h has to be uncommented, which adds the mist output on analog pin 4, and until it is, an M7 block stops the stream with error:20. Coolant is toggled while the machine is in Idle, Run or Hold, which is how a jog-and-cut workflow switches it by hand.
MarlinM7, M8 and M9 exist only with COOLANT_CONTROL in Configuration_adv.h, and then only the halves that are enabled: COOLANT_MIST for M7, COOLANT_FLOOD for M8. A laser build with AIR_ASSIST puts the air pump on M8 and M9 instead. Stock printer firmware answers Unknown command and carries on cutting.

What goes wrong

Coolant arrives late far more often than it fails to arrive at all. The pump fills a metre of hose and the nozzles swing before anything lands on the tool, so an M08 written on the same block as the first G01 leaves the opening 20mm of cut dry. In 316 stainless that is the pass that work hardens the surface and glazes the edge. Put M08 on the G43 block above the part, where it has a rapid and the spindle ramp to get going.

Next is a coolant state nobody cancelled. Flood on a tool setter stylus triggers it before the tool arrives, and the length goes into the register short by whatever the film is worth. Write M09 before the retract, and write it again ahead of any probing or measuring cycle.

Third is the machine refusing quietly. On a Haas, Setting 32 on Ignore drops every programmed M08 and M88 while the pump still switches on by hand, so the job runs dry and nothing in the program says so. The Off position alarms instead, which is the answer you want.

Fourth is the tool change itself. A Haas M06 switches the coolant off, through-spindle included, before the changer moves, so the new tool cuts dry unless its own block turns the pump back on. Write M08 or M88 again on the G43 line of every tool, as the example does.

Last, a post that writes M07 for mist runs the shower pump on a Haas mill and stops a Grbl dead at error:20 when ENABLE_M7 was never uncommented in config.h.

Updated 11 Oct 2026