โš› Circuit Sandbox
Qubits
2
Moments
4
Section 01
Circuit Builder
Gate palette โ€” drag a gate onto the circuit below
Section 02
Results
Theory โ€” exact probabilities (Born rule)
Measure โ€” simulate wavefunction collapse
No shots yet.
Total shots: 0
Section 03
Preset Circuits
Single qubit
Two qubits
Three qubits
Section 04
How to Use the Circuit Editor

The circuit editor is powered by Q.js, a free open-source quantum circuit simulator by Stewart Smith. Each horizontal wire is one qubit starting in |0โŸฉ. Each column is one moment (a clock tick). Below is everything you need to build and analyze any circuit.

1
Place a single gate. Drag any gate from the Gate Palette (the blue strip above the circuit) and drop it onto any cell. Each cell is a register (row) ร— moment (column) combination. The circuit re-evaluates automatically after every change.
Palette: [ H ] [ X ] [ Y ] [ Z ] [ S ] [ T ] [ * ] [ M ] โ€ฆ r1 โ”€โ”€โ”€โ”€ [ H ] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ r2 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ m1 m2 m3 m4
To remove a gate, drag it off the circuit board into empty space outside the grid and release โ€” it disappears with a brief animation.
2
Create a CNOT (controlled-X) gate. A CNOT links two qubits: a control (filled dot) and a target (โŠ•). In Q.js you build it by first placing the two components and then joining them:
  1. Drag the โ— Identity cursor (* in the palette) onto the control qubit at the desired moment.
  2. Drag an X gate onto the target qubit at the same moment.
  3. Click the โ— cursor cell to select it, then Shift-click the X cell to add it to the selection.
  4. Click the C button in the circuit's own toolbar (the dark bar above the wire labels). The two operations merge into a single CNOT gate connected by a vertical line.
Step A โ€” place * on r1,m2 and X on r2,m2: r1 โ”€โ”€โ”€ [ H ] โ”€โ”€โ”€ [ * ] โ”€โ”€โ”€ r2 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ [ X ] โ”€โ”€โ”€ Step B โ€” select both โ†’ click C: r1 โ”€โ”€โ”€ [ H ] โ”€โ”€โ”€ [ โ— ] โ”€โ”€โ”€ โ† control dot โ”‚ r2 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ [ โŠ• ] โ”€โ”€โ”€ โ† target (X gate)
Try it now: this is the Bell state circuit. H on r1 at m1, then CNOT (control r1, target r2) at m2. Click โ–ถ Evaluate โ€” you get 50% |00โŸฉ and 50% |11โŸฉ, a maximally entangled state. Then click โš„ ร—100 and watch the measured histogram converge to the theory bars.
3
Create a SWAP gate. Place the โ— Identity cursor (*) on both wires at the same moment. Select both cells, then click the S button in the toolbar. The two cursors become a SWAP gate (shown as โœ• on each wire with a connecting line).
Place * on both wires at the same moment โ†’ select both โ†’ click S: r1 โ”€โ”€โ”€ [ * ] โ”€โ”€โ”€ โ†’ r1 โ”€โ”€โ”€ [ โœ• ] โ”€โ”€โ”€ r2 โ”€โ”€โ”€ [ * ] โ”€โ”€โ”€ โ”‚ r2 โ”€โ”€โ”€ [ โœ• ] โ”€โ”€โ”€
4
Select, move and delete.
  • Move a gate: drag it to a new cell โ€” it snaps to the grid.
  • Select a column: click the moment number at the top of the circuit.
  • Select a row: click the register number on the left.
  • Select all: click the โ†˜ icon in the top-left corner of the circuit.
  • Undo / Redo: use the โŸฒ / โŸณ buttons in the circuit toolbar.
  • Delete a gate: drag it outside the circuit board area and drop.
The circuit toolbar also has a ๐Ÿ”“ lock toggle. When locked, no gates can be moved or added โ€” handy when you want to measure without accidentally editing the circuit.
5
Reading the Theory panel. After clicking โ–ถ Evaluate (or after any gate change), the Theory panel shows:
  • Probability bars โ€” the exact Born-rule probability |ฮฑ|ยฒ for each basis state.
  • Amplitude table โ€” the full complex amplitude re + imยทj for each state. The probability is |re|ยฒ + |im|ยฒ.
  • Bloch sphere โ€” for single-qubit circuits, the state vector on the Bloch sphere.
The Theory panel shows the quantum state before any measurement โ€” a superposition of all outcomes simultaneously. No single run of the circuit produces all these numbers at once; they describe the distribution of outcomes over many runs.
6
Reading the Measure panel. Each click on โš„ ร—1 simulates a single wavefunction collapse โ€” a random draw weighted by the Born probabilities. โš„ ร—100 and ร—1000 accumulate many shots rapidly. The histogram shows two bars per state:
  • Outlined bar (theory) โ€” what quantum mechanics predicts.
  • Solid bar (measured) โ€” what your simulated shots have produced.
As you add more shots, the solid bars converge onto the outlined ones โ€” this is the law of large numbers applied to quantum probability. A "โ‰ˆ converging โœ“" note appears once they match within 5%.
Quantum randomness is fundamental, not due to ignorance. Even with a perfect circuit and perfect detector, the outcome of a single measurement on a superposed qubit is genuinely unpredictable. The Born rule only tells you the probability distribution.