G54.APP

G-code deep dive

G2 & G3 Arcs: I, J, K vs R Format Explained

G2G3G02G03G12G13

G2 cuts an arc clockwise, G3 counter-clockwise, from the current position to the endpoint given in the block. Direction is judged looking at the active plane from the positive side — for the default XY plane (G17), that's the view from above.

Every arc needs two things besides the endpoint: which plane it lives in (set by G17/G18/G19), and where its center is — given either as center offsets (I/J/K) or a radius (R).

IJK format: center offsets

I, J, K are the distances from the start point to the arc center, measured along X, Y, Z. On nearly every control they are incremental by default, even in G90 absolute mode:

G17 G90              ; XY plane, absolute endpoints
G0 X10 Y0
G2 X0 Y10 I-10 J0 F400   ; quarter circle: center at (0,0), radius 10

Start (10,0), center = start + (I,J) = (0,0), end (0,10), clockwise — a 90° arc. Add a Z word and the arc becomes a helix, the standard way CAM ramps into a pocket:

G2 X10 Y0 I-10 J0 Z-2    ; full turn spiraling down 2 mm

A block whose endpoint equals its start point cuts a full circle in IJK format (Mach3/4 also offer G12/G13, which treat the current position as the center — nonstandard, avoid in portable code).

R format: radius

G2 X0 Y10 R10 says "get there on a radius-10 arc." Shorter to write, but ambiguous: two arcs of the same radius connect any two points — a minor (<180°) and a major (>180°) one. Positive R picks the minor arc, negative R the major. Full circles are impossible in R format, and near-180° arcs amplify rounding error, which is why CAM posts overwhelmingly emit IJK.

OperationLinuxCNCGRBLCentroidFANUCMach3Mach4Notes
Clockwise arc / helix G2 G2 G2 G2 G2 G2 I/J/K center offsets or R radius, in the active plane. Add a Z move for a helix.
Counter-clockwise arc / helix G3 G3 G3 G3 G3 G3 Same conventions as the CW arc, opposite direction.
Full-circle CW (current pos as center) G12 G12 Mach3: partial
Full-circle CCW G13 G13 Mach3: partial

— means the control has no equivalent code. Full cross-control tables: the complete G-code & M-code reference.

Common mistakes

Frequently asked questions

Which direction is G2 — clockwise or counter-clockwise?

G2 is clockwise and G3 is counter-clockwise, as seen looking at the active plane from the positive side of its normal axis — for the XY plane (G17), that's looking down the Z axis from above, the normal top view.

What do I, J and K mean in a G2/G3 block?

They locate the arc's center. On most controls they are incremental offsets from the arc's start point: I along X, J along Y, K along Z. In the XY plane you use I and J; the pair changes with the active plane (G18 uses I/K, G19 uses J/K).

Why does my arc give a radius error?

The distance from start point to center and from end point to center must match to within the control's tolerance. A radius error means your I/J (or R) doesn't agree with the endpoint — usually a hand-edited coordinate, the wrong plane active, or I/J interpreted as absolute when the program assumed incremental (G90.1 vs G91.1).

Should I use R or IJK format?

IJK is unambiguous and what most CAM posts emit. R is convenient for hand-written code but has a built-in ambiguity: for any R less than half the chord there are two possible arcs (R+ selects the minor arc, R− the major one), and a full circle can't be expressed with R at all.

See it, don't guess it

Paste a program into the free G54.APP viewer and watch these codes execute — toolpaths, stock removal, and machine state, live in your browser. Nothing is uploaded.

Open the G-code viewer