G-codeUnits & ModesModal group 13Lathe
G96 & G97: Constant Surface Speed on a Lathe
G96 turns S into a cutting speed, metres per minute in metric, and the control changes the rpm as the tool moves in X so the speed at the tool edge stays the same on every diameter. G97 cancels it, and S is plain rpm again. The rpm the control asks for is 1000 x Vc / (pi x D), so at 200 m/min it is about 1060 rpm on a 60mm bar and 6370 rpm on a 10mm one, and at X0 there is no upper limit at all. That is why every G96 sits under a clamp: G50 S on a Fanuc in G code system A, on a Haas and on an Okuma, G92 S on a Fanuc in systems B and C, and LIMS on a Siemens. Threading goes in G97.
Syntax
G50 S__ Maximum spindle speed in rpm (Fanuc system A, Haas, Okuma)
G92 S__ Maximum spindle speed in rpm (Fanuc systems B and C)
G96 S__ Constant surface speed on: S is m/min (ft/min in inch)
G97 S__ Constant surface speed off: S is rpmParameters
| Address | Meaning | Notes |
|---|---|---|
S on G96 | Cutting speed, m/min (ft/min in inch) | Taken from the insert maker's data for the material, for example 200 m/min for a finishing pass in mild steel |
S on G97 | Spindle speed, rpm | Write it on the G97 line every time, so the speed after the switch is the one you chose |
S on G50 or G92 | Maximum spindle speed, rpm | The ceiling G96 can reach. Set it below the chuck's and the workholding's rating, not at the machine maximum |
Example
O0096 (FACE AND TURN, 60MM BAR)
G21 G40 G99 G97 S500 (safe start, feed per rev, fixed rpm)
T0101 (80 DEG FINISHING TOOL, OFFSET 01)
G54 (work offset, X0 on the spindle centre)
G50 S2500 (clamp: never above 2500 rpm in G96)
G96 S200 M03 (200 m/min, spindle on, about 1060 rpm at 60mm)
G00 X64. Z0. M08 (clear of the bar, on the face, coolant)
G01 X-1.6 F0.12 (face past centre, clamps at 2500 rpm below 25.5mm)
G00 Z2. (off the face)
X56. (to finish diameter)
G01 Z-40. F0.2 (turn 56mm diameter, about 1140 rpm)
X64. (up the shoulder, clear of the bar)
G00 Z2. M09 (retract, coolant off)
G97 S800 (fixed rpm before the long rapid home)
G28 U0. W0. (home X and Z)
M30Controller differences
| Control | Behaviour |
|---|---|
| Fanuc | G96 and G97 are group 02 on a lathe and group 13 on a machining centre. The clamp is G50 S in G code system A and G92 S in systems B and C, and that same code is the coordinate system setting, so the clamp block carries S and nothing else. The manual's own threading warning says not to use constant surface speed control during threading and to use G97 instead. |
| Haas | S under G96 is surface feet per minute in the Haas workbooks, and G50 S is the ceiling the calculated speed cannot pass. G97 is the power-on default, and Haas tells you to program G97 with a spindle speed at the start and end of every tool. G50 is also the global coordinate offset on a Haas lathe. The Haas mill list has no G96: it goes from G95 to G98, and G50 there cancels scaling. |
| Siemens 840D | The clamp goes on the G96 line as LIMS=, as in G96 S100 LIMS=2500, and G96 switches the feed to G95, per revolution, by itself. If G95 was not already active, the G96 block needs a new F. G961 keeps constant cutting speed with the feed per minute instead. SCC assigns which axis the speed is calculated from, and programmable frames such as TRANS, SCALE and ROT are taken into account, so a frame on the face axis changes the spindle speed. LIMS works only with G96 and G97 and overwrites setting data SD 43230, and it cannot lift the limit set by G26 or the machine data. |
| Okuma | A G96 or G97 block must carry an S word, and the S on G97 is the rpm the spindle runs at afterwards. G50 S is the maximum spindle speed. A calculated speed past the top or bottom of the gear range selected by M code is held at that limit and the LIMIT lamp lights. Thread cutting is not possible in G96. The manual warns that a large rapid X move in G96 changes the spindle speed suddenly, so cancel G96 before a long X move or a return to the turret index position. |
| Grbl | No constant surface speed. G96 and G97 are not on the v1.1 list, a block carrying one stops with error:20, and the spindle limits are settings $30 and $31. |
| Marlin | No G96 or G97: the G-code index goes from G92 Set Position to the M codes. |
What goes wrong
A missing clamp lets the spindle run away on a facing pass. At 200 m/min the control wants about 6370 rpm at 10mm diameter and keeps climbing towards X0, so without G50 S it heads for the machine maximum. Fanuc's own safety pages warn about exactly this. On a 250mm chuck with soft jaws, or a long bar hanging out of the headstock, that is the wrong speed to discover. Set the clamp from the chuck and the bar, then check the active clamp on the screen before the first part.
Threading in G96 ruins the thread. The rpm changes on every pass as X steps in, and the lead has to stay locked to the spindle. Fanuc says to use G97 for threading and an Okuma refuses it outright, so write G97 with an S on the line before the threading tool.
A drill or centre drill on X0 that inherits G96 runs at the clamp speed, 2500 rpm in the example instead of the 800 you meant, and the drill burns. Haas wants G97 with an S at the start and end of every tool for this reason.
On a Siemens, G96 switches the feed to G95 by itself. An F150 written on that block as mm per minute asks for 150mm per revolution, so write it as F0.15.
Last, the speed is worked out from X, so X0 has to be the spindle centre. A frame or TRANS on X, or a wrong offset, makes the control calculate for a diameter that is not there.
Updated 16 Oct 2026