Quantum Error Correction Lab
Break a protected qubit on purpose. Flip qubits by hand, read the syndrome that the parity checks produce, and watch the decoder repair the damage or fail. Then compare the 3-qubit, 5-qubit, Steane and Shor codes, with exact logical error rates.
Reviewed December 2026. New to this? Start on the Repetition code tab and flip one qubit, then two.
Encoded 0 is 00000. Click a qubit to flip it by hand.
Syndrome bits compare neighbouring qubits: 0000. They show where the pattern changes without revealing the encoded value.
0 qubits flipped. The decoder takes a majority vote and restores 00000.
Logical bit survives: 0. The code corrects up to 2 flips.
Exact chance of a logical error at p = 10% with 5 qubits: 0.856%, against 10% for one unprotected qubit.
A five-minute path
- Repetition tab, 3 qubits: flip one qubit and watch the syndrome point at it. The decoder fixes it.
- Flip a second qubit. Now the majority is wrong. Two errors beat a code that corrects one.
- Switch to 9 qubits and use Random noise at 20%. Larger codes survive more flips.
- Quantum codes tab, Steane code: click Z on one qubit. A bit-flip code could not see this. Read which checks fire.
- Click a second error and see whether the decoder still wins. Try the same pair on the Shor code.
- Compare codes tab: slide p up and see where each curve crosses the “no code” line.
What the lab does and does not do
- It treats errors as Pauli operators and analyses every one exactly, for codes up to 9 qubits.
- It assumes perfect syndrome measurement. Real checks are noisy, which lowers real thresholds.
- It does not simulate surface codes or fault-tolerant gates.
- The repetition-code curves model independent bit flips only.
Reference tables
Computed by the same code as the lab.
| Flipped pattern | Syndrome (q1⊕q2, q2⊕q3) | Decoder output | Result |
|---|---|---|---|
| 000 | 00 | 000 | recovered |
| 100 | 10 | 000 | recovered |
| 010 | 11 | 000 | recovered |
| 001 | 01 | 000 | recovered |
| 110 | 01 | 111 | logical error |
| 011 | 10 | 111 | logical error |
| 101 | 11 | 111 | logical error |
| 111 | 00 | 111 | logical error |
| Code | [[n,k]] | Checks | Single-qubit errors fixed | Two-qubit errors that fail | Beats no code up to |
|---|---|---|---|---|---|
| 3-qubit repetition | [[3,1]] | 2 | not all | 18 of 27 | never |
| 5-qubit code | [[5,1]] | 4 | all | 90 of 90 | 13.76% |
| Steane 7-qubit code | [[7,1]] | 6 | all | 147 of 189 | 8.10% |
| Shor 9-qubit code | [[9,1]] | 8 | all | 117 of 324 | 10.48% |
| Code | p = 0.1% | p = 1% | p = 5% | Leading term |
|---|---|---|---|---|
| No code | 0.100% | 1.00% | 5.00% | p |
| 3-qubit repetition | 0.200% | 1.98% | 9.51% | 2·p^1 |
| 5-qubit code | 9.98e-6 | 9.78e-4 | 2.23% | 10·p^2 |
| Steane 7-qubit code | 1.63e-5 | 0.158% | 3.44% | 16.333333333333332·p^2 |
| Shor 9-qubit code | 1.30e-5 | 0.126% | 2.81% | 13·p^2 |
Eight guides
Why quantum error correction looks impossible, and why it is not
8 min read
Three obstacles stood in the way of copying classical error correction. Each has a way round.
The 3-qubit bit-flip code, step by step
8 min read
The simplest quantum code: three qubits, two parity checks, and one error fixed. With every case written out.
Phase flips and the Shor code
9 min read
How to protect against Z errors by switching bases, and how nesting two repetition codes gives the first full quantum code.
Stabilizer codes: a compact way to describe a code
9 min read
How a short list of Pauli checks defines a code, and how an error’s syndrome is computed.
The Steane code and the 5-qubit code
8 min read
Two more distance-3 codes: one built from a classical code, one the smallest possible.
Decoding and degeneracy: why some two-qubit errors do no harm
8 min read
The decoder chooses a correction for each syndrome. In some codes, different errors are secretly the same.
Thresholds and the price of protection
9 min read
A code helps only if the hardware is good enough. Where the break-even lies in the lab, and what the threshold theorem adds.
Logical qubits in real hardware: what has been shown
8 min read
The experiments that moved error correction from theory to hardware, and what below-threshold means for the lab’s curves.
Predict, then check
Three qubits hold 000. Qubit 2 flips. What is the syndrome, and what does the decoder do?
The syndrome is 11, because qubit 2 disagrees with both neighbours. The decoder flips qubit 2 back and restores 000.
Two of three qubits flip. Does the 3-qubit code recover?
No. The decoder takes the majority, which is now 1, and the logical bit changes.
With 5 qubits and p = 10% bit flips, what is the logical error rate?
0.86%. With 3 qubits it is 2.80%.
At p = 1% depolarizing noise, which of the 5-qubit, Steane and Shor codes has the lowest logical error?
The 5-qubit code: 0.098%, against 0.126% for Shor and 0.158% for Steane.
Up to what physical error rate does the Steane code beat an unprotected qubit in this model?
About 8.1%, assuming perfect checks.
Related on QuantumAtlas
Frequently asked questions
What is quantum error correction?
A way to protect qubits by spreading one qubit’s information over several entangled qubits and measuring only parity checks, called the syndrome, so errors can be found and undone without reading the stored value.
Why can’t qubits just be copied for redundancy?
The no-cloning theorem forbids copying an unknown quantum state. Error correction entangles the qubit with helpers instead of copying it.
What is a syndrome?
The pattern of results from the parity checks. It identifies the error but reveals nothing about the encoded information.
How exact are the results in this lab?
Exact for the model. The lab decodes every one of the 4^n Pauli errors for each code and counts failures. Monte Carlo runs of 200,000 trials agree with the exact values within sampling error.
What noise model is used?
Each qubit independently suffers X, Y or Z with probability p/3 each. The repetition-code tabs use independent bit flips only.
Are the break-even values real thresholds?
No. They assume perfect gates and perfect syndrome checks. Real thresholds are lower.
Which decoder does the lab use?
A lookup table that picks the lowest-weight error for each syndrome, with ties broken by the first found.
Why does the 3-qubit repetition code ‘never’ beat no code?
Under depolarizing noise it cannot see phase flips, so about two thirds of single-qubit errors are not fixed. It only helps against pure bit flips.
Has error correction been shown in hardware?
Yes. The Research section summarises experiments in which a logical qubit improved as the code grew larger. See the last guide.
Where does this connect to Shor’s algorithm?
The huge qubit counts needed to break RSA come from the overhead of error correction. See the Shor lab’s Real scale tab.
Sources and further reading
- P. W. Shor, “Scheme for reducing decoherence in quantum computer memory” (1995). The first quantum error-correcting code, with nine qubits.
- A. M. Steane, “Error correcting codes in quantum theory” (1996). The seven-qubit code built from the classical Hamming code.
- D. Gottesman, “Stabilizer codes and quantum error correction” (PhD thesis, 1997). The stabilizer formalism used by this lab.
- Google Quantum AI, “Quantum error correction below the surface code threshold”. The experiment summarised in the last guide.
- M. Nielsen and I. Chuang, Quantum Computation and Quantum Information, chapter 10. The standard textbook treatment of quantum error correction and the threshold theorem.
References were written from memory of the original works. Check the originals for exact citations.