The T gate is a single-qubit phase gate that leaves the basis state |0⟩ unchanged and multiplies the basis state |1⟩ by the phase factor e^(iπ/4). In quantum computing it is the standard non-Clifford gate: added to the Clifford gates, it turns a set of operations that a classical computer can simulate efficiently into a universal gate set that can approximate any quantum computation.
Within quantum gates & circuits, the T gate is often called the π/8 gate, because up to a global phase its matrix can be written with ±π/8 on the diagonal. It is the square root of the S gate and the fourth root of the Pauli-Z gate, and in fault-tolerant machines it is usually the most expensive operation to perform.
How the T gate acts on a qubit
The T gate is the diagonal unitary matrix diag(1, e^(iπ/4)). Because it is diagonal in the computational basis, it never changes measurement probabilities in that basis; it only shifts the relative phase between the |0⟩ and |1⟩ amplitudes by 45 degrees.
On the Bloch sphere, the T gate is a rotation of π/4 about the z-axis. A qubit in the state |+⟩, which points along the x-axis, moves one eighth of a full turn toward the y-axis. Applying T twice gives the S gate (a quarter turn), four times gives Pauli-Z (a half turn), and eight times returns the identity, so T has order 8. Its inverse, written T-dagger, rotates by -π/4.
The following table places the T gate among the phase gates of the same family, which differ only in the angle of the z-rotation.
| Gate | Phase on the 1 state | Rotation about z | Clifford gate |
|---|---|---|---|
| Pauli-Z | e^(iπ) = -1 | π (180°) | Yes |
| S gate | e^(iπ/2) = i | π/2 (90°) | Yes |
| T gate | e^(iπ/4) | π/4 (45°) | No |
| √T gate | e^(iπ/8) | π/8 (22.5°) | No |
| Rz(θ) | e^(iθ), up to global phase | Any angle θ | Only for multiples of π/2 |
Why the T gate completes a universal gate set
The T gate matters because of what the Clifford group cannot do. Circuits built only from Hadamard, S and CNOT gates map Pauli operators to Pauli operators, and the Gottesman–Knill theorem shows that such circuits, with computational-basis preparation and measurement, can be simulated efficiently on a classical computer. Clifford circuits alone therefore offer no quantum advantage.
Adding the T gate breaks this restriction. The set {H, S, CNOT, T}, often shortened to Clifford+T, is approximately universal: any multi-qubit unitary can be approximated to arbitrary precision. The Solovay–Kitaev theorem guarantees that the number of gates needed grows only polylogarithmically in 1/ε, where ε is the target accuracy, and modern number-theoretic synthesis methods reach about 3·log2(1/ε) T gates for a single-qubit z-rotation.
The table below summarizes how common gate sets compare in classical simulability and universality.
| Gate set | Classically simulable | Universal | Typical role |
|---|---|---|---|
| Pauli gates only | Yes, trivially | No | Error models and correction |
| Clifford (H, S, CNOT) | Yes, by Gottesman–Knill | No | Stabilizer codes, entanglement |
| Clifford+T | No, in general | Yes, approximately | Fault-tolerant computation |
| H, T, Toffoli | No, in general | Yes, approximately | Reversible arithmetic circuits |
T count, T depth and the cost of fault tolerance
In error-corrected hardware, Clifford gates are comparatively cheap, while the T gate is not transversal in the leading codes. In the surface code, Pauli and CNOT operations can be performed by lattice surgery or transversal methods, but a logical T gate is normally implemented by consuming a specially prepared magic state, the state T|+⟩, through gate teleportation.
Raw magic states are noisy, so they must be purified by magic state distillation. A classic protocol, the 15-to-1 distillation, takes 15 noisy states and outputs one state with an error rate roughly proportional to 35 times the input error cubed. Distillation factories can occupy a large share of the physical qubits and running time of a fault-tolerant processor, which is why resource estimates focus on two metrics.
| Metric | Definition | Why it matters |
|---|---|---|
| T count | Total number of T and T-dagger gates | Sets the number of magic states to distill |
| T depth | Number of sequential layers containing T gates | Bounds the runtime when factories work in parallel |
| Clifford count | Number of Clifford gates | Usually secondary in fault-tolerant estimates |
| Qubit count | Logical qubits including ancillas | Trades off against T depth |
For example, a standard decomposition of the Toffoli gate uses 7 T gates and a T depth of 3, or a T depth of 1 when extra ancilla qubits are available. Circuit optimizers therefore try to minimize T count by merging phase gates, canceling adjacent T and T-dagger pairs and choosing ancilla-assisted constructions.
How the T gate relates to neighboring gates
The T gate is easy to confuse with other phase and rotation gates. The key distinctions concern angle, Clifford membership and implementation cost.
- Phase gate (S): a 90° rotation and a Clifford gate; T is its square root and is not Clifford.
- Rotation gate Rz(π/4): equal to T up to a global phase of e^(-iπ/8), which has no physical effect on a single gate but matters when the gate is controlled.
- Hadamard gate: a Clifford gate that changes the basis; alternating H and T generates a dense set of single-qubit rotations.
- Toffoli gate: a non-Clifford three-qubit gate that is usually compiled into Clifford+T, so its cost is counted in T gates.
On many current noisy intermediate-scale devices without error correction, the native gate set includes a virtual Rz gate implemented by a frame change in control software. There the T gate costs essentially nothing, and its special expense appears only in fault-tolerant architectures.
Common mistakes and limitations
Several misunderstandings recur when engineers first work with the T gate. The table lists the most frequent ones with their correction.
| Misconception | Correction |
|---|---|
| T rotates by π/8 | It rotates by π/4; π/8 refers to the symmetric matrix form |
| T changes measurement outcomes | It only changes phase; outcomes change after later gates such as H |
| T is cheap everywhere | It is cheap on physical hardware but costly in error-corrected codes |
| Any angle can be exact | Arbitrary rotations are approximated with a finite T sequence |
| T equals Rz(π/4) when controlled | The global phase becomes a relative phase under control |
A practical limitation is that approximation errors accumulate: every synthesized rotation adds a small error, so the precision ε per rotation must be chosen with the total error budget of the algorithm in mind. Alternative routes to universality, such as code switching or codes with a transversal T gate like the 15-qubit Reed–Muller code, shift the cost elsewhere rather than removing it.
The short version
A qubit can be pictured as an arrow on a globe. The T gate turns that arrow one eighth of a turn around the vertical axis. It does not change whether a measurement gives 0 or 1 by itself, but it changes how the qubit will interfere with others later.
The simple gates that are easy to protect from errors are also easy for an ordinary computer to imitate. The T gate is the extra ingredient that makes quantum computers powerful, and in error-protected machines it is the hardest step to perform, so engineers count T gates carefully, much as a builder counts the most expensive material.
Where it makes a difference
A research team estimating the resources for simulating a catalyst molecule on a future fault-tolerant computer compiles its algorithm into Clifford+T. The first version needs about 10 billion T gates, and with four distillation factories each producing one magic state per microsecond-scale cycle, the projected runtime stretches to many days.
The team then replaces naive rotation synthesis with optimized decompositions, merges consecutive phase gates and uses ancilla-assisted Toffoli constructions with a T depth of 1. The T count drops by roughly a factor of three, and the estimated runtime and number of factory qubits fall accordingly. The Clifford gates barely affect the estimate; the T budget decides whether the calculation is practical.