G17, G18 and G19: Plane Selection

G17, G18 and G19 choose which plane the machine works in for arcs and other plane-based features. G17 is XY, G18 is XZ and G19 is YZ.

A circular arc always lies in a plane. G17, G18 and G19 tell the machine which one:

Code Plane Arc center words Arc direction judged looking from
G17 XY I, J +Z, down at the table
G18 XZ I, K +Y
G19 YZ J, K +X

All three are modal. G17 is the default on almost every mill and router, and many CAM programs put it on the first lines of every program. Lathes, which work in X and Z, usually default to G18.

What the plane affects

  • Arcs. G02 and G03 cut in the active plane, and their clockwise or counter-clockwise direction is judged from the positive end of the third axis.
  • Cutter compensation. G41 and G42 offset the tool within the active plane.
  • Drilling cycles. On many controls, canned cycles drill along the axis perpendicular to the active plane, which is Z in G17.

Watch the direction in G18

The direction rule trips people up most in G18. Looking from +Y, the Z axis points to the right and X points up. So a G02 from X40 to X60 at Z0 in G18 goes clockwise in that view, which takes it below Z0 in between, not above. If an XZ arc dips when you expected a hump, swap G02 and G03.

Example: one arc in each plane

The program cuts the same kind of arc three times, once in each plane. The G17 arc is a half circle seen from above. The G18 and G19 arcs start and end at Z0 and dip about 2.7 mm into the material, along X and then along Y.

(G17, G18 and G19 example: one arc in each plane)
G21 G90 G54
T1 M6 (6 mm ball end mill)
S12000 M3
G0 Z10
(G17: XY plane, a half circle seen from above)
G17
G0 X0 Y0
G0 Z2
G1 Z-1 F200
G2 X20 Y0 R10 F600
G0 Z10
(G18: XZ plane, an arc that dips down and back up in X)
G18
G0 X40 Y0
G0 Z0
G2 X60 Z0 R20 F600
G0 Z10
(G19: YZ plane, the same shape along Y)
G19
G0 X80 Y0
G0 Z0
G3 Y20 Z0 R20 F600
G0 Z10
G17
M5
M30
Open this example in CutViewer

Open it in CutViewer and switch between the Top, Front and Right views to see each arc in its own plane.

Line by line:

  • G17 then G2 X20 Y0 R10 cuts a half circle in XY that bulges toward +Y.
  • G18 then G2 X60 Z0 R20 cuts in XZ. Clockwise as seen from +Y, it dips below Z0 between X40 and X60.
  • G19 then G3 Y20 Z0 R20 cuts in YZ. Counter-clockwise as seen from +X, it dips below Z0 between Y0 and Y20.
  • The final G17 puts the machine back in its usual plane, so the next program doesn't inherit G19.

How CutViewer shows G17, G18 and G19

CutViewer tracks the active plane and draws arcs in XY, XZ or YZ accordingly, with I/J/K or R. The active plane is shown with the other modes for the current line.

Frequently Asked Questions

What does G17 mean in G-code?

G17 selects the XY plane. Arcs (G02 and G03) are cut in X and Y, and their direction is judged looking down from above. It's the default on almost every milling machine and router.

When would I use G18 or G19 on a mill?

When an arc needs to be vertical, for example rounding over an edge with a ball end mill, cutting a vertical radius, or in 3D finishing toolpaths. Most hand-written programs only use G17.

Which plane does a lathe use?

Lathes work in X and Z, so G18 is usually the default on a lathe.

Which I, J, K words go with each plane?

G17 (XY) uses I and J, G18 (XZ) uses I and K, and G19 (YZ) uses J and K. The third word, if given, is ignored or used for helical moves, depending on the control.

Check your own program before you cut: open it in CutViewer to see the toolpath in 3D, the run time and any problems.

Open CutViewer