G02 vs G03 explained: arcs, R and I J K in a G-code simulator
G02 and G03 on a Haas mill and a Fanuc lathe: R and I J K arcs, and the mistakes that break them, in NC Proof. Press play to watch.
Arcs are where most new programmers get their first alarm, and a G-code simulator is the quickest way to see why. G02 cuts an arc clockwise and G03 counter-clockwise. That part is easy to remember. The questions come right after: clockwise seen from where? What is the difference between R0.5 and I0. J-0.5? Why does the control stop with an arc alarm when the numbers look right?
This guide answers those for Haas and Fanuc mills and lathes, with two short programs you can run yourself.
G02 is clockwise, G03 is counter-clockwise
The direction depends on the plane and on where you look from.
- Mill, G17 (XY plane): look down at the table from above, from +Z. Clockwise as you see it is
G02. This is the plane you use for almost every pocket and profile, and mills start up in G17. - Lathe, G18 (XZ plane): draw the part the way it is on the print, with +X up and +Z to the right (the chuck on the left). Clockwise on that drawing is
G02. Lathes start up in G18, so you rarely write it.
On a lathe this gives two rules of thumb for an outside profile cut toward the chuck:
- A rounded outside corner (from the face onto the diameter) is
G03. - A fillet at the bottom of a shoulder (from the diameter up the face of the shoulder) is
G02.
Two things trip people up:
- G18 and G19 on a mill. The view is from the positive end of the third axis: G18 from +Y, G19 from +X. In G18 you look from the back of the machine, so an arc that is G02 looks counter-clockwise from where you stand at the front.
- Front-turret lathes. On a lathe with the turret in front of the centre line, write the program the same way, from the print with +X up. The arc only looks reversed when you watch it from the operator side.
What goes in an arc block
G02 X2.25 Y1.5 R0.5 F20.
An arc block has three parts:
- The end point (
X2.25 Y1.5): where the arc finishes, in the same absolute or incremental mode as your other moves. The start point is wherever the tool already is. - The size of the arc, given one of two ways: a radius
R, or the centre withI,JandK. - The feed
F, along the arc. Arcs are always fed, never rapid.
R: the quick way
R is the radius of the arc. Give the end point and the radius, and the control works out the centre.
There is a catch. Between two points, two different arcs of the same radius go the same way round. The sign of R picks one of them:
- R positive: the short arc, 180° or less. This is the one you want almost every time.
- R negative: the long arc, more than 180°.
R has two limits:
- No full circles. With the end point on the start point, R does not say where the centre is. On Fanuc the tool does not move at all, and Haas does not cut the circle either. Use I, J, K instead.
- The radius must reach. If the two points are farther apart than twice R, no arc fits and the control stops with an alarm. A typo like
R0.4forR0.5on a 1.0” chord does exactly that.
I, J, K: the centre, from the start point
I, J and K give the distance from the start point to the centre of the arc, along X, Y and Z:
| Address | Axis | Used in |
|---|---|---|
| I | X | G17 (mill), G18 (mill and lathe) |
| J | Y | G17, G19 |
| K | Z | G18 (lathe), G19 |
Three rules to remember:
- They are always incremental, from the start point, even in
G90. Writing the centre’s absolute position is the classic mistake. - The sign matters. If the centre is below the start point, J is negative.
- On a lathe, I is a radius, not a diameter, even though X is programmed as a diameter. A centre 0.1” further out from the centre line is
I0.1, notI0.2.
A zero can be left out (I0. is the same as no I), but writing it makes the program easier to read.
With I, J, K you can cut a full circle in one block: leave out the end point (or give the start point again) and give the centre. Starting 0.5” to the right of a bore’s centre:
G02 I-0.5 F15.
R or I, J, K?
| R | I, J, K | |
|---|---|---|
| Easy to write by hand | ✅ | Needs the centre worked out |
| Full circle | ❌ | ✅ |
| Arc over 180° | R negative | ✅ |
| Error if the numbers don’t fit | Alarm if R is too small | Alarm if the end point is off the circle |
Don’t put R and I, J, K in the same block. Fanuc uses R and ignores I, J, K, so a wrong R wins over a right centre.
Example 1: a mill program with G02 and G03
A 1/2” end mill cuts an S-shaped slot 0.1” deep in a 4 × 3 inch block. The first arc uses R, the second I and J. This is the path in the mill picture above.
%
O01080 (G02 G03 ARC DEMO - HAAS MILL)
(STOCK 4.0 X 3.0 X 1.0 - X0 Y0 TOP LEFT FRONT CORNER)
(T1 1/2 FLAT END MILL - FLUTE 1.0 - STICK OUT 1.5)
G20 G17 G40 G49 G80 G90
T1 M06
G54 G00 X0.75 Y2.5 S3000 M03
G43 H01 Z1. M08
Z0.1
G01 Z-0.1 F10.
X2.25 F20.
G02 X2.25 Y1.5 R0.5
G01 X1.25
G03 X1.25 Y0.5 I0. J-0.5
G01 X3.25
G00 Z1. M09
M05
G28 G91 Z0.
G28 G91 Y0.
G90
M30
%
G02 X2.25 Y1.5 R0.5: from X2.25 Y2.5 down to Y1.5, clockwise, so the arc swings out to the right (to X2.75). The two points are 1.0” apart and R is 0.5”, so this is a half circle.G03 X1.25 Y0.5 I0. J-0.5: the tool is at X1.25 Y1.5. The centre is 0.5” below it (J-0.5), at Y1.0. Counter-clockwise swings the arc out to the left (to X0.75).
Swap G02 for G03 in the first arc and the arc swings to the left instead, through the middle of the slot. The program still runs. The part is just wrong.
The same lines run on a Fanuc mill.
Example 2: a lathe profile on a Fanuc control
A finishing pass on a 1” diameter with a 0.1” rounded corner at the face and a 0.1” fillet into a 1.2” shoulder, written both ways:
(WITH R)
G03 X1. Z-0.1 R0.1
G01 Z-0.9
G02 X1.2 Z-1. R0.1
(WITH I AND K)
G03 X1. Z-0.1 I0. K-0.1
G01 Z-0.9
G02 X1.2 Z-1. I0.1 K0.
Here it is in a full program: G71 roughs with the R version, then a second tool finishes the same profile with I and K:
%
O01081 (G02 G03 ARC DEMO - FANUC LATHE)
(STOCK DIA 1.5 - LENGTH 3.0)
(T0101 CNMG 432 OD ROUGH)
(T0202 VNMG 331 OD FINISH)
G20 G18 G40 G99
T0101
G50 S3000
G96 S500 M03
G00 X1.6 Z0.1 M08
G71 U0.05 R0.02
G71 P10 Q20 U0.02 W0.005 F0.010
N10 G00 X0.7
G01 Z0. F0.004
X0.8
G03 X1. Z-0.1 R0.1
G01 Z-0.9
G02 X1.2 Z-1. R0.1
G01 X1.4
N20 X1.6
G00 X3. Z3. M09
M05
T0202
G50 S3500
G96 S600 M03
G00 G42 X0.7 Z0.1 M08
G01 Z0. F0.004
X0.8
G03 X1. Z-0.1 I0. K-0.1
G01 Z-0.9
G02 X1.2 Z-1. I0.1 K0.
G01 X1.4
X1.6
G40 G00 X3. Z3. M09
M05
M30
%
Work the I and K out from the start point of each arc:
- Corner: the tool is at X0.8 Z0, which is 0.4” from the centre line. The centre of the corner is at 0.4” from the centre line and Z-0.1. So I is 0 and K is -0.1.
- Fillet: the tool is at X1.0 Z-0.9 (0.5” from the centre line). The centre is at 0.6” from the centre line (the shoulder radius) and the same Z. So I is +0.1 (a radius) and K is 0.
On a Haas lathe the arc blocks are the same.
Mistakes that cost parts
- G02 and G03 swapped. The arc bulges the wrong way: a convex corner turns into a scoop, or a slot end cuts into the wall. There is no alarm.
- I, J, K written as the centre’s position (
J1.instead ofJ-0.5). The end point is no longer on the circle, and the control alarms. - I as a diameter on a lathe. Twice the distance, wrong circle, alarm.
- R too small for the distance, often a typo.
- A full circle with R. The circle is not cut.
- The wrong plane. A G18 left on from an earlier operation makes the next XY arc an alarm or a cut in the wrong place.
- An inside arc smaller than the cutter with cutter comp on: the tool can’t fit. See cutter compensation G41 and G42.
Check every arc in a G-code simulator
A simulator draws each arc before the machine cuts it, so a G02 that should be a G03 is easy to see: the path bulges the wrong way on the screen. NC Proof also checks the numbers of every arc, line by line, on Haas and Fanuc controls:
- An I, J, K end point off the circle: “Arc does not close: start radius 0.4000 in, end radius 0.6000 in (off by 0.2000 in). The control will alarm.”
- An R that can’t reach: “Arc R0.4000: the ends are 1.0000 in apart, more than the diameter 0.8000 in.”
- Inside arcs smaller than the tool with cutter comp on, and arcs in the wrong plane.
Paste either program above into NC Proof Mill or NC Proof Turn, then change one arc to see what happens. It runs in your web browser on Windows, Mac or iPad, and the free trial is 4 days with no card needed. New to G-code? Start with how to read G-code.
Questions
Is G02 clockwise on a lathe too? Yes, when you look at the part with +X up and +Z to the right, as it is drawn on a print. That holds for Haas and Fanuc lathes, with the turret behind or in front of the centre line.
Are I, J and K absolute or incremental? Incremental: the distance from the start point of the arc to its centre, on both Haas and Fanuc, whether G90 or G91 is on.
Why can’t I cut a full circle with R? With the end point on the start point, a radius alone does not fix where the centre is. Use I, J or K for a full circle.
What does a negative R mean? The long way round: an arc of more than 180° between the same two points. A positive R gives the short arc.