A quantum circuit is the quantum equivalent of a classical program. It's a sequence of operations (gates) applied to qubits, followed by measurement.
Unlike classical programs that manipulate bits deterministically, quantum circuits manipulate probability amplitudes to produce probabilistic outputs.
Circuit Anatomy
01
Wires (Qubits)
Horizontal lines are qubits. Time flows left to right. Each wire starts in state |0⟩.
02
Gates
Boxes on the wires are operations. Every gate is reversible, you can always undo it.
03
Measurement
The meter at the end collapses the quantum state to classical bits. This is how we extract a result.
Try It: Build Your Own Circuit
Drag gates from the palette onto the qubit wires to build a circuit. Watch how the output state changes as you add gates.
Circuit Builder
GATES
Single Qubit
H
Hadam.
HHadamard
Creates superposition - puts qubit in both |0⟩ and |1⟩ simultaneously
|0⟩ → |0⟩+|1⟩ (50/50)
X
Pauli-X
XPauli-X
Quantum NOT gate - flips the qubit state
|0⟩ → |1⟩, |1⟩ → |0⟩
Y
Pauli-Y
YPauli-Y
Combines bit flip and phase flip
|0⟩ → i|1⟩, |1⟩ → -i|0⟩
Z
Pauli-Z
ZPauli-Z
Phase flip - adds negative phase to |1⟩ (invisible until measured through H)
|0⟩ → |0⟩, |1⟩ → -|1⟩
S
S Gate
SS Gate
Quarter turn around Z-axis (90° phase)
|1⟩ → i|1⟩
T
T Gate
TT Gate
Eighth turn around Z-axis (45° phase) - key for universal quantum computing
|1⟩ → e^(iπ/4)|1⟩
Two Qubit
⊕
C-NOT
⊕CNOT
Controlled-NOT: flips target qubit only if control qubit is |1⟩
|10⟩ → |11⟩, |00⟩ → |00⟩
×
SWAP
×SWAP
Exchanges the states of two qubits
|01⟩ → |10⟩
Drag gates onto the circuit wires
Step Start / -
Speed:
Space Play/Pause← → StepR Reset
OUTPUT STATE
Definite state |00⟩
State
Phase
Probability
%
Angle
Amplitude
|00⟩
Phase: 0°
100.0%
0°
1.00
Normal (0° phase)
Phase shifted
0° = right90° = up180° = left
Drag gates onto wiresClick gate + Delete to removeCNOT/SWAP connect to next qubit
Beyond the Basics: More Gates
Real quantum frameworks like Qiskit offer many more.
Rx(θ)
X-Rotation
Rotates qubit around X-axis by any angle θ. Generalizes the X gate.
Ry(θ)
Y-Rotation
Rotates around Y-axis. Creates superposition with controllable amplitudes.
Rz(θ)
Z-Rotation
Rotates around Z-axis by any angle. Generalizes Z, S, and T gates.
CZ
Controlled-Z
Applies Z to target when control is |1⟩. Symmetric, both qubits act as control.
CCX
Toffoli
3-qubit gate. Flips target only when BOTH controls are |1⟩. Universal for classical computing.
S†, T†
Inverse Gates
Reverse the S and T gates. S† = -90° phase, T† = -45° phase.
U(θ,φ,λ)
Universal Gate
Any single-qubit operation with 3 parameters. All other single-qubit gates are special cases.
iSWAP
iSWAP
Swaps qubits and adds phase. Native to some superconducting hardware.
The gates in the Circuit Builder (H, X, Y, Z, S, T, CNOT, SWAP) form a universal gate set, you can build any quantum algorithm with them.
Multiple Shots Simulation
Watch how running many shots reveals the true probability distribution!
|0⟩
H
→ 50/50 expected
?
Shot 0 / 100
0
|0⟩ (0%)
0
|1⟩ (0%)
💡 More shots = more accurate probability estimate. Real quantum computers use 1000+ shots!
The Simulation Workflow
01
Build
Define qubits and gates using Qiskit.
02
Transpile
Convert the circuit to executable form for the backend.
03
Run
Execute on the simulator. Many shots, not one.
04
Analyze
Count outcomes to estimate the probability distribution.
Key Insight
Because quantum measurement is probabilistic, we run the same circuit many times (e.g., 1,000 shots) and count the results. The histogram approximates the true probability distribution.