The building blocks of quantum computation - rotations, flips, and entanglement
Quantum gates are the moves of a quantum computer. Click through them, chain them together, and see what each one does to a qubit.
Click any gate to see its circuit symbol, its matrix and what it does to a qubit. Compare the 2×2 single-qubit gates with the larger two-qubit ones.
Quantum gates are reversible operations on qubits — the quantum analogs of classical logic gates (AND, OR, NOT). Every quantum computation is a sequence of gates applied to qubits. Unlike classical gates, quantum gates are represented by unitary matrices, which preserve the total probability of quantum states.
A small set of gates (like H, T, and CNOT) is universal — any quantum algorithm can be decomposed into these primitive operations. This is the quantum analog of how NAND gates can build any classical circuit.
Browse the essential quantum gates. Each gate has a circuit symbol, a unitary matrix, and a description of what it does to qubit states. Single-qubit gates are 2×2 matrices; multi-qubit gates operate on larger state spaces.
Apply gates one at a time and watch the probability bars and phase circles. Try H, then Z, then H again — you end up exactly where X would put you.
Apply gates one at a time and watch the qubit state evolve. The probability bars show how likely each measurement outcome is, and the complex amplitude circles show the full quantum state including phase. Try applying H to create superposition, then Z to flip the phase, then H again — you get X!
Choose CNOT, CZ or SWAP, then pick an input state. Watch which inputs each gate changes and which it leaves alone.
Two-qubit gates create correlations between qubits. CNOT flips the target if the control is |1⟩ — it's the workhorse of quantum computing. CZ applies a phase when both qubits are |1⟩. SWAP exchanges two qubits. Select different input states to see how each gate transforms the two-qubit system.
Entangling gates — Two-qubit gates like CNOT can create entanglement, which is essential for quantum advantage
Pick a decomposition, such as SWAP from 3 CNOTs, and step through it. The simple gates add up to the same effect as the complex one.
Complex gates can be broken down into simpler primitives. SWAP decomposes into three CNOTs. CNOT can be built from CZ and Hadamards. Even the 3-qubit Toffoli gate has a decomposition into single-qubit and two-qubit gates. This is how quantum compilers translate high-level operations into hardware-native gate sets.
Add gates to build a sequence and read off the resulting matrix, or try a preset like HZH = X. Then compare XZ with ZX: order matters.
Quantum gates follow algebraic rules — but order matters! Gate multiplication is non-commutative: XZ ≠ ZX. Build gate sequences and see the resulting matrix. Discover identities like HZH = X, SS = Z, and XX = I. The matrix view shows exactly how the arithmetic works.
Involutions: X, Y, Z, and H are all their own inverses: applying them twice gives the identity. This makes them easy to undo.
Non-commutativity: XZ = −iY but ZX = iY. The sign difference matters! This is fundamentally different from classical gates where AND(a,b) = AND(b,a).
Spot a mistake or have an idea?