Quick Reference
A one-page lookup of the most common G-codes, M-codes, and formulas. Use this while working — not while learning. For explanations, follow the links to each topic.
- Look up the correct machine dialect
- Read modal-group scope
- Check formula units before calculation
Concept
A reference table is an index to a documented controller function, not a substitute for a complete setup.
Why It Matters
The same number can mean different things on a mill and a lathe. Check machine type, units and active mode before interpreting a block.
How It Works
G-Codes
| Code | Function | Modal? |
|---|---|---|
| G00 | Rapid positioning | Yes (motion group) |
| G01 | Linear feed interpolation | Yes |
| G02 | Clockwise circular arc | Yes |
| G03 | Counterclockwise circular arc | Yes |
| G04 | Dwell (P / X seconds) | No (one block) |
| G17/G18/G19 | XY / XZ / YZ plane selection | Yes |
| G20/G21 | Inch / millimeter units | Yes |
| G40/G41/G42 | Cutter comp off / left / right | Yes |
| G43/G49 | Tool length comp on / off | Yes |
| G53 | Machine coordinates (one block) | No |
| G54–G59 | Work coordinate systems | Yes |
| G70 | Finish turning cycle (lathe, Group 00 non-modal on Haas) | No |
| G71 | Rough turning cycle (lathe, Group 00 non-modal on Haas) | No |
| G76 | Threading cycle (lathe, Group 00 non-modal on Haas) | No |
| G80 | Cancel canned cycle | Yes |
| G81 | Drilling cycle | Yes |
| G82 | Drill with dwell | Yes |
| G83 | Peck drilling cycle | Yes |
| G84 | Right-hand tapping cycle | Yes |
| G85 | Boring cycle | Yes |
| G90/G91 | Absolute / incremental | Yes |
| G94/G95 | Feed per minute / per revolution | Yes |
| G96/G97 | Constant surface speed / fixed RPM | Yes |
| G98/G99 | Cycle retract to initial / R plane | Yes |
M-Codes
| Code | Function |
|---|---|
| M00 | Program stop (unconditional) |
| M01 | Optional stop (switch-dependent) |
| M03/M04/M05 | Spindle CW / CCW / stop |
| M06 | Tool change (mill) |
| M08/M09 | Coolant on / off |
| M30 | Program end and rewind |
| M98 | Call subprogram |
| M99 | Return from subprogram |
Common Formulas
- RPM = Vc × 1000 / (π × D)
- Feed (mm/min) = fz × flutes × RPM
- Feed (mm/rev) = mm/min / RPM
- Cutting time = distance / feed
- MRR (mm³/min) = width × depth × feed
- Tap feed = pitch × RPM
- Drill tip height = (D/2) / tan(point_angle/2)
How to Read These Tables
This reference lists the most common G- and M-codes used on a typical Haas-style mill and lathe. The "Modal" column tells you whether the code stays active after one block (Yes) or applies only to the block it is called in (No). Group 00 codes (like G70/G71 on a lathe) are non-modal: they run once and then the machine returns to whatever motion mode was active before. If you expected G71 to stay on and it did not, check the modal group — it is not a bug, it is how the control is designed.
When in doubt, look up your exact controller model. FANUC, Siemens, Heidenhain, and Haas all use overlapping but not identical code sets. A code that means one thing on Haas may mean something else on FANUC — for example, G90 on a Haas lathe is a stock-removal cycle, not absolute mode. The startup block at the top of every program exists precisely to put the machine in a known state, so these differences cannot leak into the cut.
Use this page as a lookup, not as a tutorial. If a code here is unfamiliar, go back to the lesson that explains it — the code table alone will not teach you how to use it safely.
M-Codes Are Machine-Specific
M03/M04/M05 (spindle on fwd/rev/off) and M08/M09 (coolant on/off) are universal. M06 (tool change) on a Haas mill is a carousel rotation; on a machining center with a magazine it may be a 5-second ATC. M30 (program end and reset) returns to the top on Haas; M02 does not. The exact behavior of M-codes outside the universal list — M19 spindle orientation, M41/M42 gear range, M54 pallet change — is defined by the machine builder. Always check your manual before relying on a non-standard M code.
One block on Haas mills carries only one M code. If you need spindle on and coolant on, write two blocks: S1000 M03, then M08. Combining them in one block can alarm or ignore the second M on some controls. This is a Haas-specific rule; FANUC allows more than one M per block in some configurations.
Check the Machine Column Before Reusing a Code
A code number without a machine type is incomplete information. On the Haas mill, G98 and G99 select the drilling return level. On the Haas lathe, those numbers select feed per minute and feed per revolution. For example, F0.20 at 1000 rpm gives 200 mm/min only when the lathe is in feed-per-revolution mode. A reference lookup should therefore record the machine, units and active group before interpreting the number. Never copy a mill startup block into a lathe simply because both programs use G21 and G54.
Example
In Haas lathe G99, F0.20 at S1000 corresponds to 200 mm/min. This conversion does not describe the mill G99 return-plane command. Record the selected machine before reusing the reference entry.
Common Mistakes
This page is intentionally brief. For each code, follow the link to the detailed lesson. M-codes are machine-specific — always verify against your manual.
About This Reference
This page is a quick lookup, not a tutorial. For how each G/M code is used in a real program, follow the links to the relevant lesson. For controller-specific differences (FANUC vs Siemens vs Heidenhain vs Haas), see the controller dialects lesson. The codes listed here are Haas-mill baseline; M-codes especially vary by machine and by builder — always confirm against your machine's manual before using an unfamiliar M code.
Practice
1. Quick: G83 is what?
Ans
Peck drilling cycle (G83 with Q peck depth).
2. Quick: M08?
Ans
Coolant on.
3. Quick: G41?
Ans
Cutter radius compensation, left side of cut direction.
4. Quick: G96?
Ans
Constant surface speed (CSS) on a lathe — RPM varies with diameter.