Home / Science / Physics / Quantum mechanics / Quantum circuit simulatorTool #927

Quantum circuit simulator: state vector up to 20 qubits, OpenQASM 2.0 import and export

Write or open an OpenQASM 2.0 program, or build a circuit gate by gate, and simulate it exactly in your browser for up to 20 qubits: circuit diagram, outcome probabilities and simulated shot counts, each qubit's Bloch vector, the full state vector, and the circuit saved back as OpenQASM 2.0.

Keep it one tap away for everyday use.

Bookmark Quantum circuit simulator?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. QASM
  2. Simulate
  3. Outcomes
  4. Export
Nothing is uploadedWorks offline once open

Circuit (OpenQASM 2.0)

Paste or type OpenQASM 2.0: qreg, creg, the qelib1.inc gates (h, x, y, z, s, sdg, t, tdg, sx, rx, ry, rz, u1, u2, u3, p, cx, cy, cz, ch, swap, crx, cry, crz, cu1, cp, cu3, rzz, rxx, ccx, cswap), your own gate definitions, barrier and measure. Up to 20 qubits; files up to 1 MB. Measurements are taken at the end, so reset, if and gates after a measurement are not supported. Qubit q[0] is the rightmost bit of each outcome, as in Qiskit.

Add a gate

Results

Outcomes

Each qubit on its own

The Bloch vector of a qubit traced out of the full state. Length 1 means the qubit is in a pure state of its own; shorter means it is entangled with the others.

State vector

Download

What it does

A quantum computer’s state for n qubits is a list of 2ⁿ complex numbers, the amplitudes of every basis state from |00…0⟩ to |11…1⟩. Each gate mixes them, and measuring at the end picks one basis state with probability |amplitude|². This simulator keeps the whole list and applies each gate exactly, so for up to 20 qubits (about a million amplitudes) it gives the exact answer a perfect, noise-free quantum computer would.

Circuits are written in OpenQASM 2.0, the plain-text format that Qiskit and many other tools read and write, so you can paste a circuit from elsewhere, check it here and save it again. You can also build one with the gate picker.

How to use it

  1. Edit the program, open a .qasm file, or start from the example or an empty circuit.
  2. To add a gate without typing, pick it, give its angle (pi/2, 0.3, 2*pi/3 …) and its qubit numbers, and press Add gate. Gates go in before any measurements. Measure all adds a measurement of every qubit.
  3. Set the number of shots: the simulated repeat runs, for counts like those from real hardware. The random draws repeat exactly for the same circuit.
  4. Read the results and download the outcomes, the state vector (up to 16 qubits) or the circuit as OpenQASM 2.0. The saved file has one register q and one c, and any gates you defined yourself are written out in full.

What the results mean

  • Outcomes: the exact probability of each result, as a string of classical bits c[n−1] … c[0] (or of all qubits if nothing is measured), and the counts from the simulated shots.
  • Each qubit on its own: the qubit’s Bloch vector after tracing out the rest. A length of 1 means a pure state; a length below 1 means the qubit is entangled with others (0 for a maximally entangled one).
  • State vector: the non-zero amplitudes, largest first, with probability and phase.

Bit order follows Qiskit: q[0] is the rightmost bit. So after x q[0]; on three qubits the outcome is 001.

Worked example

The example makes a three-qubit GHZ state: H on q[0], then CNOTs from q[0] to q[1] and q[1] to q[2], then an rz(π/4) on q[2], and measures everything. The page shows 3 qubits, 4 gates: 2 possible outcomes: 000 and 111, each with probability 0.5, and roughly 512 counts each out of 1,024 shots. Every qubit’s Bloch vector has length 0, the signature of full entanglement. The state vector shows the rz as a phase: |000⟩ with phase −22.5° and |111⟩ with +22.5°, 45° apart, which no measurement in the computational basis can see.

FAQ

Why only 20 qubits? Each extra qubit doubles the memory and time. 20 qubits is about a million amplitudes, which a phone handles in a moment; 30 would need gigabytes.

Does it model noise? No. It is an ideal simulator, for study and planning rather than a substitute for professional judgement or real hardware results.

Is my circuit uploaded? No. Everything runs in your browser and the circuit never leaves your device.

Where the numbers come from

  • OpenQASM 2.0 language and the qelib1.inc gate definitions: Cross, A. W., Bishop, L. S., Smolin, J. A. and Gambetta, J. M. (2017), Open Quantum Assembly Language, arXiv:1707.03429 (the specification; no code from it is used).
  • State-vector simulation and gate matrices: standard textbook results, for example Nielsen, M. A. and Chuang, I. L., Quantum Computation and Quantum Information.
  • Checked against an independent NumPy simulator built from Kronecker products and scipy.linalg.expm, written for the tests.
  • The example circuit is made up.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Related tools

Hydrogen orbital viewer #925 See any hydrogen-like orbital up to n = 7, real (pₓ, d_z², f_xyz ...) or complex: a slice of ψ coloured by sign, a turnable cloud of dots drawn from |ψ|², and the radial function and radial probability, with the energy, mean and most probable radius, nodes and the radius holding 90 % of the electron. Spin and Bloch sphere #926 Start a spin-½ or qubit in any state, apply H, X, Y, Z, S, T and rotations about any axis, and watch its path on a turnable Bloch sphere with the final amplitudes and probabilities. Drive it with a Rabi frequency and detuning, add T1 and T2 relaxation, and see the oscillation, the π-pulse length and the steady state. Perturbation theory checker #928 Type or paste a Hamiltonian H₀ and a perturbation V as matrices (real or complex, up to 40 × 40), choose λ, and get every level's first, second and third order corrections, degenerate levels included, side by side with the exact eigenvalues of H₀ + λV, a convergence warning and a plot of the exact levels against the second-order curves. Operator algebra helper #929 Work with quantum operators as matrices: Pauli matrices, spin-j angular momentum (Jx, Jy, Jz, J±, J²) up to j = 5, two spin-½ particles, and the truncated harmonic oscillator (a, a†, n, x, p). Type any expression with products, powers, commutators, anticommutators and daggers, and get the matrix, whether it is Hermitian or unitary, its eigenvalues, trace and determinant, and a check against what you expect. 1D Schrödinger solver #923 Choose a textbook potential, type a formula or draw your own, and get the lowest energy levels and wavefunctions of the one-dimensional Schrödinger equation by the matrix (finite-difference) method, with the exact levels alongside for the box, harmonic oscillator, finite well, Morse, linear and Pöschl–Teller potentials. Wave packet tunnelling #924 Send a Gaussian wave packet at a rectangular barrier, double barrier, step, well or smooth barrier and watch it split into reflected and transmitted parts. The time evolution runs in your browser by the split-step Fourier method, and the reflection and transmission it finds are compared with the exact stationary transmission averaged over the packet's energies.