← Atlas

Gates · Multi-controlled gate

Toffoli (CCX) gate

The three-qubit doubly-controlled NOT gate that implements reversible classical AND/NAND logic and is universal for classical reversible computation.

Exact & formalUpdated

View frozen graph

A small worked example, computed in your browser. It is not a result from this record's papers.

The Toffoli gate computes an AND

Three qubits, with both controls set to |1⟩ — the one case out of four in which the target flips.

q0q1q2Step 1 of 3 · XXStep 2 of 3 · XXStep 3 of 3 · CCXCCX

Step 1 of 3 · X

Probability of each outcome after this step

  • 001100%
  1. First control to |1⟩.

    The whole state moves from 000 to 001 — one certain outcome before, one certain outcome after, no superposition either side.

  2. Second control to |1⟩, so both are now set.

    The whole state moves from 001 to 011 — one certain outcome before, one certain outcome after, no superposition either side.

  3. Flips the target only because both controls are 1 — the target ends up holding their AND. This is why Toffoli is universal for classical reversible computation: anything a classical circuit can compute, a circuit of these can compute reversibly.

    The whole state moves from 011 to 111 — one certain outcome before, one certain outcome after, no superposition either side.

Readout The register reads 111. Change either control to 0 and the target stays 0 — the gate is an AND, written so that it can be undone by applying it again.

Open in Studio
  • Steps1
  • Wires3
  • Qubits3
  • Depth1 native / 6 CNOT decomposition
  • T-count7 (4 T, 3 T†)
  • Papers2

Toffoli is the standard bridge between quantum circuits and classical reversible logic: it is exactly a reversible AND gate, and its decomposition cost (CNOTs and T gates) is a recurring resource-counting benchmark for fault-tolerant compilation.

References

  • Elementary gates for quantum computation

    Adriano Barenco, Charles H. Bennett, Richard Cleve, David P. DiVincenzo, Norman Margolus, Peter Shor, Tycho Sleator, John A. Smolin, Harald Weinfurter · 1995

    Shows that single-qubit U(2) gates plus CNOT are universal and gives explicit decompositions for controlled-U, Toffoli, and Fredkin gates.

  • Quantum Computation and Quantum Information: 10th Anniversary Edition

    Michael A. Nielsen and Isaac L. Chuang · 2010

    Standard reference for single- and multi-qubit gate matrices, Euler-angle decomposition, and universal gate sets.

Exact & formal
  • Basis-state truth table
  • Unitary / matrix equivalence
  • Peer-reviewed paper
  • Textbook / standard citation
Method
Apply CCX to all eight computational-basis inputs and confirm the target flips only for the |11⟩ control pair.
Result
Pass · CCX|1,1,t⟩ = |1,1,1-t⟩ and CCX leaves all other seven basis states unchanged.
OpenQASM 3 standard gate set ↗
Kind
curated reference
Reviewed by
Leona Quantum curation pass
License
CC BY 4.0-compatible reference metadata
toffolireversible logicthree qubituniversal

Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.