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.

okokokok

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

  1. Repetition tab, 3 qubits: flip one qubit and watch the syndrome point at it. The decoder fixes it.
  2. Flip a second qubit. Now the majority is wrong. Two errors beat a code that corrects one.
  3. Switch to 9 qubits and use Random noise at 20%. Larger codes survive more flips.
  4. Quantum codes tab, Steane code: click Z on one qubit. A bit-flip code could not see this. Read which checks fire.
  5. Click a second error and see whether the decoder still wins. Try the same pair on the Shor code.
  6. 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.

The 3-qubit repetition code with encoded 0 = 000. Every bit-flip pattern, its syndrome, and what majority voting does.
Flipped patternSyndrome (q1⊕q2, q2⊕q3)Decoder outputResult
00000000recovered
10010000recovered
01011000recovered
00101000recovered
11001111logical error
01110111logical error
10111111logical error
11100111logical error
The four codes in the lab, analysed over all 4^n Pauli errors with a lowest-weight lookup decoder.
Code[[n,k]]ChecksSingle-qubit errors fixedTwo-qubit errors that failBeats no code up to
3-qubit repetition[[3,1]]2not all18 of 27never
5-qubit code[[5,1]]4all90 of 9013.76%
Steane 7-qubit code[[7,1]]6all147 of 1898.10%
Shor 9-qubit code[[9,1]]8all117 of 32410.48%
Logical error rate under depolarizing noise at three physical error rates, with perfect checks.
Codep = 0.1%p = 1%p = 5%Leading term
No code0.100%1.00%5.00%p
3-qubit repetition0.200%1.98%9.51%2·p^1
5-qubit code9.98e-69.78e-42.23%10·p^2
Steane 7-qubit code1.63e-50.158%3.44%16.333333333333332·p^2
Shor 9-qubit code1.30e-50.126%2.81%13·p^2

Eight guides

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

References were written from memory of the original works. Check the originals for exact citations.