G-Code Arc (I/J/K) Calculator

Generate G02/G03 I/J center-offset values from start, end, and radius

Ad placeholder (leaderboard)

CNC controllers cut arcs with circular interpolation, and the trickiest part of hand-coding one is the I and J center offsets. This tool takes a start point, an end point, and a radius and computes the exact I and J values plus the correct G02 or G03 direction so you can paste a working arc move straight into your program.

How it works

The arc center must be equidistant from both endpoints, so it lies on the perpendicular bisector of the chord. Using the chord length and the radius, the distance from the chord midpoint to the center is found by Pythagoras, giving two centers — one on each side:

chord = distance(start, end)
half  = chord / 2
a     = sqrt(radius² − half²)
center = midpoint ± a × (unit perpendicular to chord)
I = center X − start X
J = center Y − start Y

For each center the tool measures the swept angle in both directions to decide whether the minor arc is clockwise (G02) or counter-clockwise (G03), and flags the solution with the smaller sweep as the shorter arc.

Example and notes

An arc from (0, 0) to (10, 10) with radius 10 produces two centers, at (10, 0) and (0, 10), each giving a quarter-circle but in opposite directions. Pick the one whose direction and bulge match your toolpath. The output uses incremental I and J, which is the default on Fanuc, Haas, LinuxCNC, and most other controllers; if your machine is set to absolute arc centers with G90.1, use the printed center coordinates instead of the I and J values.

Ad placeholder (rectangle)