G and M codes are assigned numbers, and assigned numbers are what memory drops first. A mnemonic fixes that by giving the number a hook, and machining has accumulated a small folklore of good ones. Here is the working collection, organized by how much each hook carries, plus the practice step that makes hooks unnecessary.
The single-code hooks
| Code | Hook | Why it lands |
|---|---|---|
G00 | The extra zero does zero cutting | Rapid never touches the part |
G01 | The one that does the work | Feed move, the partner fact |
G91 | Ends in 1, adds one step at a time | Incremental positioning |
G21 | The bigger number, the smaller unit | 21 picks millimeters |
M30 | The newsroom -30- end mark | Journalists ended stories with it |
The G00 hook is the one to teach first, because it anchors the most consequential beginner distinction, rapid versus feed, the pair fully unpacked in G00 vs G01. The M30 hook is the collection’s best piece of trivia: reporters really did type -30- to end a story, and the program-end code happens to rhyme with it perfectly.
The pattern hooks, which carry whole families
Single-code rhymes are retail; structural patterns are wholesale. Three patterns cover more codes than every rhyme combined. The off switch follows its on switches: M03 and M04 start the spindle and M05 stops it; M07 and M08 start coolant and M09 stops it, two ons then the off, twice in a row, the pattern detailed in the coolant-code family. Two before three, CW before CCW: the arcs sort themselves because the numeric order matches the alphabetical order of clockwise and counterclockwise, the distinction drawn in G02 vs G03. Z follows the spindle: on every machine type, vertical mill or lathe, the Z axis is the spindle centerline, the anchor that ends the lathe X and Z confusion.
The contrast hooks, for look-alike pairs
Some codes are confusable precisely because they are neighbors, and the hook is the difference itself. G41 versus G42: left before right, one before two, alphabetical again. G90 versus G91: the zero sits still at the origin (absolute), the one steps forward (incremental). Drilling these as deliberate contrast pairs, side by side until each answers instantly, beats memorizing them separately, and it is the standard fix for transposition-prone readers described in dyslexia and CNC programming.
Why hooks alone are not enough
A mnemonic is an encoding device: it gets the code into memory through a side door. At the control you need retrieval speed, the answer arriving before the hook does, and that comes only from active recall: self-testing, repeating misses, and letting spaced repetition schedule the reviews. The healthy life cycle of a mnemonic is planned obsolescence: it carries the code for the first week, then retrieval practice wears a direct path and the hook quietly retires. If you still need the rhyme after a month, the code needs more drilling, not a better rhyme.
A concrete week: day one, learn the five single-code hooks; days two and three, add the three family patterns; the rest of the week, drill everything as recall questions, hooks allowed but not required. By the following Monday the everyday set answers itself, which was the goal the whole time, the same arc as how to memorize G-code faster.
Bottom line
The hooks that earn their keep: zero-cutting G00, off-follows-on in both M-code families, two-before-three for the arcs, Z follows the spindle, the stepping G91, and the newsroom -30- behind M30. Use them to encode, then drill to retrieve until the hooks go quiet. The drilling half runs free on the G-code practice hub, and it is the half that lasts.
Sources
Frequently asked questions
What are good mnemonics for G-codes and M-codes?
Zero-cutting G00, the off-follows-on pattern in the spindle and coolant families, two-before-three for G02/G03, stepping G91, Z follows the spindle, and the newsroom -30- end mark behind M30.
Do mnemonics actually work for learning CNC codes?
Yes, as encoding hooks that get arbitrary numbers into memory. Recall practice then converts hooked codes into instant, hook-free recognition.
What is the easiest mnemonic to start with?
G00, zero cutting: the code with the extra zero never cuts. It anchors the rapid-versus-feed distinction and gives you G01 for free.
What is the best way to make G-code mnemonics permanent?
Drill them into retrieval. A free app like G-Code Sprint quizzes the codes and repeats whichever ones you miss until answers arrive before the hooks do.
G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.