Amplitudes, not bits
The output column lists complex amplitudes (a + bi)|ket⟩. Probabilities are |a + bi|² and always sum to 1.
Pick qubits, add gates, and watch how each computational basis state flows through the circuit. Great for quick intuition checks, homework, or teaching the “why” behind a Bell state.
Controls are filled dots; targets are colored boxes. Qubit 0 is the top wire.
| Input basis |b⟩ | Output state ψ | Probabilities |ψ|² (top terms) |
|---|
The output column lists complex amplitudes (a + bi)|ket⟩. Probabilities are |a + bi|² and always sum to 1.
H on |0⟩ makes (|0⟩ + |1⟩)/√2. Add CNOT and you see a Bell state: |00⟩ + |11⟩ over √2.
Z, S, and T don’t change probabilities—only phases. The rightmost column still shows the same magnitudes.
Qubit 0 is the top wire. A CNOT with control=0, target=1 flips the second qubit only when the first is 1.
H on qubit 0 then CNOT(0→1) and CNOT(0→2) yields (|000⟩ + |111⟩)/√2—one of the simplest GHZ states.
The generator applies ideal unitary gates to basis states and prints the resulting state vectors. It is great for sanity-checking small circuits, classroom demos, or exploring how phases flow. It does not model noise, measurement collapse inside the circuit, or qubit connectivity constraints.
Gates include the Pauli set, Hadamard, S/T phase gates, controlled-NOT and controlled-Z, plus SWAP. More controls, parameterized rotations, or mid-circuit measurement would need a fuller simulator—but the essentials here already cover most introductory quantum computing coursework.
A short, visual truth table is one of the fastest ways to demystify quantum computing. Students often see Dirac notation in textbooks and wonder how gates actually “move” amplitudes. By letting you place a Hadamard, then a CNOT, and immediately reading the output state for each basis input, this tool bridges abstract bras and kets with concrete outcomes. You can show in seconds that a Hadamard alone creates superposition, but adding a CNOT on the neighboring wire produces a Bell state that is entangled and no longer separable into single-qubit factors. That aha-moment is powerful for learners who are new to the difference between classical randomness and quantum amplitudes.
The table also surfaces relative phase—an aspect that gets lost in classical truth tables. By toggling Z, S, or T gates you will notice that the probability column sometimes does not change even though the state column does. That directly illustrates why quantum algorithms rely on interference: phases matter only when amplitudes recombine. A teacher can point out that Z on a single Hadamard state leaves measurement probabilities intact, but a second Hadamard reveals the phase flip as destructive interference, turning |0⟩ into |1⟩. This is the core of phase kickback and is visible here without any heavy math.
For multi-qubit intuition, presets like Bell and GHZ reveal two foundational patterns: controlled gates propagate information nonlocally, and entanglement correlates measurement outcomes no matter which computational basis vector you start from. The probability summaries show that the weight is concentrated only on correlated terms (|00⟩ + |11⟩ for Bell, |000⟩ + |111⟩ for GHZ), while intermediate amplitudes vanish. Students can vary the control/target order to see how a misplaced control ruins the correlation, reinforcing careful circuit design.
Instructors can also contrast SWAP with CNOT/CZ to explain connectivity and routing. SWAP merely exchanges labels of wires, so the truth table shows basis states permuting without phase changes, whereas CNOT introduces conditional flips that change the distribution of amplitudes. By chaining multiple gates, you can illustrate simple error-correction motifs (e.g., creating three-qubit repetition codes with CNOTs) or basic interference gadgets such as H–Z–H to expose phase kickback. Each scenario is instantly reflected in the state and probability columns, making it a lightweight yet effective lab companion for homework, workshops, or flipped-classroom exercises.
Finally, because everything runs in the browser and updates live, learners are encouraged to experiment: swap control and target, add an extra phase gate, or drop the qubit count to one to see how single-qubit logic differs from controlled multi-qubit gates. That playful iteration turns this generator into a low-friction sandbox that reinforces linear algebra concepts—unitary matrices, basis changes, and superposition—without requiring a full simulator or cloud hardware. It is intentionally limited to 1–3 qubits to keep the table readable, but the core ideas it conveys scale directly to larger systems used in real quantum processors.