# LinuxCNC T

Instructions · `T` · verification: source checked

T is the LinuxCNC G-code word that prepares the machine to change to tool x. It does not change the tool by itself; the change occurs when M6 is programmed, either on the same line or a later line. Only the most recent T word applies at the next tool change.

## Specification

| Property | Value |
|---|---|
| Language | gcode |
| Code | T |
| Group | tool |
| Syntax | Tx |
| Dialect | LinuxCNC |

### Parameters

| Name | Description |
|---|---|
| x | Tool number to prepare for the next tool change; the change itself occurs at M6. |

## Connected

- Related: [LinuxCNC G1 Linear Move](https://machineschema.com/instruction/gcode-g01.md), [LinuxCNC M6](https://machineschema.com/instruction/mcode-m06.md)

## Safety

- It is an error to use a negative T number.
- It is an error to use a T number that does not appear in the tool table file, with the exception that T0 on nonrandom toolchangers is accepted.

## Study notes

- The T word may appear on the same line as M6 or on a previous line; T words may also appear on several lines with no tool change occurring.
- Only the most recent T word takes effect at the next tool change.
- On machines whose carousel moves when a T word is programmed, placing the T word several lines before the tool change saves time; a common practice is to put the next tool's T word on the line after a tool change.
- Rapid moves after T<n> are not shown in the AXIS preview until after a feed move; this applies to machines that travel long distances to change tools, such as a lathe.
- To turn off that preview behaviour for the current program, program a G1 without any move after the T<n>.
- With a nonrandom toolchanger (RANDOM_TOOLCHANGER setting in EMCIO), T0 gets special handling and no tool is selected, which can leave the spindle empty after a tool change.
- With a random toolchanger, T0 has no special treatment and is a valid tool like any other; using T0 to track an empty pocket makes the machine behave like a nonrandom toolchanger and unloads the spindle.

## Sources

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

---

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