CNC lathe · G-code

G96 / G97: constant surface speed on and off

G96 makes S a surface speed (SFM or m/min), so RPM rises as the diameter shrinks; G97 makes S plain RPM. Always clamp the maximum RPM before G96. Haas lists it in modal group 13. Formats below from Haas and LinuxCNC, each from its maker.

Worked example

Face at 400 SFM, clamped to 2,500 RPM (Haas). Written for this page in the Haas format.

G50 S2500 (RPM clamp)G96 S400 M03G00 X2.1 Z0G01 X-0.03 F0.008G97 S800 (back to RPM)

At 400 SFM on a 2.1" diameter the spindle turns 3.82 × 400 ÷ 2.1 = 728 RPM; G50 S2500 caps it near the centre.

How each control writes it

Haas G50 S- (RPM clamp), then G96 S- / G97 S-

One source: Haas Automation, the control's maker

S
G96: surface feet (inch) or meters (mm) per minute; G97: RPM
  • RPM = 3.82 × SFM / diameter.
  • G50 S- sets the maximum spindle RPM; without it, RPM climbs toward X0 and can throw the part.

Source: Haas Automation, lathe G96

LinuxCNC G96 D- S- / G97 S-

One source: the LinuxCNC project, the control's maker

S
Surface speed (G96) or RPM (G97)
D
Maximum RPM in G96 (optional)
$
Spindle (optional)
  • X0 in the active coordinate system must be the spindle center.
  • The RPM clamp is the D word, not a separate code.

Source: LinuxCNC documentation, "G96, G97 Spindle Control Mode" (archived Oct 29, 2026)

How the controls differ

  • Only LinuxCNC takes $, D.
  • A word two controls share can still mean different things: read each control's list above.

No Fanuc row yet: that chapter of the 0i manual has not been read.

Haas follows Fanuc's numbering, but options and parameters differ between controls: check your control's manual.