← Back to CNC Programming

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.

Level: BScope: Machine-neutral concepts; controller-specific examples are labelledPrerequisite: Modal State and Program Execution
After this lesson, you can:
Haas mill modal groupsSix boxes show the Haas mill groups; group zero is non-modal.Motion / 01G00 G01 G02 G03Plane / 02G17 G18 G19Units / 06G20 G21Cutter comp / 07G40 G41 G42Drilling / 09G80 G81 G83 G84Non-modal / 00G04 G28
The group number is not the G-code number. The one-active-mode rule describes modal groups; group 00 is non-modal.

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

G-Codes
CodeFunctionModal?
G00Rapid positioningYes (motion group)
G01Linear feed interpolationYes
G02Clockwise circular arcYes
G03Counterclockwise circular arcYes
G04Dwell (P / X seconds)No (one block)
G17/G18/G19XY / XZ / YZ plane selectionYes
G20/G21Inch / millimeter unitsYes
G40/G41/G42Cutter comp off / left / rightYes
G43/G49Tool length comp on / offYes
G53Machine coordinates (one block)No
G54–G59Work coordinate systemsYes
G70Finish turning cycle (lathe, Group 00 non-modal on Haas)No
G71Rough turning cycle (lathe, Group 00 non-modal on Haas)No
G76Threading cycle (lathe, Group 00 non-modal on Haas)No
G80Cancel canned cycleYes
G81Drilling cycleYes
G82Drill with dwellYes
G83Peck drilling cycleYes
G84Right-hand tapping cycleYes
G85Boring cycleYes
G90/G91Absolute / incrementalYes
G94/G95Feed per minute / per revolutionYes
G96/G97Constant surface speed / fixed RPMYes
G98/G99Cycle retract to initial / R planeYes

M-Codes

M-Codes
CodeFunction
M00Program stop (unconditional)
M01Optional stop (switch-dependent)
M03/M04/M05Spindle CW / CCW / stop
M06Tool change (mill)
M08/M09Coolant on / off
M30Program end and rewind
M98Call subprogram
M99Return from subprogram

Common Formulas

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.

Sources