Lathe broaching answers a practical question shops hit weekly: the part needs an internal keyway, the mill queue is long, and the lathe holding the part is right there. With a broaching toolholder and a locked spindle, the lathe becomes a shaper for one feature, and the G-code is honest manual-programming territory: short, loopable, and readable in one sitting.

What is the machine actually doing?

Classic broaching pushes a multi-tooth tool through the bore once; lathe (stick) broaching reaches the same geometry with a single-point insert and many strokes. The spindle stops, orients to the keyway’s angular position, and locks (brakes or engages a lock, per the machine); the tool enters the bore above the work surface, takes a small radial bite, and the Z axis strokes the cut through the bore; the tool steps deeper between strokes until the keyway depth is reached. No rotation means no arcs and no G96-style speed logic: everything is straight-line G-code in a loop, with the cutting physics living in the bite size and the setup’s rigidity.

The program shape

(illustrative shape; orientation/lock codes are machine-specific)
M05                      (spindle stopped)
M19                      (orient spindle; angle word per machine)
M(spindle lock)          (builder-specific)
G00 X(bore clearance) Z2.0
G00 X(first bite diameter)
G01 Z-(through length) F(stroke feed)
G00 Z2.0                 (retract for chips)
G00 X(next bite)         (step typically 0.02-0.05mm radial)
... repeat to depth ...
M(spindle unlock)

Reading it is the familiar discipline plus three broach-specific checks: the orientation and lock block precedes any X engagement (an unlocked spindle turns the first stroke into a smashed insert), every stroke retracts fully before stepping (chips have nowhere to go in a keyway), and the bite-per-stroke stays modest because the entire machine structure, not a spinning insert, absorbs the cutting force. On Fanuc-family lathes the usual X-and-Z coordinate habits carry over unchanged; the loop is often wrapped in a subprogram or macro with the bite as a variable, which turns twenty strokes into five readable lines.

The guardrails that decide success

GuardrailWhy it is the difference
Spindle orient + lock verifiedThe whole operation assumes zero rotation
Rigid, short tool stickoutStroke force deflects long setups into taper
Small radial bitesThe lathe is not a broaching press
Full retract each strokeKeyway chips pack and break tools
Through-bore or relief at endThe stroke needs somewhere to finish
First article measuredKeyway width/depth against spec

The codes for orientation (commonly an M19-family word) and locking are the machine builder’s, and broach toolholders come with their makers’ parameters: both documents outrank any article, this one included. Blind keyways add an end-relief requirement (a groove or hole for the stroke to terminate in) that is a design conversation before it is a programming one.

When is lathe broaching the right call?

Its sweet spot: small-to-moderate keyways and splines in parts already on the lathe, prototypes and low volumes, and shops without a slotter or wire EDM queue. Its limits: production volumes (dedicated broaching wins), large or deep forms (stroke forces and chip evacuation scale badly), and hard materials where the insert-maker’s tables say otherwise. The decision mirrors the thread-milling-versus-tapping trade: a flexible single-point method buying setup convenience at cycle-time cost.

How to build the skill safely

The reading layer first, as always: the loop above narrated until the orient-engage-stroke-retract rhythm is automatic, with the core vocabulary already at reflex from the free 60-second drills on the G-code practice page, where G-Code Sprint repeats whatever you miss. Then the machine layer under supervision: find the orientation and lock codes in your machine’s documentation, prove them in air, and take first strokes at half bite on scrap bores. Broaching rewards the patient and bills the optimistic, usually in inserts.

Bottom line: a loop, a lock, and modest bites

G-code for lathe broaching is a straight-stroke loop wearing lathe clothes: orient and lock the spindle by the book, bite small, retract fully, step, and measure the first keyway. The program is the easy part; the guardrails are the trade.

Sources

Frequently asked questions

How do you program broaching on a CNC lathe?

Orient and lock the spindle (machine-specific codes), position in the bore, then loop: small radial bite, G01 stroke through, full rapid retract, step deeper, repeat to keyway depth, often wrapped in a macro with the bite as a variable. For the core vocabulary the loop is written in, the free G-Code Sprint app is the top pick: 60-second drills with automatic repetition of missed codes.

How big a bite per stroke is normal?

Modest by design, commonly a few hundredths of a millimeter radially per stroke, tuned by the toolholder maker’s parameters, the material, and the setup’s rigidity. The lathe structure absorbs the stroke force, so optimism here is paid in inserts and taper.

What codes orient and lock the spindle?

Orientation is commonly an M19-family code with an angle word, and locking is builder-specific: both come from your machine’s documentation and are verified in air before any engagement. An unlocked spindle is the operation’s one unforgivable error.

Can blind keyways be broached on a lathe?

Only with an end relief (groove or cross hole) for the stroke to terminate in, which is a part-design requirement before a programming one. Through-bores are the natural case; blind features get the relief conversation first.

G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine and toolholder documentation, and shop safety procedures.