# LinuxCNC M51

Instructions · `M51` · verification: source checked

M51 enables or disables the spindle speed override control for a selected spindle in LinuxCNC. The optional P1 argument enables the override control and P0 disables it. While the control is disabled, the spindle speed override has no influence and the spindle runs at the exact speed given by the programmed S-word.

## Specification

| Property | Value |
|---|---|
| Language | gcode |
| Code | M51 |
| Group | spindle speed override control |
| Syntax | M51 <P1> <$- |
| Dialect | LinuxCNC |

### Parameters

| Name | Description |
|---|---|
| P | Optional; P1 enables the spindle speed override control, P0 disables it. |
| $ | Optional spindle selection parameter. |

## Safety

- While the spindle speed override control is disabled, the override has no influence and the spindle speed is the exact program-specified value of the S-word.

## Study notes

- M51 takes an optional P word: M51 P1 (P1 optional) enables the spindle speed override control for the selected spindle, M51 P0 disables it.
- An optional $ parameter selects which spindle the command operates on.
- M51 controls the spindle speed override individually; the document notes that M48 and M49 toggle both the spindle speed and feed rate override controls together (these codes have no matching entry in the reference list).
- M70 modal state saving includes the speed override (M51) setting.

## Sources

1. [M-Codes](https://linuxcnc.org/docs/html/gcode/m-code.html#mcode:m51) (accessed 2026-10-26)

---

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