CNC Course (9) How to Program CNC Arcs: G2, G3, I, J, and R Codes

🎥 Video

📝 Overview

This lesson takes CNC programming to the next level by introducing circular motion. Up to this point in the series, every toolpath has used straight-line moves — G0 rapid traverses and G1 linear feeds. G2 and G3 change that. These two commands tell the CNC controller to move the tool along a circular arc instead of a straight line, making it possible to cut circles, fillets, pockets, and complex curved profiles directly in G-code.

The video covers both methods for defining an arc: using I and J values (center-point offsets from the start position) and using R (a simple radius value). Understanding both methods gives you the flexibility to read and write G-code for virtually any CNC controller or CAM output you’ll encounter.

📌 What You’ll Learn

  • What G2 (clockwise arc) and G3 (counterclockwise arc) commands do
  • How to determine arc direction by looking down the Z-axis
  • How to use I and J values to define the arc center relative to the start point
  • How to use the R method as a simpler alternative for arcs ≤ 180°
  • When to use I/J vs. R — and the limitations of each
  • How to program a full 360° circle in G-code
  • How to combine arc moves with G0 and G1 moves in a complete program
  • Common mistakes that cause arcs to move in the wrong direction or fail entirely

📂 Tools & Software Used

  • 3018-style CNC router (or any GRBL-based machine)
  • Candle (GRBL Control) — free CNC sender software
  • GRBL firmware (v1.1 recommended)
  • A text editor (Notepad, VS Code, or similar) for writing G-code
  • Optional: G-code simulator (NCViewer.com) for testing arc moves before running

📘 Step-by-Step Breakdown

Step 1 — Understand the Coordinate Plane

G2 and G3 operate in the XY plane by default (G17). This means you’re programming arcs that move in X and Y while Z stays constant. Before writing any arc command, confirm your machine is in the correct plane. For most 3018 routers, G17 is assumed and you won’t need to declare it, but good programming practice includes it.

Step 2 — Choose Your Arc Direction

G2 = Clockwise arc (viewed from above, looking down the Z-axis)
G3 = Counter-Clockwise arc (viewed from above, looking down the Z-axis)

A helpful trick: imagine standing above the machine, looking down at the table. If the tool would travel clockwise around the circle, that’s G2. If counterclockwise, that’s G3.

Step 3 — Define the Arc Using the I/J Method

I = the X distance from the current tool position (start point) to the center of the arc
J = the Y distance from the current tool position (start point) to the center of the arc

These are signed values — positive or negative depending on direction. The end point (X, Y) is where the arc finishes.

Example — Clockwise semicircle from (0,0) to (10,0) with center at (5,0):

G0 X0 Y0        ; Rapid to start position
G2 X10 Y0 I5 J0 F500  ; CW arc to (10,0), center offset I=5, J=0

Step 4 — Define the Arc Using the R Method

R = the radius of the arc. This is simpler to write but has one important limitation: it cannot define arcs greater than 180° (a negative R value can define the major arc, but this varies by controller).

Example — Counter-clockwise 90° arc to (10,10) with radius ~7.07:

G0 X0 Y0
G3 X10 Y10 R7.071 F500  ; CCW arc with radius 7.071

Step 5 — Program a Full Circle

A full 360° circle cannot be programmed with the R method (start = end, so R is ambiguous). Use the I/J method and set the end point equal to the start point.

Example — Full clockwise circle, radius 10, centered at (10,0), starting at (0,0):

G0 X0 Y0
G2 X0 Y0 I10 J0 F400  ; Full CW circle, center offset I=10

Step 6 — Add Arc Moves to a Real Program

Arc moves use the same feedrate (F) as G1 linear moves — it is a modal value and carries over. You don’t need to re-specify F on every arc unless the speed changes. Always rapid (G0) to your start position before issuing G2 or G3.

⚙️ G-Code Reference

G-CodeActionNotes
G2Clockwise arcViewed from above (down Z-axis)
G3Counter-clockwise arcViewed from above (down Z-axis)
G17Select XY planeDefault plane for most CNC routers
IX offset to arc centerSigned value from start point
JY offset to arc centerSigned value from start point
RArc radiusCannot define arcs > 180° reliably
FFeedrate (modal)Shared with G1; set once

Example G-Code Block:

; === G2/G3 Arc Examples ===
G17 G21 G90         ; XY plane, metric, absolute mode
G0 Z5               ; Lift tool to safe height
G0 X0 Y0            ; Rapid to start position
G1 Z-1 F100         ; Plunge to cutting depth

; Clockwise arc using I/J
G2 X10 Y0 I5 J0 F400  ; CW semicircle, center at (5,0)

; Reposition
G0 Z5
G0 X0 Y0
G1 Z-1 F100

; Counter-clockwise arc using R
G3 X10 Y10 R7.071 F400  ; CCW 90° arc

; Full circle using I/J
G0 Z5
G0 X-10 Y0
G1 Z-1 F100
G2 X-10 Y0 I10 J0 F400  ; Complete 360° CW circle

G0 Z10              ; Retract tool
M5                  ; Spindle off

⚠️ Safety Notes

  • Always simulate arc G-code in NCViewer or a similar tool before running it on the machine. A wrong I, J, or R value can send the tool in an unexpected direction at full feedrate.
  • Keep feedrates conservative when first testing arc moves — start at F200–F300 on a 3018 router and increase once you confirm the path is correct.
  • Confirm your Z height before every cut. Arcs do not automatically control Z depth — you must plunge to the correct Z before issuing G2 or G3.
  • Never run arc commands while the tool is at Z0 or above the material without intending to cut at that height.
  • If the controller reports an “arc error” or “invalid arc,” double-check that your I/J values are geometrically consistent with the stated end point. A mismatch between the center offset and end point coordinates is the most common cause.

💡 Tips & Best Practices

  • Use NCViewer.com to visually verify your arc paths before running them on the machine — it renders G-code toolpaths in 3D and is free.
  • When in doubt, use the I/J method. R is simpler to write, but I/J is more reliable across different controllers and avoids the >180° ambiguity.
  • A negative R value programs the “major arc” (the long way around) while a positive R programs the “minor arc” (the short way). Not all controllers support negative R — test yours first.
  • Keep I and J values consistent with your coordinate system. In G90 (absolute mode), I and J are still relative to the start point of the arc — this trips up many beginners.
  • If you need a circle pocket or circle profile in CAM software, the software will generate G2/G3 for you automatically. Understanding these commands helps you read and troubleshoot that output.
  • Label your arc moves with comments (using semicolons in GRBL) to make programs easier to read and debug.

🔑 Key Takeaways

  • G2 = clockwise arc; G3 = counter-clockwise arc (direction viewed from above, looking down Z)
  • Use I and J to define the arc center as an offset from the start point — the most universal method
  • Use R for simple arcs ≤ 180°; avoid R for full circles or major arcs
  • A full 360° circle requires the I/J method with start point = end point
  • Feedrate (F) is modal — set it once and it applies to all subsequent G1, G2, and G3 moves
  • Always simulate arc G-code before running it on the machine

Mastering G2 and G3 is the turning point where G-code programming stops feeling like a list of straight lines and starts feeling like a real design language. Once you’re comfortable programming arcs, you can cut circles, round corners, trace contours, and create pockets that would be impossible with G0 and G1 alone. Part 2 of this lesson will go deeper into multi-arc profiles and real-world examples — stay tuned, and in the meantime, practice these examples in NCViewer before putting them on the machine.

🔗 Related Lessons

CNC Course (8) Chips Fly on the First CNC Cut

CNC Course (10) Mastering Arcs With the R-Value Method

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *