Source-verifiedLevel 3

Fredkin Gate (CSWAP)

The Fredkin gate (Controlled-SWAP) swaps two target qubits only when the control qubit is |1⟩.

What it means

The Fredkin gate is a 3-qubit gate that conditionally swaps the second and third qubits based on the first (control) qubit.When the control is |0⟩, the targets are unchanged; when |1⟩, they are swapped.It is universal for classical reversible computation and can be used as a comparator.The Fredkin gate preserves the Hamming weight of the input and can be decomposed into Toffoli and CNOT gates.

Everyday analogy

Like a railroad switch that only activates when the signal (control) is on.

Common misconceptions

  • Fredkin is NOT the same as Toffoli — Fredkin swaps while Toffoli flips.
  • Fredkin gate preserves Hamming weight, which Toffoli does not.

Key takeaways

  • Conditionally swaps two qubits based on control.
  • Universal for classical reversible computation.
  • Preserves Hamming weight.

Check your understanding

What does the Fredkin gate do when control = |1⟩?

  1. A.Flips both targets
  2. B.Swaps both targets
  3. C.Does nothing
  4. D.Entangles targets
Show the answer

Answer: B. Swaps both targets

Why: The Fredkin gate swaps the two target qubits when control is |1⟩.

Builds on

Primary source: Fredkin & Toffoli, Conservative logic, Int. J. Theor. Phys. 21, 219 (1982), doi:10.1007/BF01857727

Learn it hands-on

This concept is part of a 46-level curriculum with an interactive simulator and Lumen, a tutor whose answers are verified before you see them. Levels 1–5 are free.