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 ROOMS

Alice 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.

Create a room or join an invitation.

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.

|0⟩+ basis · bit 0
|1⟩+ basis · bit 1
|+⟩× basis · bit 0
|−⟩× basis · bit 1
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.

Choose a mode to begin.

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.

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.

← Back to Learn