---
title: "G17, G18, G19: Plane Selection in G-Code Explained"
description: "G17 selects the XY plane, G18 the XZ plane, and G19 the YZ plane. Here is what plane selection controls, why arcs depend on it, and when to switch."
url: https://gcodepractice.com/journal/g17-g18-g19-plane-selection-explained/
canonical: https://gcodepractice.com/journal/g17-g18-g19-plane-selection-explained/
author: "Lawrence Arya"
authorUrl: https://www.linkedin.com/in/vibecoding/
published: 2026-06-04
updated: 2026-06-04
category: "Code reference"
tags: ["g-code", "g17", "g18", "g19", "plane", "beginner"]
lang: en
---

# G17, G18, G19: Plane Selection in G-Code Explained

> **TL;DR** G17 selects the XY plane, G18 the XZ plane, and G19 the YZ plane. The active plane sets where arcs (G02 and G03) are drawn, which I, J, K words define the arc center, and which axis is the tool axis for drilling and tool length offset. G17 is the mill default; G18 is common on lathes.

An arc is a circle drawn in two axes, but a machine has three. `G17`, `G18`, and `G19` tell the control which two axes the current arc, and several other operations, live in. Most of the time you set the plane once and forget it, but when an arc bends the wrong way, plane selection is usually why.

## What the active plane controls

Plane selection does more than steer arcs. The active plane sets three things at once, as laid out in the [LinuxCNC plane-selection reference](https://linuxcnc.org/docs/html/gcode/g-code.html):

- The two axes an arc (`G02` or `G03`) is drawn in.
- The sense of clockwise versus counterclockwise, judged from the positive direction of the third axis.
- The tool axis used for drilling cycles and tool length offset.

That is why the plane matters even on a simple part: it is the frame of reference for circular motion and for which way the drill goes.

## G17, G18, and G19

Each code names a plane by its two axes, leaving the third as the tool axis:

| Code | Plane | Axes | Tool axis | Common on |
| --- | --- | --- | --- | --- |
| `G17` | XY | X and Y | Z | Milling (default) |
| `G18` | XZ | X and Z | Y | Lathes, vertical arcs |
| `G19` | YZ | Y and Z | X | Side-plane work |

`G17` is the default on virtually every milling machine, because the work sits in the XY plane and the spindle points down in Z. `G18` is the normal default on lathes. The standard [plane-selection guides](https://www.helmancnc.com/plane-selection-g17-g18-g19/) describe the same mapping.

## Arcs follow the plane

The clearest place plane selection bites is circular interpolation. The arc-center offset words change with the plane:

| Plane | Arc-center words |
| --- | --- |
| `G17` (XY) | `I` (X), `J` (Y) |
| `G18` (XZ) | `I` (X), `K` (Z) |
| `G19` (YZ) | `J` (Y), `K` (Z) |

So an arc that uses `I` and `J` only makes sense in `G17`. Try the same words in the wrong plane and you get an error or a wrong-shaped move. The direction sense of [G02 vs G03](/journal/g02-vs-g03/) is also defined relative to the active plane, viewed from the positive third axis, so the plane and the arc code work together. A radius `R` word can define many arcs without the offset letters, but the plane still sets where the arc lies.

## When to switch planes

Most milling never leaves `G17`. You reach for `G18` or `G19` only for specific work:

| Situation | Plane |
| --- | --- |
| Standard flat milling, drilling down in Z | `G17` |
| Arc or radius cut in a vertical (front) plane | `G18` |
| Arc cut in a vertical (side) plane | `G19` |
| Lathe turning and profiling | `G18` |

Because `G17` is the safe default, it usually appears in the opening safety block (`G21 G17 G40 G90`), which is one of the first things you decode when you [read a CNC program](/journal/how-to-read-a-cnc-program-for-beginners/). That is also why plane selection sits on every list of [common G-codes for CNC beginners](/journal/common-g-codes-for-cnc-beginners/): it is easy to ignore until an arc or a drill goes somewhere unexpected. Get the plane wrong for an arc and you can trip [Fanuc alarm 021, illegal plane axis commanded](/journal/fanuc-alarm-021-illegal-plane-axis-commanded/). The full address grammar is summarized on the [Wikipedia G-code page](https://en.wikipedia.org/wiki/G-code).

## Bottom line

`G17` is the XY plane, `G18` is XZ, and `G19` is YZ. The active plane sets which two axes arcs are drawn in, which `I`, `J`, `K` words define the center, the clockwise sense, and the tool axis. Milling lives in `G17`; switch to `G18` or `G19` only for arcs in a vertical plane or for lathe work.

## Sources

- [LinuxCNC G-code reference (G17, G18, G19 plane selection)](https://linuxcnc.org/docs/html/gcode/g-code.html)
- [HelmanCNC: plane selection G17 G18 G19](https://www.helmancnc.com/plane-selection-g17-g18-g19/)
- [Wikipedia: G-code](https://en.wikipedia.org/wiki/G-code)

## Frequently asked questions

### What is the difference between G17, G18, and G19?
`G17` is the XY plane, `G18` is the XZ plane, and `G19` is the YZ plane. The active plane decides where arcs are drawn, which arc-center words apply, and which axis is the tool axis. `G17` is the default on mills.

### Why does plane selection affect arcs?
An arc is a circle in two axes, so the control needs to know which two. The plane sets that pair and defines clockwise versus counterclockwise from the positive third axis, and the center words follow it: `I` `J` for `G17`, `I` `K` for `G18`, `J` `K` for `G19`.

### When do you use G18 or G19 instead of G17?
Most milling stays in `G17`. Switch to `G18` or `G19` to cut arcs in a vertical plane or for helical features, and `G18` is the normal default on a lathe.

### What is the best way to learn plane selection codes?
Drill them with active recall. A free app like G-Code Sprint quizzes `G17`, `G18`, and `G19` alongside the rest of the everyday codes and repeats whichever ones you miss.

*G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.*

---

Source: https://gcodepractice.com/journal/g17-g18-g19-plane-selection-explained/
Author: Lawrence Arya — https://www.linkedin.com/in/vibecoding/
