Planes, Units & Numeric Conventions
Plane selection and units seem trivial but cause real scrap parts. This page explains G17/G18/G19, G20/G21, and why the number 100 might mean 100 mm or 1.0 inch.
- Select a plane and its centre addresses
- Convert units correctly
- Explain controller-dependent numeric entry
Concept
G17 selects the XY plane (mill default). G18 selects the XZ plane (lathe default). G19 selects the YZ plane. Plane selection matters for circular interpolation: the I/J/K vectors and G02/G03 direction are interpreted in the selected plane. Program an arc in G17 when the machine is in G18, and the circle comes out in the wrong plane.
G21 = metric (mm). G20 = inch. Everything in the program — coordinates, feeds, offsets — follows the active unit mode. Mixing mm and inch is catastrophic: a program written in mm run in inch mode cuts everything 25.4× off.
The plane also affects which I, J, and K values the controller expects when programming arcs. In G17 (XY), I and J are the arc center offsets in X and Y. In G18 (XZ), I and K are the center offsets in X and Z. In G19 (YZ), J and K are the center offsets in Y and Z. The unused address is not necessarily ignored; the controller may use it for another purpose or reject the block. Switching planes without understanding this causes arcs that go in the wrong direction or radius. This is why the startup block always sets the plane explicitly — it must match how the rest of the program is written.
Unit errors are not caught by syntax checks. A program that looks perfectly correct will move 25.4 times too far if G20 is active instead of G21, or shrink to 1/25.4 of the intended distance if G21 is active instead of G20. Always confirm the unit mode on the controller display before pressing cycle start. The G20 or G21 state is part of the machine modal display, not just the program — it persists between programs until changed.
Many shops standardize on G21 (metric) and G17 (XY) in their startup block for milling work, but a lathe program that uses G18 (XZ plane) for turning arcs must set it explicitly at the start. Failing to set the correct plane can cause the controller to reject arc commands or compute them in the wrong orientation.
Why It Matters
A G20/G21 mismatch produces parts that are 25.4 times too small or too large. Plane errors cause arcs to be in the wrong plane — the tool makes a circular move in XZ instead of XY, producing a groove instead of a circle. These errors are not caught by syntax checkers; they may be caught by graphical verification, travel checks, or inspection — not only by final measurement. Always set units explicitly in the startup block.
How It Works
Plane Selection
| Code | Plane | Used For |
|---|---|---|
| G17 | XY | Milling, drilling, pocketing (mill default) |
| G18 | XZ | Lathe turning, facing (lathe default) |
| G19 | YZ | Rare; special applications |
Units
G21 mm: X25.4 means 25.4 mm. G20 inch: X1.0 means 1.0 inch. Always confirm units before running. On Haas, the default is set by machine parameter; the G-code should still explicitly command G21 (or G20) in the startup block.
Decimal Point Convention
On Haas controls, Setting 162 determines whether numbers without a decimal point are treated as if they had one (e.g., X100 = 100.0) or scaled down. The safe habit regardless of setting: always write the decimal point — X100. or X100.0. This removes ambiguity when programs are moved between machines or settings.
Example
A program written in mm (G21) drills at X25.4 Y12.7. If you forget G21 and the machine defaults to G20 (inch), X25.4 means 25.4 inches = 645.16 mm — 25.4 times larger than intended. Whether this exceeds travel depends on the machine, work offset, and current limits; even if it does not overtravel, it can still cause a collision or a badly wrong part. Always set G21 explicitly in the startup block.
Why Plane and Units Are Not Optional
G17/G18/G19 tells the controller which two axes the arc (G02/G03) lies in. On a mill, G17 (XY) is the default. On a lathe, G18 (XZ) is the default. If you cut an arc on a mill in G18 by mistake, the controller interpolates in XZ and the arc goes where you did not expect. The plane also defines which I/J/K address is the arc center: I is X in G17, I is X in G18, K is Z in G18.
G20/G21 sets inch vs metric. Getting units wrong is the classic beginner crash: a program written in mm, run with G20 active, moves 25.4 times too far. A 100 mm move becomes 2540 mm. The startup block writes G21 explicitly so the previous program's G20 cannot leak in. If you ever see the tool move 25 times farther than expected, check G20/G21 first.
G90 on a mill selects absolute coordinates; G94 selects feed per minute. On a lathe, feed per revolution is common, but the G-code that selects it depends on the controller (on a Haas mill, G95 selects mm/rev; on a Haas lathe, G99 is often used — check your manual). Mixing feed units matters: if the spindle turns N rpm, F in mm/rev corresponds to F×N mm/min. At N=500, F100 mm/rev is 50000 mm/min, not 100 mm/min. The ratio depends on rpm, not a fixed 100×.
Common Mistakes
- Omitting G21/G20 — relying on the machine default is dangerous. Always set units explicitly.
- Selecting the wrong plane — if you intend to cut an XY arc but G18 (XZ) is active, the circular move goes in the wrong plane. Mills can intentionally use G18 for XZ arcs, but the plane must match the intended contour.
- Writing 100 without a decimal — interpretation depends on the control and its numeric-input settings. Always write 100. or 100.0.
- Changing units mid-program — G20/G21 should only appear in the startup block, never mid-cut.
Practice
1. You program X10.5 in G21. What is the actual position?
Show answer
10.5 mm.
2. Same X10.5 in G20. What is that in mm?
Show answer
10.5 inches = 266.7 mm. This is why unit mismatch is catastrophic.
3. Which plane should a mill use for pocketing?
Show answer
G17 (XY plane). G18 would make circular moves in XZ, producing arcs in the wrong plane.
Sources
- Haas G17 Plane Selection — supports G17/G18/G19 plane codes on mills.
- Haas Setting 162 — controls whether numbers without a decimal point are treated as having one.
- Program examples and speeds/feeds are classroom teaching assumptions; verify against tooling catalogs and machine documentation.