It is a classical simulator of the quantum state (educational, few qubits): with n qubits it handles 2ⁿ amplitudes. Measurement is probabilistic (seeded for reproducibility). Related: Base converter for the classical world of bits, and Logic gates.
It's a quantum circuit simulator for learning quantum computing by playing, with nothing to install and 100% in your browser. You build a circuit with gates and watch live the superposition, the entanglement and the measurement. It simulates up to 4 qubits by state vector: it stores the 2ⁿ amplitudes and manipulates them all at once. It's exact but educational (few qubits), not a real quantum computer.
1. Choose how many Qubits (from 1 to 4). They all start at |0⟩.
2. Pick the Target qubit the gate will act on (and the Control / Control 2 for multi-qubit gates).
3. Click a gate under «Add gate»: it's appended to the end of the circuit, which is drawn left to right.
4. On the right, the state, the Bloch spheres and, when you press Measure, the histogram are recomputed instantly.
5. Undo removes the last gate; Clear empties the circuit. Or load an example Demo.
A classical bit is 0 or 1. A qubit can be in a superposition of both at once, described by two amplitudes (complex numbers): one for |0⟩ and one for |1⟩.
• The probability of each outcome is the amplitude squared; they all add up to 100%.
• With n qubits there are 2ⁿ basis states (|00⟩, |01⟩, |10⟩, |11⟩…) and the simulator handles all 2ⁿ amplitudes at once.
• Convention of this simulator: qubit 0 is the leftmost one in each state |q0 q1 …⟩.
They act on the Target qubit. All are reversible (rotations of the state):
• H (Hadamard) — creates superposition: takes |0⟩ to half |0⟩ and half |1⟩ (50%/50%). It's the key gate to start almost anything.
• X (Pauli-X) — is the quantum NOT: swaps |0⟩↔|1⟩.
• Y (Pauli-Y) — flips the bit and adds a phase (half turn around the sphere's Y axis).
• Z (Pauli-Z) — leaves |0⟩ unchanged and flips the sign of |1⟩ (phase); on its own it doesn't change the probabilities.
• S — a quarter-turn phase: |1⟩ → i·|1⟩ (half of Z).
• T — an eighth-turn phase (half of S). Phases don't show in the bars, but they change the outcome when combined with H.
They need a Control qubit: they only act if the control is |1⟩.
• CNOT (control→target) — applies X (NOT) to the target when the control is 1. It's the gate that entangles.
• CZ — applies Z (phase flip) when the control is 1; it flips the sign of the |11⟩ state. It's symmetric (which qubit is the control doesn't matter).
• SWAP — exchanges the state of two qubits.
• Toffoli (CCX, appears with 3+ qubits) — X on the target only if its two controls are 1. It's a doubly controlled NOT and is enough to build any reversible classical logic.
Entangling two qubits leaves them correlated: their measurements are linked even when you separate them. The typical recipe: an H on one qubit and then a CNOT onto another (that's exactly the Bell demo).
• Visual cue: the Bloch sphere arrow shrinks toward the center — the qubit no longer has a state of its own and only exists as part of the whole.
• In Bell, measuring yields only 00 and 11, never 01 or 10: that's the quantum correlation.
When you measure, the superposition collapses to a single outcome (0 or 1 per qubit), at random and with probability = amplitude².
• The Measure (200 times) button simulates 200 shots and draws a histogram: you'll see the counts approach the state's probabilities.
• The randomness is seeded (reproducible): the same circuit gives the same histogram.
• Changing the circuit (adding or removing gates) clears the previous measurements.
Three readings of the state, on the right:
• State — one bar per outcome |…⟩ with its probability (%) and its amplitude (real part and, if any, imaginary as …i). States at 0% appear dimmed.
• Bloch sphere per qubit — each qubit's state as an arrow: up = |0⟩, down = |1⟩, sideways = superposition. If there is entanglement, the arrow shrinks.
• Measurement histogram — appears when you press Measure: real counts of each outcome across the 200 shots.
The Demo buttons load a ready-made circuit to explore:
• Superposition — an H on each qubit: every outcome becomes equally likely (25% each with 2 qubits).
• Bell — the minimal entangled state (H + CNOT): only 00 and 11.
• GHZ — a 3-qubit entangled state: only 000 and 111.
• Grover — a search algorithm that amplifies the |11⟩ state until it's almost certain. Load them, watch the state and press Measure.
It is a classical simulator of the quantum state (educational, few qubits): with n qubits it handles 2ⁿ amplitudes. Measurement is probabilistic (seeded for reproducibility). Related: Base converter for the classical world of bits, and Logic gates.