← All guides
G02 G03 circular interpolation guide - CNC milling machine cutting metal with circular interpolation toolpath - CNC Dance tutorial

G02 and G03: Circular Interpolation for CNC Programming

Tutorials

G02 clockwise and G03 counterclockwise are the G-codes for cutting arcs and circles on a CNC machine. They are the third most important motion codes after G00 for rapid positioning and G01 for linear feed. With G02 and G03 you can cut radiused corners, circular pockets, full circles, helical ramps, and thread milling paths.

If you already know G00 and G01 for straight-line moves then G02 and G03 are the next step in your G-code programming journey. A surprising number of beginner crashes happen because of confusion between the R method and the IJK method for programming arcs. This guide covers both methods with clear examples so you understand when to use each one.

How G02 and G03

Category Example Purpose
Type A Example 1 Purpose 1
Type B Example 2 Purpose 2
Type C Example 3 Purpose 3

Work

Both codes move the tool along a circular path from the current position to a target position. G02 moves the tool in a clockwise direction. G03 moves the tool in a counterclockwise direction. The direction is determined by looking from the positive end of the axis toward the negative end of the axis which follows the standard right-hand rule.

To program an arc you need three pieces of information. The end point of the arc which is specified with X Y Z coordinates. The radius or center point of the arc which tells the control the arc shape. And the feed rate which controls how fast the tool moves along the arc.

There are two methods for specifying the arc geometry. The R method uses the arc radius. The IJK method uses the center point coordinates relative to the start point. Each method has its own advantages and limitations.

The R Method

The R method is simpler and more intuitive for manual programming. You specify the end point coordinates and the radius value. The control calculates the arc path automatically.

For a clockwise arc from X0 Y0 to X2 Y0 with a 1-inch radius the code is: G02 X2 Y0 R1 F20. This cuts a 180-degree arc that curves above the line connecting the two points. The arc follows the path that keeps the tool on the same side as the center of the radius.

If you use a negative R value the arc cuts below the line instead of above it. So G02 X2 Y0 R-1 F20 cuts a 180-degree arc below the X-axis. This is how you control which side of the line the arc falls on when using the R method.

The R method has a fundamental limitation. It can only cut arcs of up to 180 degrees. For arcs larger than 180 degrees you must use a negative R value which switches the arc to the opposite side. For a full 360-degree circle the R method cannot be used at all because there are an infinite number of arc paths that connect a point back to itself.

The IJK Method

The IJK method specifies the arc center point using offsets from the start point. I is the X-axis offset from the start point to the arc center. J is the Y-axis offset from the start point to the arc center. K is the Z-axis offset from the start point to the arc center and is used for helical interpolation.

For a clockwise arc from X0 Y0 to X2 Y0 with the center point at X1 Y0 the code is: G02 X2 Y0 I1 J0 F20. The I value of 1 means the center is 1 inch from the start point in the positive X direction. The J value of 0 means the center is at the same Y position as the start point.

The IJK method can cut arcs of any size including full 360-degree circles. To cut a full 2-inch diameter circle centered at X1 Y0 starting from X0 Y0 the code is: G02 X0 Y0 I1 J0 F20. The start point and end point are the same coordinate but the I offset tells the control to make a complete circle around the center point.

The sign of I and J is critical. Positive I values offset the center in the positive X direction from the start point. Negative I values offset in the negative X direction. If your arc cuts in the wrong direction the sign of I or J is likely incorrect.

Choosing Between R and IJK

Use the R method for quick manual programming of simple arcs under 180 degrees. It is faster to type at the control and easier to read when editing code manually. Use the IJK method for full circles, arcs over 180 degrees, and all CAM-generated code. Most CAM software outputs IJK code because it is unambiguous and supports all arc types.

My recommendation is to understand both methods but let your CAM software generate IJK code for anything complex. When manually editing G-code or troubleshooting arc problems use the R method for its simplicity.

Helical Interpolation

G02 and G03 also support helical moves by adding a Z-axis value to the arc command. The tool cuts a circular path while simultaneously moving in Z creating a helical or spiral path. This is used for thread milling and helical ramp entry into pockets.

The format for a helical move is: G02 X0 Y0 I1 J0 Z-0.5 F10. This cuts a full 360-degree circle while descending 0.5 inches in Z. The result is a helical ramp that enters the material gradually.

Helical interpolation is a key technique for reducing tool load when entering material. Instead of plunging straight down which places high stress on the tool center a helical ramp distributes the cutting load along the side of the tool. This is the standard method for entering pocketing operations in production machining.

Common Mistakes

Using the R method for a full circle causes the control to return an error because there are infinite solutions for a circle that starts and ends at the same point. Always use the IJK method for full circles.

Another common mistake is forgetting to position the tool at the correct start point before the arc command. The arc begins from the current tool position. If the tool is not in the correct location the arc will not be positioned correctly relative to the part. Always verify the start position with a G00 move before the G02 or G03 command.

Incorrect IJK sign is the third common mistake. I and J can be positive or negative depending on where the center is located relative to the start point. If the arc cuts in the wrong direction or spirals outward instead of cutting a clean circle the sign of I or J is wrong. Double-check your I J signs when troubleshooting arc problems.

Example Programs

Full circle clockwise at center X2 Y2 with 1-inch radius starting from X3 Y2: G00 X3 Y2 then G02 X3 Y2 I-1 J0 F20.

90-degree clockwise arc from X0 Y0 to X1 Y-1 with 1-inch radius: G00 X0 Y0 then G02 X1 Y-1 R1 F20.

Full circle with IJK using a quarter-inch end mill in aluminum: G00 X2 Y2 Z0.1 then G01 Z-0.25 F10 then G02 X2 Y2 I1 J0 F30 then G00 Z0.1.

Arc Feed Rate and Programming Tips

When cutting arcs the actual feed rate at the cutting edge can differ from the programmed feed rate. For internal arcs inside a concave corner the inner edge travels a shorter path so it moves slower than the programmed rate. For external arcs around a convex corner the outer edge moves faster. Most modern controls compensate automatically but on older controls you may need to reduce the programmed feed rate for internal arcs by 20 to 30 percent.

When programming arcs follow this workflow. First verify the starting position because the arc begins from wherever the tool currently is. Second choose your arc method using IJK for full circles and CAM code or R for quick manual arcs. Third specify the correct direction G02 or G03. Fourth verify the endpoint coordinates. Fifth set a feed rate appropriate for the radius. Sixth test with a dry run.

For multiple arcs connected together make sure the endpoint of each arc matches the start point of the next move. A gap of even 0.001 inch can cause a witness mark on the finished surface. Use tangent entry and exit for smooth transitions between arcs.

For smooth transitions between arcs use tangent entry and exit. This means the arc direction at the endpoint matches the direction of the next move. Tangent entry reduces tool marks and improves surface finish. Most CAM software handles this automatically but when manual programming you need to calculate the tangent points.

G02 and G03 work the same way on all machine types but axis designations differ. On a mill arcs are in the XY plane by default. On a lathe arcs are in the XZ plane because Z is the spindle axis. On a router arcs are in the XY plane like a mill. You can select different planes using G17 for XY, G18 for XZ, and G19 for YZ. This is essential for multi-axis work and for machines with different axis configurations.

The plane selection is done at the beginning of the program and stays in effect until changed. This is why most milling programs start with G17 to ensure arcs are in the XY plane. If you are programming a lathe or a multi-axis machine check your post-processor output to confirm the correct plane is selected.

A common question from beginners is whether G02 and G03 can be used for thread milling. The answer is yes but you need to combine the circular move with a Z-axis feed to create the thread helix. The pitch of the thread determines the Z feed per revolution. For example a 20 TPI thread needs a Z feed of 0.050 inch per full circle revolution. This technique is called helical interpolation and it is the standard method for thread milling on CNC machines.

Understanding G02 and G03 is essential for any CNC programmer. These codes let you create curved profiles, circular pockets, radiused corners, and helical toolpaths that are impossible with straight-line moves alone. Practice with simple arcs first then move on to full circles and helical interpolation. The principles are the same regardless of whether you are programming a mill, lathe, or router.

One final tip: always verify your arc programs with a dry run or in CAM simulation before cutting material. Arc programming errors are harder to spot visually than linear move errors and a tool cutting in the wrong arc direction can crash into the workpiece or fixture. Single-block mode with distance-to-go display is the safest way to prove out arc programs on the machine.

For more G-code programming guides see our [G-Code for Beginners](

G90 G54 G00 X0 Y0
G01 Z-0.1 F10
G01 X1.0 F20
M30

/posts/g-code-for-beginners/) and our Common G-Code Mistakes guides.

Tags:#g-code#programming#beginner#mill#reference