Home / Science / Physics / Quantum mechanics / Spin and Bloch sphereTool #926

Bloch sphere: apply qubit gates and rotations, and simulate Rabi oscillations with T1 and T2

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.

Keep it one tap away for everyday use.

Bookmark Spin and Bloch sphere?

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

  1. Start
  2. Gates
  3. Sphere
  4. Rabi
Nothing is uploadedWorks offline once open

Gates and rotations

Gates: H, X, Y, Z, S, S†, T, T†, √X, Rx(θ), Ry(θ), Rz(θ) and R(θ, x, y, z) about any axis. Angles are in degrees, or in radians when you write pi (Rx(pi/2)). Every single-qubit gate is a rotation of the Bloch sphere; a global phase does not show on the sphere and is left out.

Rabi oscillations

The qubit starts in |0⟩ and is driven at Rabi frequency Ω, detuned by Δ from resonance (rotating frame). T1 is the energy relaxation time back to |0⟩, T2 the dephasing time; physically T2 ≤ 2T1. MHz and µs go together; any matching pair works (GHz and ns, kHz and ms). Example values are made up.

View

Download

What it does

Any state of a spin-½ particle, or of a qubit, can be written as cos(θ/2)|0⟩ + e^{iφ} sin(θ/2)|1⟩, a point on a sphere: the Bloch sphere. |0⟩ (spin up) is the north pole, |1⟩ the south pole, and equal superpositions sit on the equator. Every operation on a single qubit is a rotation of this sphere, which makes it the clearest picture of what gates and magnetic resonance do.

The tool has two parts:

  • Gates and rotations. Pick a start state and type or tap a list of gates. The tool applies them one after another, draws the path the state takes on the sphere, and gives the final amplitudes, Bloch vector, angles and the measurement probabilities along z, x and y, with a table of every step.
  • Rabi oscillations. A qubit driven by an oscillating field at Rabi frequency Ω, detuned by Δ, swings between |0⟩ and |1⟩. The tool solves the Bloch equations in the rotating frame, with optional T1 (energy relaxation) and T2 (dephasing), and plots the probability of |1⟩ against time, alongside the path on the sphere.

How to use it

  1. Choose the start state: one of the six poles of the sphere, or any angles θ and φ.
  2. Type gates separated by semicolons, or tap the gate buttons. Angles are in degrees (Rx(90)) or radians if you write pi (Rx(pi/2)). R(θ, x, y, z) rotates by θ about any axis.
  3. For Rabi oscillations, set Ω/2π and Δ/2π in MHz and the drive time in µs. Leave T1 and T2 blank for a perfect qubit; with only T1 given, T2 is taken as 2 × T1, its largest possible value.
  4. Turn and tilt the spheres with the sliders, and download the results.

Worked example

The page opens with |0⟩ and the gates H; T; Rx(90). H takes the north pole to |+⟩ on the equator; T turns it 45° round the z axis; Rx(90) tips it up towards the north. The result is 0.9239 |0⟩ + (0.3827) |1⟩, Bloch vector (0.7071, 0, 0.7071), θ = 45°: a 85.36 % chance of measuring 0.

In the Rabi part, Ω/2π = 1 MHz and Δ/2π = 0.5 MHz. The π-pulse on resonance would be 0.5 µs, but the detuning raises the oscillation to 1.118 MHz and caps the largest P(1) at 0.8. After 3 µs, P(1) = 0.6434. Type T1 = 2 and T2 = 1.5 and the oscillation dies away towards the steady state 0.4181.

Tips

  • Gates that differ only by a global phase (Z and Rz(180), for example) give the same point on the sphere; the amplitudes are shown with the |0⟩ part made real and positive.
  • With T2 shorter than T1 the path spirals inwards, off the surface: the state becomes mixed.
  • The units only need to match: GHz with ns works as well as MHz with µs.

FAQ

Why is H a rotation about the diagonal? H swaps the z and x axes, which is a half-turn about the axis halfway between them.

Can this design a real pulse? It is for study and planning, not a substitute for professional judgement on real hardware, where pulse shapes, leakage and noise matter.

Does anything get uploaded? No. Everything runs in your browser.

Where the numbers come from

  • Bloch sphere representation, single-qubit gates as SU(2) rotations, the Rabi formula and the optical Bloch equations with T1 and T2 (Torrey steady state): standard textbook results, for example Nielsen, M. A. and Chuang, I. L., Quantum Computation and Quantum Information, and Allen, L. and Eberly, J. H., Optical Resonance and Two-Level Atoms.
  • Checked against NumPy/SciPy (scipy.linalg.expm of the Pauli matrices and scipy.integrate.solve_ivp of the Bloch equations) written for the tests.
  • All example numbers are 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

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. 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. Quantum circuit simulator #927 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. 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. Publication plot maker #27 Paste columns or open a CSV or Excel file and get a clean scientific figure with error bars, sized for a journal column. Download vector SVG or PDF, or PNG at 300 or 600 dpi. Your data stays in your browser. 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.