A quantum circuit is the gate-based model of quantum computing: qubits start in a known state and are transformed by a sequence of reversible gates before measurement. This drag-and-drop simulator lets you build circuits on up to 3 qubits and watch superposition and entanglement emerge in real time. The same logic powers algorithms like Shor's factoring and Grover's search that promise speed-ups beyond any classical computer.
|psi> = U_n ... U_2 U_1 |00...0> — the final state is the ordered product of gate unitaries U_k applied to the all-zero input; P(x) = |<x|psi>|^2 gives the probability of measuring bitstring x.
A Bell state (H then CNOT) entangles two qubits so perfectly that measuring one instantly determines the other — Einstein famously called this "spooky action at a distance."
This is a gate-based quantum circuit simulator for up to three qubits. You place gates by selecting one from the palette and clicking a wire; the engine then multiplies the corresponding unitary matrices into an 8-dimensional complex state vector and immediately renders the measurement probabilities and amplitudes. Single-qubit gates (H, X, Y, Z, S, T) rotate one qubit, while the two-qubit CNOT and SWAP gates couple qubits to create entanglement, and ready-made presets build Bell, GHZ and a 2-qubit Grover circuit.
Quantum circuits are the standard model of quantum computation, the same framework behind Shor's factoring algorithm and Grover's search. By exploiting superposition and entanglement, quantum algorithms can solve certain problems faster than any known classical method, and this simulator lets you build and inspect the core building blocks used on real quantum hardware.
What is a qubit?
A qubit is the quantum analogue of a classical bit. Instead of being only 0 or 1, it can occupy any superposition α|0⟩ + β|1⟩ of the two basis states, where α and β are complex amplitudes. Measuring the qubit yields 0 or 1 with probabilities |α|² and |β|².
What does the Hadamard (H) gate do?
The Hadamard gate creates an equal superposition: applied to |0⟩ it produces (|0⟩ + |1⟩)/√2, so a measurement is then 50/50. It is the most common way to put a qubit into superposition and is the first gate in many quantum algorithms, including the Bell and GHZ states.
What is a CNOT gate and why does it create entanglement?
CNOT (controlled-NOT) flips a target qubit only when the control qubit is |1⟩. Applied to a control that is in superposition, it links the two qubits so their outcomes become correlated — producing entanglement, where measuring one qubit instantly tells you about the other.
A Bell state is a maximally entangled state of two qubits, built with a Hadamard followed by a CNOT. The result, (|00⟩ + |11⟩)/√2, means the two qubits always agree when measured even though each individual outcome is random — the canonical example of quantum entanglement.
They are all phase gates that leave |0⟩ unchanged but multiply |1⟩ by a phase: Z by −1 (a 180° rotation), S by i (90°), and T by e^(iπ/4) (45°). Combined with the Hadamard, the T gate makes the gate set universal for quantum computation.
The GHZ preset creates a three-qubit entangled state (|000⟩ + |111⟩)/√2 using a Hadamard and two CNOTs. All three qubits are perfectly correlated, and GHZ states are widely used to test the foundations of quantum mechanics and in quantum communication protocols.
The 2-qubit Grover preset demonstrates Grover's search algorithm. It places both qubits in superposition, uses an oracle to mark the target state |11⟩ with a phase flip, then a diffusion step amplifies that state so a measurement returns |11⟩ with high probability — a quadratic speed-up over brute-force search.
The probability bars show the chance of measuring each basis string (000 to 111). The state-vector panel lists the complex amplitude of each basis state as a magnitude and phase angle, giving the full quantum description that the probabilities alone cannot convey.
The state vector grows as 2ⁿ, so three qubits already need eight complex amplitudes. The exponential growth is exactly why simulating large quantum systems is hard for classical computers — and why useful quantum computers are valuable. Three qubits keep the visualisation clear and instant in the browser.
The gate model used here matches how superconducting and trapped-ion quantum computers are programmed. Real devices add noise, decoherence and limited gate sets, but the logical circuit you build — gates acting on qubits followed by measurement — is exactly the abstraction used in quantum software.