# T gate **T gate** (or **$\pi/8$ gate**, or **$\sqrt{S}$ gate**) is a single-qubit gate that adds a phase of $\pi/4$ to the $\lvert 1\rangle$ state while leaving $\lvert 0\rangle$ unchanged. It is a special case of the [[p-gate|phase gate]] with $\phi = \pi/4$, and is the square root of the [[s-gate|S gate]]: $T^2 = S$. $$T = \begin{pmatrix}1 & 0\\ 0 & e^{i\pi/4}\end{pmatrix}$$ On the computational basis, $T\lvert 0\rangle = \lvert 0\rangle$ and $T\lvert 1\rangle = e^{i\pi/4}\lvert 1\rangle$. On the [[bloch-sphere|Bloch sphere]], $T$ is a $\pi/4$ rotation about the $z$-axis. Unlike the [[s-gate|S gate]], $T$ is not a Clifford gate: it does not map [[pauli-gates|Pauli operators]] to Pauli operators under conjugation, making it the "hard" gate in fault-tolerant quantum computing. Implementing $T$ on error-corrected hardware requires magic state distillation, which consumes many physical qubits per logical $T$ gate. Together with the [[h-gate|Hadamard gate]] and the [[cx-gate|CX gate]], $T$ forms a universal gate set: any quantum computation can be approximated to arbitrary precision using only $\{H, T, \text{CX}\}$.