---
title: "Lathe Chamfer Calculation in G-code: Two Reliable Methods"
description: "Program a lathe chamfer two ways: calculate the endpoint with simple trig, or use the automatic corner chamfer. Remember X is a diameter, so double the radial leg."
url: https://gcodepractice.com/journal/lathe-chamfer-calculation-g-code/
canonical: https://gcodepractice.com/journal/lathe-chamfer-calculation-g-code/
author: "Lawrence Arya"
authorUrl: https://www.linkedin.com/in/vibecoding/
published: 2026-06-08
updated: 2026-06-08
category: "Guides"
tags: ["cnc lathe", "chamfer", "g-code", "calculation"]
lang: en
---

# Lathe Chamfer Calculation in G-code: Two Reliable Methods

> **TL;DR** To program a lathe chamfer in G-code, you can either calculate the endpoint and feed there with G01, or use the control's automatic corner chamfer, often a comma C value added to a move. For a 45 degree chamfer with a leg of C, the diameter changes by 2C because X is a diameter, and the length changes by C. For other angles, use the tangent. Always confirm diameter mode before you cut.

A chamfer, the small angled cut that breaks a sharp corner, is one of the most common features on a turned part, and there are two clean ways to program it in G-code. You can calculate the endpoint and feed there with a single G01 move, or you can use the automatic corner chamfer that most lathe controls offer. Both are simple once you know the small amount of math involved, and both share one trap that catches beginners: on a lathe, X is a diameter, not a radius, so the numbers are not what you might first expect.

This guide covers both methods, the calculation behind them, a worked example, and the mistakes to avoid. The math is a single right triangle, so once you have done it a couple of times, chamfers stop being something you look up and become something you just program.

## The two methods

The first method is direct calculation: you work out where the chamfer ends and feed there with a G01. This always works on any control, because it is just a straight cutting move to a point you computed. The second method is the automatic corner chamfer, where you tell the control the chamfer size and let it insert the angled move between two other moves. On many Fanuc-style controls this is a comma C value, such as adding a chamfer size to the end of a turning move. The automatic method is faster to type, but the calculation method is worth understanding first, because it shows you what the control is doing and it works everywhere.

Either way, a chamfer is just a short angled line, the same idea as [programming any angle on a lathe](/journal/how-to-program-an-angle-on-a-cnc-lathe-without-cam), applied to a corner.

## The calculation, with the diameter trap

A chamfer is usually described by a size and an angle, most often 45 degrees. The size is the length of the leg of the little triangle the chamfer cuts. For a 45 degree chamfer with a leg of C, the tool moves C along Z and C in radius. But because X is programmed as a [diameter](https://en.wikipedia.org/wiki/G-code), the X value changes by twice the radial leg, so by 2C. This is the single most common chamfer error: people change X by C instead of 2C and cut a chamfer half the size they wanted.

For angles other than 45 degrees, use the tangent. The radial change equals the axial length along Z times the tangent of the angle measured from the face, and the diameter change is twice that. So the rule is always the same: compute the radial change, double it for X, and feed to the new X and Z.

| Chamfer | Z change | Radius change | Diameter (X) change |
| --- | --- | --- | --- |
| 0.5 mm at 45 degrees | 0.5 mm | 0.5 mm | 1.0 mm |
| 1.0 mm at 45 degrees | 1.0 mm | 1.0 mm | 2.0 mm |
| 2.0 mm at 45 degrees | 2.0 mm | 2.0 mm | 4.0 mm |

The [CNCCookbook lathe G-code tutorial](https://www.cnccookbook.com/cnc-lathe-g-code-tutorial/) covers turning moves and how the values work, and a general [G-code reference](https://linuxcnc.org/docs/html/gcode/g-code.html) helps with any code you meet.

## A worked example

Say you have a shaft at 20 mm diameter and you want a 1 mm by 45 degree chamfer on the end. The chamfer starts where the OD meets the face. The radius drops by 1 mm, so the diameter drops by 2 mm, to 18 mm, and the tool moves 1 mm along Z. If the face is at Z0, the chamfer move is a G01 to X18.0 Z-1.0 at your feed, starting from X20.0 at the face. That one line cuts the chamfer. To approach, you would position just off the corner, then make that single feed move. Reading it back, X went from 20 to 18, a 2 mm change for a 1 mm chamfer, which is the diameter rule in action.

## Using the automatic corner chamfer

Many controls let you skip the calculation for simple cases. On a Fanuc-style lathe, you can add a chamfer to a corner by appending a comma C value to a move, where the value is the chamfer size. The control then inserts the 45 degree chamfer between that move and the next automatically. This is convenient for breaking edges quickly, and it keeps the program tidy. The format is control specific, so confirm it in your machine's manual, but the idea is the same everywhere: you give the size and the control does the trig. Even when you use this, knowing the calculation matters, because it lets you verify the result is the size you intended.

## The mistakes to avoid

A few errors cause most bad chamfers. The table sums them up.

| Mistake | What goes wrong | How to avoid it |
| --- | --- | --- |
| Changing X by the radius, not the diameter | Chamfer is half the intended size | Double the radial leg for the X value |
| Wrong sign on Z | Chamfer cuts the wrong way | Check the direction before running |
| Confusing leg size with face width | Chamfer is the wrong size | Confirm how the print defines the chamfer |
| Trusting an auto chamfer blindly | Size or direction not what you meant | Verify the result against the print |

The diameter trap is by far the most common, so if a chamfer comes out half size, that is the first thing to check. A chamfer that comes out wrong is also a reminder to read the program carefully, the same habit that helps when a [part tapers unexpectedly](/journal/lathe-cutting-a-taper-when-it-shouldn-t-g-code).

## Chamfers on the inside, when boring

The same calculation applies to an internal chamfer cut while boring, with one thing to watch. The radial leg still becomes a doubled change in X, and the Z leg is unchanged, but the direction of the X change flips because the bore opens outward as you chamfer it. So instead of the diameter getting smaller, as on an external chamfer at the OD, an internal chamfer makes the local diameter larger as the tool moves toward the mouth of the bore. Picture the cut, confirm whether the chamfer widens or narrows the bore along Z, and set the sign of the X change to match. A quick sketch prevents an internal chamfer that slopes the wrong way, which is easy to get backwards when you are thinking about a bore rather than an OD.

## Why direction and sign matter so much

A chamfer is a short move, so a wrong sign does not waste much material, but it does scrap the feature and sometimes the part. The two directions to keep straight are the Z direction, toward or away from the chuck, and the X direction, growing or shrinking the diameter. On an external chamfer at the end of a shaft, the diameter shrinks and Z usually moves negative into the part. On a back chamfer or an internal chamfer, one or both of those flip. The reliable habit is to picture the finished corner, decide which way each axis must move to cut it, and only then write the numbers. Thinking in pictures first, numbers second, is what keeps chamfer directions correct.

## Chamfers as lead-ins for threads and assembly

Chamfers are not only cosmetic. A chamfer at the start of a thread gives the die or the mating part a lead-in, and a chamfer on a bore mouth helps a shaft or a fastener start straight. So the small angled move you are calculating often has a functional job, which is a good reason to get its size right rather than approximate it. When a print calls for a specific chamfer before a thread, it is usually sizing the lead-in deliberately, so the calculation matters for function and not just appearance. Treating chamfers as real features, with a size worth computing exactly, is part of programming a part that assembles and works as intended.

## Verify before you cut

Because you calculated the endpoint, treat the first run as a check. Confirm the diameter mode, re-check your arithmetic, and confirm the sign on Z. Run in single block with the rapid override down for the first part, watching the chamfer move complete before you trust it. A chamfer is a small feature, but a wrong one can mean a reject, so the few seconds of verification are worth it. This is the same careful reading you would apply whether you write the move by hand or [check a posted program](/journal/do-i-need-to-know-g-code-if-i-use-mastercam).

## Build the fluency that makes this quick

Programming chamfers smoothly depends on reading your own code with confidence, which means knowing the codes cold. If you hesitate on what G01 does or how diameter mode works, every chamfer is a slow lookup. Fast recognition of the common codes is what lets you compute and write a chamfer move without breaking stride.

That recognition is recall, built by short practice. The free G-Code Sprint app at GCodePractice.com runs 60-second rounds on the common G and M codes and repeats whatever you miss, so the codes you use to program a chamfer become second nature. It is an educational practice tool for building that fluency, not a machine controller, so always prove the program safely on your machine. Learn the diameter rule once, drill the codes, and chamfers become a quick, routine part of programming.

## Frequently asked questions

### How do you calculate a chamfer in G-code on a lathe?

For a 45 degree chamfer with a leg of C, the tool moves C along Z and C in radius, but because X is a diameter the X value changes by 2C. So you feed with a G01 to the new X, which is the start diameter minus 2C, and the new Z, which is the start minus C. For other angles, multiply the Z length by the tangent of the angle from the face, then double for X. To read the codes quickly, the free G-Code Sprint app at GCodePractice.com drills them in 60-second recall rounds.

### Why is my lathe chamfer half the size I programmed?

Almost always because you changed X by the radial leg instead of the diameter. On a lathe X is a diameter, so a 1 mm chamfer needs a 2 mm change in X. Doubling the radial change for the X value fixes it.

### What is the automatic chamfer on a lathe?

Many controls let you add a chamfer to a corner by appending a value, often a comma C, to a move, and the control inserts the 45 degree chamfer for you. It is faster than calculating, but the format is control specific, so confirm it in your manual and verify the size against the print.

### How do you program a chamfer at an angle other than 45 degrees?

Use the tangent. The radial change equals the Z length times the tangent of the angle measured from the face, and the diameter change is twice that. Add the diameter change to your starting X to get the endpoint for the G01 move.

### Is X a diameter or radius when programming a chamfer?

On most lathes X is a diameter, so all chamfer X values change by twice the radial leg. A few machines run in radius mode, so confirm yours. Getting this wrong is the most common cause of a chamfer cut to the wrong size.

### Should I calculate the chamfer or use the automatic feature?

Use whichever suits the job, but learn the calculation first. The automatic corner chamfer is quick for simple edge breaks, while calculating the endpoint works on any control and lets you verify the size. Knowing the math means you can always check what the automatic feature produced.

---

Source: https://gcodepractice.com/journal/lathe-chamfer-calculation-g-code/
Author: Lawrence Arya — https://www.linkedin.com/in/vibecoding/
