G-Code Guru

Reference49 entries7 controllers

M-code List

Every M-code in the G-Code Guru reference, across Fanuc, Haas, Siemens, Mazak, Okuma, Grbl and Marlin. Sort by any column or type to filter.

49 of 49
Controllers
M00Program StopUnconditional program stop. Machine stops and waits for operator to press cycle start. Spindle, coolant, and feed are stopped.Program ControlMill · Lathe · 3D printerAll 7
M01Optional StopConditional program stop. Machine stops only if Optional Stop switch is ON. Allows operator to skip stops during production runs.Program ControlMill · Lathe · 3D printerAll 7
M02Program EndEnds the program. Stops spindle, coolant, and feed. Cursor stays at M02 line. Does not rewind program.Program ControlMill · Lathe · 3D printerAll 7
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.Spindle ControlMill · Lathe · 3D printerAll 7
M04Spindle On CCWStarts the spindle rotating counter-clockwise. Used for left-hand tooling, left-hand tapping, and specific operations.Spindle ControlMill · Lathe · 3D printerAll 7
M05Spindle StopStops the spindle rotation. Should be called before tool changes and at program end.Spindle ControlMill · Lathe · 3D printerAll 7
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.Tool ChangeMill · Lathe · 3D printerAll 7
M07Mist Coolant OnActivates mist coolant (air/oil mixture). Provides lubrication with minimal coolant volume. Good for aluminum and where flood coolant is undesirable.Coolant ControlMill · Lathe · 3D printerAll 7
M08Flood Coolant OnActivates flood coolant. Standard coolant delivery for most machining operations. Provides cooling, lubrication, and chip evacuation.Coolant ControlMill · Lathe · 3D printerAll 7
M09Coolant OffTurns off all coolant (both mist and flood). Should be called before tool changes and at program end.Coolant ControlMill · Lathe · 3D printerAll 7
M10ClampActivates workholding clamp or 4th axis clamp. Specific function varies by machine configuration.Clamps & FixturesMill · Lathe · 3D printerAll 7
M11UnclampReleases workholding clamp or 4th axis clamp. Specific function varies by machine configuration.Clamps & FixturesMill · Lathe · 3D printerAll 7
M13Spindle CW + Coolant OnStarts spindle clockwise and turns on coolant simultaneously. Combines M03 and M08 in one command.Spindle ControlMill · LatheFanuc, Haas
M14Spindle CCW + Coolant OnStarts spindle counter-clockwise and turns on coolant simultaneously. Combines M04 and M08.Spindle ControlMill · LatheFanuc, Haas
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.Spindle ControlMill · Lathe · 3D printerAll 7
M21Mirror X-Axis OnEnables X-axis mirroring. All X coordinates are reversed. Used for symmetric parts.Program ControlMillFanuc, Haas
M22Mirror Y-Axis OnEnables Y-axis mirroring. All Y coordinates are reversed. Used for symmetric parts.Program ControlMillFanuc, Haas
M23Mirror OffCancels both X and Y axis mirroring. Returns to normal coordinate interpretation.Program ControlMillFanuc, Haas
M29Rigid TappingActivates rigid tapping mode where the spindle and Z-axis are electronically synchronized. Provides more accurate threading than floating tap holders, especially in harder materials.Spindle ControlMillFanuc, Haas, Siemens, Mazak
M30Program End and RewindEnds the program and rewinds to the beginning. Stops spindle, coolant, and feed. Standard program ending code.Program ControlMill · Lathe · 3D printerAll 7
M32Lubrication OnActivates automatic lubrication cycle. Lubricates machine slideways and ballscrews.OtherMill · LatheFanuc, Mazak
M33Lubrication OffDeactivates automatic lubrication or cancels manual lube cycle.OtherMill · LatheFanuc, Mazak
M36Part Counter IncrementIncrements the part counter by one. Used for production tracking and batch counting.Program ControlMill · LatheFanuc, Haas
M37Part Counter DecrementDecrements the part counter by one. Used to correct count after scrapped parts.Program ControlMill · LatheFanuc, Haas
M41Low Gear SelectSelects low gear range on machines with gear-driven spindles. Provides higher torque at lower RPM.Spindle ControlMill · LatheFanuc, Haas, Mazak
M42High Gear SelectSelects high gear range on machines with gear-driven spindles. Provides higher RPM at lower torque.Spindle ControlMill · LatheFanuc, Haas, Mazak
M48Enable Feedrate OverrideEnables feedrate override. Allows operator to adjust feed rate percentage during cutting.Program ControlMill · Lathe · 3D printerAll 7
M49Disable Feedrate OverrideDisables feedrate override. Machine runs at exactly programmed feed rate, ignoring override knob.Program ControlMill · Lathe · 3D printerAll 7
M50Pallet ClampClamps the pallet on machines with pallet systems. Ensures pallet is secured before machining.Clamps & FixturesMillFanuc, Haas
M51Pallet UnclampUnclamps the pallet for removal or pallet change.Clamps & FixturesMillFanuc, Haas
M60Pallet ChangeExecutes automatic pallet change on machines with pallet changer. Swaps workholding pallet for automated production.Program ControlMillFanuc, Haas, Mazak
M82Absolute ExtrusionSets extruder to absolute positioning mode. E values represent total filament extruded from start.Program Control3D printerMarlin, Grbl
M83Relative ExtrusionSets extruder to relative positioning mode. E values represent filament for each move only.Program Control3D printerMarlin, Grbl
M84Disable SteppersDisables stepper motors after a period of inactivity, or immediately if no time specified. Saves power and reduces noise.Program Control3D printerMarlin, Grbl
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.Program ControlMill · LatheHaas
M98Subprogram CallCalls a subprogram. Execution transfers to the subprogram and returns to the next line after M98 completes.SubprogramMill · Lathe · 3D printerAll 7
M99Subprogram ReturnReturns from a subprogram to the calling program. Execution continues at the line after the M98 call.SubprogramMill · Lathe · 3D printerAll 7
M104Set Extruder TemperatureSets the target temperature for the extruder (hotend). Does not wait for temperature to be reached - continues immediately.Other3D printerMarlin, Grbl
M105Report TemperaturesReports current temperatures of all heaters (extruder, bed, chamber). Output includes current and target temperatures. Used for monitoring and host communication.Other3D printerMarlin, Grbl
M106Part Cooling Fan OnTurns on the part cooling fan at the specified speed. Essential for PLA, bridges, and overhangs.Coolant Control3D printerMarlin, Grbl
M107Part Cooling Fan OffTurns off the part cooling fan. Equivalent to M106 S0.Coolant Control3D printerMarlin, Grbl
M109Wait for Extruder TemperatureSets extruder temperature and waits for it to be reached before continuing. Blocks execution until at temperature.Other3D printerMarlin, Grbl
M117Display MessageDisplays a text message on the printer's LCD screen. Useful for showing progress updates, instructions, or status messages during a print.Program Control3D printerMarlin, Grbl
M140Set Bed TemperatureSets the target temperature for the heated bed. Does not wait - continues immediately. Use M190 to wait.Other3D printerMarlin, Grbl
M190Wait for Bed TemperatureSets bed temperature and waits for it to be reached. Blocks execution until bed is at target temperature.Other3D printerMarlin, Grbl
M200Set Filament DiameterSets the filament diameter for volumetric extrusion mode. When enabled, E values represent cubic millimeters instead of linear filament length.Program Control3D printerMarlin
M400Wait for Moves to FinishWaits for all buffered moves to complete before processing the next command. Ensures synchronization.Program Control3D printerMarlin, Grbl
M420Bed Leveling StateControls the bed leveling compensation. Can enable/disable stored mesh and show leveling data.Program Control3D printerMarlin
M600Filament ChangeInitiates a filament change sequence. Pauses print, retracts filament, and prompts user to load new filament.Program Control3D printerMarlin

Descriptions are the one-line entries from the app's reference database. Controller support marks whether a code exists in that dialect, not that it behaves identically; the full pages cover the differences.