Bloch sphere simulator
This interactive demo needs JavaScript.
What it does
This free simulator shows one qubit as a point on the Bloch sphere. Apply quantum gates (X, Y, Z, H, S, T and rotations by any angle), drag the sphere to look at it from any side, and see the qubit's amplitudes, measurement probabilities and Bloch coordinates update as it moves. Every sequence of gates gets its own link, so you can share exactly what you see. It runs in your browser, works on a phone, and needs no sign-up.
Learn quantum computing step by step, in the free Q-Learn app. Get it on Google PlayGet Q-Learn
How to use it
- Apply a gate with the buttons. The point turns to its new position, and the gate is added to the circuit underneath.
- Rotate by any angle with Rx, Ry and Rz. Set the angle with the slider first.
- Set a state directly with the θ and φ sliders, which are the point's latitude and longitude on the sphere.
- Measure to see quantum measurement in action: the qubit jumps to |0⟩ or |1⟩ with the probabilities shown, and the superposition is gone.
- Drag the sphere to look at it from another side. Undo takes back the last gate, and Reset returns to |0⟩.
- Copy link gives you a link that rebuilds the same sequence of gates, for a lesson, a slide or a homework question.
What the numbers mean
- State: the qubit as α|0⟩ + β|1⟩. The simulator removes the overall phase, which no measurement can detect, so α is always a real number of 0 or more.
- Probabilities: the chance of reading 0 is |α|² and of reading 1 is |β|².
- θ and φ: the point's position. θ runs from 0 at the north pole (|0⟩) to 180° at the south pole (|1⟩); φ is the angle around the equator, the relative phase between |0⟩ and |1⟩.
- x, y, z: the same point as coordinates. z = |α|² − |β|², so z alone fixes the probabilities. x and y hold the phase, which measurement in the |0⟩/|1⟩ basis cannot see but later gates can.
If any of this is new, start with what is the Bloch sphere? and what is a qubit?
Things to try
- H, then H. The first Hadamard takes |0⟩ to the equator; the second brings it straight back. That is interference, explained in the Hadamard gate.
- H, Z, H. The result is the south pole, |1⟩: exactly what an X gate does. Sandwiching Z between two Hadamards turns it into X.
- H, then T four times. Each T is an eighth of a turn around the vertical axis, so four of them carry the point halfway round the equator, from |+⟩ to |−⟩. That is the same as one Z.
- Ry at 90°, then measure several times. Reset and repeat: about half your measurements give 0 and half give 1.
- Set θ to 60°. The probability of 0 is cos²(30°) = 75%. Moving the point around the equator with Rz changes the phase but never the probabilities.
How it works
The simulator keeps the qubit as two complex numbers, α and β, and applies each gate as a 2 × 2 matrix, exactly as a quantum computer's mathematics describes it. The point on the sphere is computed from them: x = 2·Re(αβ), y = 2·Im(αβ), z = |α|² − |β|². When you press a gate, the point moves along the rotation that gate performs, so you see the path as well as the result. Nothing is sent to a server; everything runs on your device.
It shows a single qubit only. Two or more qubits can be entangled, and an entangled qubit has no point of its own on the sphere, which is explained in what is quantum entanglement?
Frequently asked questions
Is this Bloch sphere simulator free?
Yes. It is free to use, with no account, no ads and no download. You can link to it from course pages and slides, and use screenshots under CC BY 4.0 with a credit to Q-Learn.
Can it simulate two qubits?
No. The Bloch sphere can only show one qubit. For multi-qubit circuits, the Q-Learn app's circuit lessons and a framework such as Qiskit are the next step.
Why does the angle on the sphere look twice as big as in the formula?
Because the state is cos(θ/2)|0⟩ + e^(iφ) sin(θ/2)|1⟩. |0⟩ and |1⟩ are opposite points on the sphere, 180° apart, even though they are at right angles as vectors, so every angle on the sphere is twice the angle in the state.