Quantum Computer Simulator: Build Quantum Circuits Online
A free quantum computer simulator in your browser: drag gates (H, X, Y, Z, S, T, Rx, Ry, Rz, CNOT, CZ, swap, Toffoli, measure) onto up to 10 qubits, watch the state vector and the Bloch sphere step by step, run measurement shots, load Bell, GHZ, teleportation, Deutsch-Jozsa, Grover, QFT and Shor examples, and import or export OpenQASM.
Drag a gate onto a wire, or click a gate and then click a spot. Click a gate in the circuit to change or delete it; drag it off the circuit to remove it.
State vector
Show as a table
Bloch sphere
Measurement shots
Example circuits
OpenQASM 2.0
Export the circuit to run it in Qiskit, Cirq or on IBM Quantum, or paste OpenQASM 2 code to load it here (qelib1 gates: h, x, y, z, s, sdg, t, tdg, sx, rx, ry, rz, u1/p, u2, u3, cx, cy, cz, ch, crx, cry, crz, cu1, ccx, swap, cswap, measure).
What is a quantum computer?
An ordinary computer stores information in bits that are either 0 or 1. A quantum computer uses qubits. A qubit can be 0, 1, or a superposition of both: a pair of complex numbers, the amplitudes α and β, with \(|\alpha|^2 + |\beta|^2 = 1\). When you measure it you get 0 with probability \(|\alpha|^2\) and 1 with probability \(|\beta|^2\), and the superposition is gone. Two qubits need four amplitudes, three need eight: n qubits are described by 2ⁿ complex numbers. That exponential growth is where the power of a quantum computer comes from, and it is also why this simulator stops at 10 qubits (1,024 amplitudes) and why simulating 50 or more qubits overwhelms the biggest supercomputers.
How to use this quantum circuit simulator
- Build a circuit: drag gates from the palette onto the wires. Each wire is one qubit and starts in |0⟩; time runs from left to right. Two-qubit gates (CNOT, CZ, swap) land on the wire you drop them on and the one below; click the gate to move its control or target to any other wire.
- Add a control: drop the ● on another wire in the same column as a gate to make it controlled: a controlled Rz, a controlled swap (Fredkin), a doubly controlled Z...
- Read the state: every basis state has a bar. Its height is the size of the amplitude, its colour the phase (red = 0°, yellow-green = 90°, cyan = 180°, purple = 270°). The numbers at the end of each wire give the chance that the qubit reads 1.
- Step through: use ◀ ▶ or the slider to see the state after each column, or press Play. The dashed line in the circuit shows where you are.
- Bloch sphere: pick a qubit to see its state as an arrow on the sphere: up = |0⟩, down = |1⟩, the equator = equal superpositions with different phases. Drag the sphere to turn it. A qubit that is entangled with others has no pure state of its own, so its arrow gets shorter; for a Bell pair it shrinks to the centre.
- Measure: the M gate marks qubits to read out. "Run shots" repeats the circuit many times and counts the answers, as a real quantum computer would: the bars approach the probabilities but never match them exactly. A measurement in the middle of a circuit collapses the state, so the shots are then simulated one by one.
- Share and export: "Share link" copies a link that holds the whole circuit. The OpenQASM box exports code for Qiskit, Cirq or IBM Quantum and loads code from them.
The example circuits
- Bell state and GHZ: entanglement. The qubits are random one by one but always agree with each other.
- Teleportation: moves the state of one qubit onto another using a shared Bell pair, without sending the qubit itself. The classical corrections are replaced by controlled gates (deferred measurement).
- Superdense coding: the reverse trick: two classical bits in one transmitted qubit.
- Deutsch–Jozsa and Bernstein–Vazirani: the first algorithms with a proven quantum advantage: one query to an oracle answers what a classical computer needs many queries for.
- Grover search: finds a marked item among N in about √N steps instead of N/2. That square-root speed-up is why 128-bit keys are considered weak against quantum computers while 256-bit keys are fine.
- Quantum Fourier transform: the building block of phase estimation and Shor's algorithm. The simulator's tests check it against the discrete Fourier transform for up to 5 qubits.
- Shor's algorithm: factors a number by finding the period of aˣ mod N. The demo finds the period 4 of 7ˣ mod 15 with 7 qubits; from it, gcd(7² − 1, 15) = 3 and gcd(7² + 1, 15) = 5. Breaking RSA-2048 this way would need thousands of error-corrected logical qubits, far beyond today's machines: see Quantum Cryptography.
Questions people ask
- Is this a real quantum computer?
- No. It is a state-vector simulator: your browser stores all 2ⁿ amplitudes and multiplies them by each gate's matrix, exactly and without noise. That is how quantum programs are tested before they run on real hardware. Real machines add noise, limited connections between qubits and errors that grow with circuit depth.
- Why only 10 qubits?
- Each extra qubit doubles the memory and the work. 10 qubits = 1,024 amplitudes, instant in a browser and still readable as bars. 30 qubits would need about 16 GB, 50 qubits about 16 petabytes.
- Which qubit is which in |q₂q₁q₀⟩?
- Qubit 0 is the rightmost (lowest) bit, the convention of Qiskit and IBM Quantum. So with three qubits, |100⟩ means q2 = 1 and the others 0, and it is basis state number 4.
- What is the difference between amplitude and probability?
- The amplitude is a complex number with a size and a phase; the probability is its size squared. Phases do not change the probabilities directly, but they decide how amplitudes add up or cancel when later gates mix them: that interference is what quantum algorithms use.
- What does entangled mean on the Bloch sphere?
- The Bloch sphere shows one qubit. If the qubits are entangled, no single-qubit state describes it, so the simulator shows its reduced density matrix: the arrow has length r < 1 and the state is mixed. Length 0 means fully entangled: alone, it is a perfect coin.
- What are S, T and the rotation gates?
- S and T add a phase of 90° and 45° to |1⟩ (turns about the z axis). Rx, Ry and Rz turn the Bloch arrow by any angle about an axis; type the angle as pi/4, 3π/8 or 0.5 (radians). P(φ) adds the phase φ to |1⟩; controlled P is used in the QFT.
- Does it work offline and is anything uploaded?
- Everything runs on your device. The circuit is kept in your browser so it is still there next time; nothing is sent anywhere unless you share the link yourself.
More from MES: MES Quantum Lab (tunnelling, double slit, entanglement, the hydrogen atom) · Quantum Cryptography (BB84, Shor, Grover, post-quantum keys) · Is a website quantum-safe? · Cryptography Lab · Matrix Calculator · Prime Numbers · All MES tools
