G-code reference

G18 G-Code: XZ Plane Selection

XZ Plane Selection — Selects the ZX plane. It is the default plane on lathes and is used on mills for arcs in the XZ plane, e.g. ball-end profiling.

By cnccode · Updated
PropertyValue
CodeG18
FunctionXZ Plane Selection
Modal group02
TypeModal — stays active until replaced by another code of the same group
Used onMills and lathes
SyntaxG18

What does G18 do?

Selects the ZX plane. It is the default plane on lathes and is used on mills for arcs in the XZ plane, e.g. ball-end profiling.

G18 is modal: once programmed it remains in effect for the following blocks until another code from modal group 02 replaces it or the control is reset.

Syntax and parameters

Format
G18

G18 example program

Example
G18 G02 X20.0 Z-10.0 R10.0

▶ Open this example in the G-code viewer

Tips and common mistakes

  • On mills, I and K define the arc centre in G18.

Controller compatibility

G18 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G18 modal?
Yes. G18 belongs to modal group 02 and stays active until another code of that group is programmed.
What does G18 mean in CNC?
G18 means XZ Plane Selection. Selects the ZX plane. It is the default plane on lathes and is used on mills for arcs in the XZ plane, e.g. ball-end profiling.
What is the difference between G18 and G17?
G18 is XZ Plane Selection, while G17 is XY Plane Selection. See the G17 page for its syntax and examples.
Can I use G18 on a lathe?
Yes, G18 is used on both mills and lathes, although some parameters differ between them.