# LinuxCNC S (Set Spindle Speed)

Instructions · `S` · verification: source checked

S sets the spindle speed in revolutions per minute. An optional $ selects which spindle the speed applies to; without it the command defaults to spindle.0. The spindle turns at that speed when M3 or M4 is in effect.

## Specification

| Property | Value |
|---|---|
| Language | gcode |
| Code | S |
| Group | spindle |
| Syntax | Sx [$n] |
| Dialect | LinuxCNC |

### Parameters

| Name | Description |
|---|---|
| x | Spindle speed in revolutions per minute (RPM). |
| $n | Optional spindle number; without it the command defaults to spindle.0. |

## Connected

- Related: [LinuxCNC G84 Right-hand Tapping Cycle, Dwell](https://machineschema.com/instruction/gcode-g84.md), [LinuxCNC G93](https://machineschema.com/instruction/gcode-g93.md), [LinuxCNC G95](https://machineschema.com/instruction/gcode-g95.md), [LinuxCNC M3](https://machineschema.com/instruction/mcode-m03.md), [LinuxCNC M4](https://machineschema.com/instruction/mcode-m04.md)

## Safety

- A negative S number is an error.

## Study notes

- S may be programmed whether the spindle is turning or not.
- The spindle turns at the programmed speed only when M3 or M4 is active.
- If the speed override switch is enabled and not at 100%, the actual speed differs from the programmed value.
- S0 is permitted and the spindle will not turn.
- If a G84 tapping cycle is active and the speed and feed potentiometers are enabled, the lowest setting is used; rotational speed and feed rate remain synchronized, so the speed may differ from the programmed value even with the speed potentiometer at 100%.
- The G93/G94/G95 feed rate modes change how feed rate is interpreted, not the S word.

## Sources

1. [Other Codes](https://linuxcnc.org/docs/html/gcode/other-code.html#sec:set-spindle-speed) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/word-s  
JSON: https://machineschema.com/instruction/word-s.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
