Quantum circuit examples
Each example is a real circuit you can open in the builder, step through and edit. The expected results on these pages were checked by running the same simulator that powers the builder.
Reviewed November 2026.
Beginner
Superposition with one Hadamard gate
1 qubit
The smallest interesting circuit: one qubit, one gate, and a perfectly fair quantum coin.
Interference: why H, Z, H flips a bit
1 qubit
Two Hadamards with a phase flip between them turn |0⟩ into |1⟩. Probabilities cannot explain this, but amplitudes can.
Bell state: your first entangled pair
2 qubits
H on one qubit then CNOT creates two qubits whose measurement results always agree.
GHZ state: three-qubit entanglement
3 qubits
Chain CNOTs after a Hadamard to entangle three qubits so they all agree.
A quantum random bit generator
3 qubits
Three Hadamards and three measurements give a random number from 0 to 7.
Intermediate
SWAP built from three CNOT gates
2 qubits
Three alternating CNOTs exchange two qubits’ states. Many chips have no native SWAP, so compilers do this constantly.
Toffoli gate as a reversible AND
3 qubits
A gate with two controls computes the AND of two bits while keeping the inputs, which is what makes it reversible.
Superdense coding: two bits in one qubit
2 qubits
With a shared Bell pair, sending one qubit can carry two classical bits.
Deutsch–Jozsa: constant or balanced in one query
3 qubits
A small instance of the first algorithm with a proven quantum advantage in query count.
Bernstein–Vazirani: finding a hidden string
4 qubits
A single quantum query recovers a hidden three-bit string that classical methods find one bit at a time.
Grover search on two qubits
2 qubits
Find the marked item among four with a single Grover iteration, which is exact for N = 4.