3 months by cncdivi

[ CNCCookbook’s G-Code Tutorial ]

What are Plane Selection G-Codes (G17, G18, and G19) used for?

It’s convenient to refer to planes for various purposes. A plane is a flat 2-dimensional space defined by two axes. For example, the default plane on most mills is XY. If you draw an arc without specifying a change in the plane, it will be drawn on the XY plane. There is a plane for each combination of the linear axes XYZ.  

The G17, G18, and G19 G-Codes select which plane is active.

  • G17:  XY
  • G18:  XZ
  • G19:  YZ

Here is a visual representation of the planes:

g17, g18, g19 plane selection g codes

Plane selection is modal, so once you have established a plane all future arcs will be against that plane until a different plane selection g-code is invoked.

The selected working plane affects the following commands:

  • G02/G03 circular (arc) interpolation
  • G16:  polar coordinates
  • G41/G42:  Cutter radius compensation.  Radius compensation is relative to the selected plane.
  • G43/G44:  Cutter length compensation.  Length compensation is along the axis that is perpendicular to the selected plane.
  • Many canned cycles.

It’s a good idea to include a plane selection gcode such as G17 in the preamble or safety block at the top of your g-code program.  Most g-code operates in G17 mode and you will seldom use G18 or G19.

Example Use:  Right Angle Heads on Milling Machines


The G18 gcode specifies XZ as the active plane on a lathe.

G17 specifies XY as the active plane while G18 specifies XZ as the active plane.

G19 specifies YZ as the active plane.

G18 selects the XZ plane.  The active plane determines how the tool path of an arc is interpreted.


Like what you read on CNCCookbook?

Join 100,000+ CNC'ers!  Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, we’ll give you access to some great CNC reference materials including:

  • Our Big List of over 200 CNC Tips and Techniques
  • Our Free GCode Programming Basics Course
  • And more!

Just enter your name and email address below:

Full Name
Email *
100% Privacy: We will never Spam you!

5/5 - (2 votes)

Recently updated on March 23rd, 2024 at 06:23 am