BB84 Quantum Key Lab
The Quantum Turtle · Quantum Play Lab
Make a secret key with BB84.
Play Alice and Bob to discover quantum key distribution. Pick measurement bases, compare results, and see what happens when Eve listens in.
Play together · Real-time classroom experiment
NEW · LIVE ROOMSAlice and Bob, on two screens
Create a room, send Bob the link, and measure one qubit at a time. Both screens update automatically. No Zoom-chat copying or account needed.
Alice · Create a room
Prepare private random qubits and invite another person.
Bob · Join a room
You can paste the entire link. Opening it also fills in the room code.
Alice · Your room is ready
Share this link with Bob:
0 / 16 measurements
Your bit and basis choices stay in this tab until the final reveal. Keep it open while Bob measures. Anyone with the room link can observe classroom messages; this is not secure QKD.
Bob · Measure qubit 1 of 16
Your basis choices determine what you can learn. Alice's preparation remains hidden until the end.
Waiting for Alice.
0 / 16 measured
Compare the results
·
Sifted bits (not a secure key)
This idealized lesson reveals all bits to teach the protocol. Real QKD needs an authenticated classical channel, real quantum transmission, sampling, error correction and privacy amplification.
Live rooms use Supabase Realtime public broadcasts. Room links are hard to guess but are not authentication. Don't use this exercise for secrets or real keys. If live connections fail, use the solo or Zoom-chat exercise below.
A qubit can carry a 0 or a 1 in two different bases
Meet the four BB84 states
Blue states use the + basis. Orange states use the × basis. Alice picks one. Bob chooses which basis to measure.
What do the arrows mean?
The arrows are a simple state map, not the path a photon travels. On a Bloch sphere, |0⟩ and |1⟩ point in opposite directions along Z. |+⟩ and |−⟩ point in opposite directions along X.
Step 1 · Choose how to play
On Zoom, Alice and Bob exchange three short messages in chat. Bob chooses all his bases before Alice reveals her choices. This is an educational role-play, not real quantum communication or a secure key exchange.
Step 2 · Alice prepares qubits
Send 16 qubits
Each qubit has a private bit (0 or 1) and a random basis: + or ×. Bob will choose his bases before Alice reveals them.
Eve picks a random basis to measure each qubit, then sends a replacement to Bob. We can spot her by comparing errors.
Alice's private preparation
Bob will choose his bases without seeing the private table.
When Bob replies
Message 3 of 3 · Send results to Bob
Bob can now check the bases, results, and error rate.
Why does this work?
In the + basis, bit 0 is |0⟩ and bit 1 is |1⟩. In the × basis, bit 0 is |+⟩ and bit 1 is |−⟩.
In the ideal model, measuring in the preparation basis always gives the encoded bit. The other basis gives either bit with equal chance. An eavesdropper can disturb states by measuring and resending them.
This browser exercise uses classical messages to coordinate an idealized simulation. It cannot transmit real qubits. Because Alice computes the simulated outcomes after Bob shares his bases, it requires honest participants and cannot enforce quantum security.
With an ideal intercept-resend attack, Eve causes an average error rate of 25% among the bits whose bases match. Small experiments vary because measurements are random.