Machinists moving between a lathe and a mill often assume they face two different M-code languages. They do not. Most of the list is identical, one structural difference actually matters, and the rest is machine-builder trivia nobody should memorize. Organize the codes that way and the memory problem mostly dissolves.
Which M-codes are the same on both machines?
The core actions of any CNC machine, stop, spin, cool, end, use the same codes everywhere, inherited from the common standard described in the numerical control history and listed identically in the LinuxCNC M-code reference:
| Code | Action | Lathe | Mill |
|---|---|---|---|
M00 / M01 | Program stop / optional stop | Same | Same |
M03 / M04 | Spindle forward / reverse | Same | Same |
M05 | Spindle stop | Same | Same |
M08 / M09 | Coolant on / off | Same | Same |
M30 | Program end and rewind | Same | Same |
This is layer one, and it is the bulk of any program’s M-codes. Learn it once and it transfers across every machine in the shop, which is the same economy behind the common M-codes for CNC beginners.
What is the one difference worth memorizing?
The tool change. On a machining center, the T word stages a tool and M06 performs the change, because a changer arm has to physically swap tools in the spindle. On a turret lathe there is no swap: the turret simply rotates. So the T word does the entire job, and it carries the offset with it:
| Machine | Tool change | What the words do |
|---|---|---|
| Mill | T2 M06 | T stages tool 2, M06 swaps it in |
| Lathe | T0202 | Indexes turret to tool 2, applies offset 2 |
The lathe form packs two facts into four digits: the first pair picks the tool, the second pair picks the offset register, and T0200 cancels the offset. One sentence holds the whole difference: on a mill an M-code changes the tool, on a lathe the T word does everything. That sentence is the highest-value piece of memorization on this page.
What should you refuse to memorize?
Everything above the core. Chuck clamp and unclamp, tailstock advance, parts catchers, bar feeders, pallet changers: real machines control these with M-codes, and the numbers differ by machine builder, sometimes between two lathes standing next to each other. The standard code cheat sheets stop at the common set for exactly this reason. Treat builder codes as look-up material that lives in the machine’s manual, and treat any unfamiliar M-code in a program as something to verify before cycle start, never to guess.
A concrete example of why: a machinist who learned M10 as a chuck clamp on one lathe assumed it on the next brand, where the builder used it for something else entirely. The program ran, the chuck never clamped, and only a careful first-article check caught it. Builder codes do not transfer; that is the lesson.
How do you actually drill the difference?
The three-layer split turns into a short practice plan. Drill layer one, the shared core, with active recall until every code answers itself instantly; that is a few minutes a day for a week, the same method as how to memorize G-code faster. Layer two is a single fact, the tool-change sentence above, plus its neighbors in context: the spindle-direction pairings from left-hand threading with M04 vs M03 and the lathe cycle structure from G71 vs G72 roughing both lean on the same core codes. Layer three is deliberately not drilled at all.
Bottom line
Lathe and mill M-codes share their core: stops, spindle, coolant, and program end are identical and learned once. The difference worth memorizing is the tool change, T plus M06 on a mill versus the all-in-one T word on a lathe. Builder-specific codes above the core get looked up, never assumed. Drilling the core until it is reflex is what a routine on the G-code practice hub is built for.
Sources
Frequently asked questions
How do you remember lathe M-codes vs mill M-codes?
Split them into three layers: the universal core (stops, spindle, coolant, end) learned once; the single structural difference, mills change tools with T plus M06 while lathes index the turret with the T word alone; and builder-specific codes, which you look up per machine.
Do lathes use M06 for tool changes?
Most turret lathes do not. T0202 rotates the turret to tool 2 and applies offset 2 with no M06. Machining centers need M06 because a changer arm must physically swap the tool.
Which M-codes are the same on every machine?
The core set: M00, M01, M03, M04, M05, M08, M09, and M30. They trace back to the common standard, which is why they transfer between machines and shops.
What is the best way to memorize M-codes for both lathe and mill?
Drill the shared core with active recall, then add the tool-change difference as one fact. A free app like G-Code Sprint quizzes the everyday M-codes and repeats whichever ones you miss.
G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.