Fanuc (milling)
G17 G90 G54G17 is usually the active plane when a mill powers up, but that is set by a builder parameter and cannot be taken for granted: that is why the safety header block always writes it, along with G40, G49 and G80.
We use technical and security cookies and, only if you accept, analytics with no cross-site tracking. More in the Cookie policy and Privacy policy.
We use first-party cookies and technical storage to make the site work, Google reCAPTCHA security technology and, only if you accept, Vercel analytics (no cookies, no cross-site tracking). You can accept or reject analytics; both options are equivalent and you can change your choice at any time. More info: Cookie policy, Privacy policy, Legal notice and Terms and conditions.
G17, G18 and G19 tell the control which plane it is working in: G17 is the XY plane, G18 the XZ plane and G19 the YZ plane. The choice is modal and it decides three things at once: which plane G02 and G03 arcs are cut in and which pair of I J K letters defines their center, which axis the drilling canned cycles feed down in, and which plane G41/G42 cutter compensation acts in. Milling nearly always works in G17 and turning in G18.
For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.
Fanuc (milling)
G17 G90 G54G17 is usually the active plane when a mill powers up, but that is set by a builder parameter and cannot be taken for granted: that is why the safety header block always writes it, along with G40, G49 and G80.
Fanuc / Haas (turning)
G18On a lathe the default plane is XZ. Arcs are programmed with I (in X) and K (in Z), or with R. Watch out for I: it is measured in radius even though the program X coordinates are in diameter.
Siemens 840D / 828D
G17 / G18 / G19Same criterion as in ISO. On Siemens the axis perpendicular to the plane is also the infeed axis for the cycles, and with CYCLE800 or the swivel plane functions you can rotate the whole system to work faces that are not parallel to the table.
Heidenhain TNC (Klartext)
PLANE SPATIAL SPA+0 SPB+45 SPC+0In Klartext the machining plane is not picked with G17-G19: the plane is always the one perpendicular to the tool axis declared in the TOOL CALL, and to work a tilted face you use PLANE SPATIAL (or the old cycle 19), which rotates the whole coordinate system.
| Letter | What it sets | Unit |
|---|---|---|
| G17 | XY plane. Arcs use I (in X) and J (in Y), canned cycles drill in Z and cutter compensation acts in XY. It is the normal working plane of a milling machine. | modal, no arguments |
| G18 | XZ plane. Arcs use I (in X) and K (in Z), and the depth axis becomes Y. It is the default plane of the lathe and the one used in milling for corner radii on an edge. | modal, no arguments |
| G19 | YZ plane. Arcs use J (in Y) and K (in Z), and the depth axis is X. It shows up in work with a right angle head and on horizontal machines. | modal, no arguments |
| I J K | Of the three arc center letters, the control only reads the two that belong to the active plane. The third is surplus and some controls alarm if you write it. | mm / in |
| R | The radius works the same way in all three planes, with no change of letter. That is a practical reason to use it when you program an arc in an unusual plane. | mm / in |
A 5 mm corner radius between the top face and the vertical wall of an aluminum part, cut with a 6 mm ball nose. The arc lies in the XZ plane, so the program switches to G18 for that block alone and goes straight back to G17 afterwards. The edge is at X0 and the top face at Z0, so the center of the radius sits at X-5 Z-5 and the path of the ball center is an arc of 8 mm radius.
O0117 (ACUERDO EN R5 CAMBIANDO DE PLANO) | ( Program header. ) |
G21 G17 G40 G49 G80 | ( Starts in the XY plane, the usual one in milling, and with everything cancelled. ) |
G91 G28 Z0. | ( Z to the reference point before the change. ) |
T5 M06 | ( 6 mm ball nose: the ball radius is 3 mm. ) |
G90 G54 G00 X-20. Y10. | ( Positions clear of the part, at the height of the section that is going to be worked. ) |
G43 H05 Z50. M03 S6000 | ( T5 length offset and spindle on. ) |
G00 Z3. M08 | ( Rapid down to Z3: with a 3 mm ball radius, the tool center at Z3 means the ball just touches the top face. ) |
G01 X-5. F800 | ( Feeds to X-5, the point where the radius starts. Here the ball rests on the face and its center is at X-5 Z3. ) |
G18 | ( Switches to the XZ plane. From this block on, arcs are cut in XZ and the center letters become I (in X) and K (in Z): J stops meaning anything. ) |
G03 X3. Z-5. I0. K-8. F500 | ( The radius: 90 degrees of arc around the center X-5 Z-5, with radius 8 (the 5 of the corner plus the 3 of the ball). I0 and K-8 are the distance from the start point to the center. It is G03 and not G02 because in the XZ plane the direction is judged looking from +Y, and from there the rotation is counterclockwise even though on screen it looks like the opposite. ) |
G00 X20. | ( Rapids out away from the wall. ) |
G17 | ( Back to the XY plane before any later arc or canned cycle. Leaving a G18 active is one of the commonest causes of alarms nobody can explain. ) |
(EL ACUERDO COMPLETO SE HACE REPITIENDO EL ARCO A LO LARGO DE Y CON UN SUBPROGRAMA) | ( In production, the same arc is repeated every few tenths in Y with M98, or the CAM generates it as a surface. ) |
G00 Z50. M09 | ( Retract and coolant off. ) |
G91 G28 Z0. M05 | ( Z to the reference point and spindle stop. ) |
G90 M30 | ( Back to absolute and end. ) |
Three things, and only those three. First, arcs: the plane they are drawn in changes, the pair of center letters changes (I J in G17, I K in G18, J K in G19) and so does the viewpoint the clockwise direction is decided from. Second, canned cycles: they feed down the axis perpendicular to the plane, so in G17 they drill in Z and in G19 they would do it in X. Third, cutter compensation, which only acts in the active plane. What does not change is the coordinate system: the origins, the coordinates and the axis directions all stay exactly as they were.
In milling, when you have to cut an arc that is not in XY: a corner radius on an edge, the profile of a turned shape machined on a mill, work with a right angle head or a side face on a horizontal machine. On a lathe it is not an option, it is the permanent working plane. The safe habit is to change plane right before the block that needs it and go back to G17 in the block after, the same way you handle G91: the less time an unusual modal is active, the less chance another operation runs into it.
The clockwise direction of an arc is defined looking at the plane from the positive side of the third axis: G17 from +Z, G18 from +Y and G19 from +X. In G17 that matches the natural view of the table from above and nobody gets it wrong. In G18 it does not match: the usual picture of the XZ plane, with X to the right and Z upward, corresponds to looking from -Y, that is, from the opposite side, and that is why the arc looks like it turns the other way from what the code says. On a lathe you add to that the fact that on rear turret machines positive X points to the other side.
G17 is the XY plane, G18 the XZ and G19 the YZ. The quick way to remember it is to look at the axis that is missing: that is the axis the canned cycles feed down, and the one you use as the viewpoint to decide the direction of arcs.
G18, the XZ plane, because those are the two axes the machine has. It is usually active by default at power up, although well written programs declare it in the header anyway, above all on lathes with a Y axis or live tooling.
To cut arcs that are not in XY: a corner radius on an edge, a turned profile machined on a mill, or work with a right angle head where the tool attacks from the side. Outside those cases, a milling machine lives in G17 from start to finish.
Yes, a great deal: the cycle feeds down the axis perpendicular to the active plane. With G17 it drills in Z, which is what you want. With an inherited G19 it would try to do it in X, and depending on the machine that is either an alarm or a crash.
Yes. The power up state is a builder parameter, and on top of that the previous program may have left another plane set. Writing it in the safety header block, next to G40, G49 and G80, costs five characters and takes all of that uncertainty away.
CNC IDE: editing with G/M tooltips, line inspector, conversion between controls and 2D/3D toolpath.
CNC Alarms and Solutions Guide. Enter the error code or symptom to find the cause and how to repair it at the machine.
Estimate CNC turning and milling cycle time from G-code. Calculate parts per hour with a breakdown of cutting, rapids, canned cycles and tool changes.