PennyLane
Install
Install
  1. Compilation/
  2. (Clifford + T) Gate Set

(Clifford + T) Gate Set

OverviewDetailsResources

The (Clifford + T) gate set typically refers to the set of gates

(\text{Clifford} + T) := \{H, S, \text{CNOT}, T\}.

It is universal in the sense that any quantum circuit can be approximated to arbitrary precision by this set of gates. One distinguishes between Clifford and non-Clifford gates, where the T gate is a special case of a non-Clifford gate. In many fault-tolerant quantum computing settings, T gates are considered the most expensive gates to implement, and their count is often the target metric to minimize in quantum compilation routines (see this blog post on T-gate optimization).

In most quantum error correction codes like the surface code, (Clifford + T) is the target gate set.

Inputs

  • Arbitrary circuit U

Outputs

  • Approximated circuit U_\text{(Clifford + T)}

Example

A Pauli rotation about a multiple of \frac{\pi}{2} is a Clifford operation. For example, we have

R_Z\left(\frac{\pi}{2}\right) = e^{-i \frac{\pi}{4}} S.

However, in general, Pauli rotations are realized by a series consisting of phase gates S, Hadamard gates H and, in particular, T gates. For example, R_Z\left(\frac{\pi}{128}\right) is realized by the series

SHTHTHTHTHTHTHTSHTHTHTHTSHTHTHTHTHTSHTSH
THTHTHTHTSHTHTHTSHTSHTHTSHTSHTSHTHTHTHTS
HTHTHTHTHTSHTSHTHTSHTHTSHTSHTSHTSHTHTSHT
SHTSHTSHTHTHTSHTSHTSHTHTHTHTSHTHTSHTHTHT
SHTHTHTHTSHTHTSHTHTSHTSHTSHTHTHTHTHTHTHT
SHTHTSHTHTHTSHTSHTHTHTSHTSHTSHTHTSHTHTHT
HTSHTSHTSHSSS

with a precision of 10^{-10}.

Depending on the definition, Toffoli gates are not considered to be in (Clifford + T), but they can be decomposed in this gate set in the following way.

import pennylane as qml

toffoli = qml.Toffoli([0, 1, 2]).decomposition()
print(qml.draw(lambda: [qml.apply(op) for op in toffoli])())
0: ───────────╭●───────────╭●────╭●──T──╭●─┤  
1: ────╭●─────│─────╭●─────│───T─╰X──T†─╰X─┤  
2: ──H─╰X──T†─╰X──T─╰X──T†─╰X──T──H────────┤  

Typical usage

In most error correction schemes, quantum circuits are assumed to be executed in the (Clifford + T) gate set, where Clifford gates are executed in a fault-tolerant way and T gates are performed via magic state injection. A magic state |H\rangle = |0 \rangle + e^{i \frac{\pi}{4}} |1\rangle can be used as a resource from an auxiliary wire to apply T on an arbitrary state |\psi\rangle in the following way.

0  : |ψ> ─╭●───────S─┤  T|ψ>
aux: |H> ─╰X──┤↗├──║─┤  
               ╚═══╝   

This is called magic state injection. Magic states can be created in a noisy way and purified using magic state distillation to arbitrary precision.

References

[1] "Universal Quantum Computation with ideal Clifford gates and noisy ancillas", Sergei Bravyi, Alexei Kitaev, arXiv:quant-ph/0403025, 2004

[2] "The Solovay-Kitaev algorithm", Christopher M. Dawson, Michael A. Nielsen arXiv:quant-ph/0505030, 2005

[3] "Optimal ancilla-free Clifford+T approximation of z-rotations", Neil J. Ross, Peter Selinger, arXiv:1403.2975, 2014

Cite this page

@misc{PennyLane-Clifford_T,
    title = "(Clifford + T) Gate Set",
    author = "Korbinian Kottmann",
    year= "2025"
    howpublished = "\url{https://pennylane.ai/compilation/clifford-t-gate-set}"
}

Page author(s)

Korbinian Kottmann
Korbinian Kottmann

Korbinian Kottmann

Quantum simulation & open source software

PennyLane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Built by researchers, for research. Created with ❤️ by Xanadu.

Research

  • Research
  • Performance
  • Hardware & Simulators
  • Demos
  • Quantum Compilation
  • Quantum Datasets

Education

  • Teach
  • Learn
  • Codebook
  • Coding Challenges
  • Videos
  • Glossary

Software

  • Install PennyLane
  • Features
  • Documentation
  • Catalyst Compilation Docs
  • Development Guide
  • API
  • GitHub
Stay updated with our newsletter

© Copyright 2025 | Xanadu | All rights reserved

TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc.

Privacy Policy|Terms of Service|Cookie Policy|Code of Conduct