Quantum Algorithms Database
Quantum Error-Correcting Codes (Shor Code, Surface Code)
Algorithms and encoding schemes for protecting quantum information from errors by spreading it across multiple physical qubits.
Year
1995 (Shor code; Steane code 1996); 1997 (surface and toric codes); 2024 (qLDPC demonstrations)
Inventor(s)
Peter Shor; Andrew Steane; Alexei Kitaev; Sergey Bravyi and Kitaev; Austin Fowler and others
Speedup Type
No Speedup Claimed
Difficulty
★★★★★
Overview
Quantum error correction, or QEC, protects fragile quantum information from noise by spreading it across many physical qubits. Together those qubits form a logical qubit whose error rate can be made far lower than that of any individual physical qubit, as long as the physical error rate is below a threshold. QEC is the technology that turns noisy hardware into a computer capable of long, reliable calculations.
The idea seems impossible at first. Quantum states cannot be copied, and measuring them destroys them. The breakthrough, made in 1995, was to find ways to detect errors by measuring parities that reveal what went wrong without revealing the data, so errors can be fixed without disturbing the information.
The problem it solves
Protecting fragile quantum information from decoherence and gate errors without violating the no-cloning theorem.
History and background
Peter Shor published the first quantum error-correcting code in 1995, a nine-qubit code that protects one qubit against any single-qubit error. Andrew Steane's seven-qubit code followed in 1996, and Calderbank and Shor and Steane developed the CSS construction. In 1997 Daniel Gottesman introduced the stabilizer formalism, which gives a systematic way to describe codes, and Alexei Kitaev proposed the toric code, a code based on a lattice with topological protection. Bravyi and Kitaev adapted it to planar surfaces in 1998.
The threshold theorem, proven in the late 1990s by Aharonov and Ben-Or, Kitaev, and Knill, Laflamme, and Zurek, says that arbitrarily long computations are possible if the physical error rate is below a constant threshold. Fowler, Mariantoni, Martinis, and Cleland laid out a practical surface-code architecture in 2012. In 2023 Google showed a distance-5 surface code with slightly lower error than distance 3, and in December 2024 its Willow chip showed logical error rates falling as the code grew from distance 3 to 5 to 7, the first below-threshold result on a superconducting platform. IBM published high-rate qLDPC codes in 2024, and trapped-ion and neutral-atom groups have reported logical-qubit experiments.
How it works
Encodes one logical qubit across many physical qubits in an entangled configuration, allowing errors to be detected and corrected via syndrome measurements without directly observing the protected quantum information.
The simplest classical code repeats each bit three times and takes a majority vote. A quantum code cannot copy a state, but it can entangle it with extra qubits so that information is stored in correlations. The three-qubit bit-flip code maps the state a times 0 plus b times 1 to a times 000 plus b times 111. A flip on any one qubit is detected by comparing neighbors' parities without measuring the state itself.
A real quantum code must handle both bit flips and phase flips. Shor's code nests a phase-flip repetition code inside a bit-flip repetition code, using nine qubits. The surface code arranges data qubits on a grid with two types of stabilizer checks, one detecting bit flips and one detecting phase flips, measured repeatedly. Each round produces a syndrome, a pattern of check outcomes that a classical decoder uses to infer the most likely errors.
The key property is that logical errors become exponentially rare as the code distance d grows, if the physical error rate p is below the threshold p sub th. The logical error rate falls roughly like (p over p sub th) to the power (d plus 1) over 2. For the surface code the threshold is about 1% with realistic circuit noise, which hardware now meets, though with large overheads.
Step by step
- Encode the logical qubit into a block of physical qubits using entangling gates so that the information is spread across the block.
- Repeatedly measure the stabilizer checks using ancilla qubits, producing syndrome bits without measuring the logical information.
- Send the syndrome history to a classical decoder, which finds the most likely set of physical errors that explains it.
- Apply corrections, or in many designs track the errors in software instead of physically correcting them.
- Perform logical gates by transversal operations, lattice surgery, or code deformation, and prepare special magic states for non-Clifford gates, distilling them to high fidelity.
- Measure the logical qubit at the end of the computation by measuring the physical qubits and decoding the result.
A worked example
Consider the three-qubit bit-flip code. A single qubit state a times 0 plus b times 1 is encoded as a times 000 plus b times 111. Suppose the second qubit flips by mistake. Measuring the parity of qubits 1 and 2 gives 1, and the parity of qubits 2 and 3 gives 1, which together identify qubit 2 as the culprit. Applying an X gate to qubit 2 restores the original encoded state, and the data never was measured.
With a physical error rate of 1% per qubit per round, the code fails only if two or more qubits flip, which happens with probability about 3 times 0.01 squared, or 0.03%, roughly 30 times lower. For the surface code at distance 7, Google observed that logical errors per cycle were about half those at distance 5, and the logical memory outlived its best physical qubit by more than a factor of two.
Complexity and resources
| Item | Detail |
|---|---|
| Threshold | About 1% for the surface code with circuit-level noise; higher for some other codes under idealized noise |
| Qubits per logical qubit (surface code) | About 2 times d squared, so hundreds to thousands depending on target error |
| Logical error scaling | Falls exponentially with code distance when below threshold |
| Decoding | Must keep up with microsecond-scale syndrome cycles; real-time decoders are demonstrated at small distance |
| Overhead for useful algorithms | Estimates range from about 1,000 physical qubits per logical qubit to far fewer with qLDPC codes |
What hardware it needs
- Physical gate and measurement errors well below 1%, with fast, mid-circuit measurement and reset.
- Real-time classical decoding hardware linked to the qubit controls.
- Large qubit counts, from hundreds for experiments to millions for large algorithms.
Applications
- Enabling fault-tolerant algorithms such as Shor's algorithm and large chemistry simulations.
- Storing quantum memories for long durations.
- Protecting qubits in quantum networks and repeaters.
- Defining resource estimates and roadmaps for companies such as Google, IBM, Quantinuum, and QuEra.
Limitations and caveats
- The overhead in qubits is large: useful machines need many physical qubits per logical qubit.
- Logical operations beyond the Clifford set need expensive magic state distillation or alternatives.
- Correlated errors, leakage, and slow decoding can degrade performance.
- Experiments so far demonstrate quantum memory and a few logical operations, not full fault-tolerant algorithms.
Common misconceptions
- Error correction does not copy the state. It entangles and measures parities instead.
- It does not remove all errors. It reduces them exponentially if the hardware is good enough.
- More qubits do not always help. If the physical error rate is above threshold, larger codes make things worse.
How it compares
- Error mitigation reduces the effect of noise on near-term devices without extra qubits but cannot scale to long circuits.
- Surface codes need only local operations but have low rates, while qLDPC codes need long-range connections but promise ten times fewer qubits.
- Bosonic codes such as cat and GKP codes build some protection into each oscillator, reducing the overhead of the outer code.
Real-world impact
The central technology required for fault-tolerant quantum computing at scale; without it, large quantum algorithms like Shor's cannot run reliably on real hardware.
Why it matters
QEC is the central requirement for large quantum computers. Every credible roadmap to useful algorithms, from Google's and IBM's to Quantinuum's and QuEra's, depends on it, and progress in logical error rates is now the main measure of hardware advancement.
For learners, QEC is also the best window into why quantum computing is hard and how it can be done. The ideas of syndromes, stabilizers, thresholds, and distance appear in nearly every hardware announcement.
Frequently asked questions
What is a logical qubit?
A qubit encoded across many physical qubits using an error-correcting code, with an error rate much lower than any physical qubit.
What is the threshold theorem?
It states that if the physical error rate is below a certain threshold, quantum computations of any length can be made reliable with a modest overhead.
What is the surface code?
A code that arranges qubits on a 2D grid with local parity checks. It has a high threshold of about 1% and needs only nearest-neighbor interactions, so it is the leading code for superconducting chips.
Has error correction been demonstrated?
Yes. Google's Willow chip showed logical error rates falling as the surface code grew to distance 7, and other groups have demonstrated logical qubits on ions and neutral atoms.
How many physical qubits per logical qubit are needed?
It depends on the code and the physical error rate. For the surface code estimates range from hundreds to a thousand or more, and qLDPC codes may reduce that by a factor of about ten.
Keep learning
- Read the full deep-dive in our Learning Center
- Related algorithm: Quantum Error Mitigation Techniques
- Related algorithm: Quantum Zeno Effect and Zeno-Based Protocols
- Related algorithm: Random Circuit Sampling (Quantum Supremacy Experiments)
- Related algorithm: Quantum Teleportation Protocol
This page is written for educational purposes. Complexity statements describe the best known results at the time of review (September 30, 2026), and research in this area moves quickly, so check recent papers before relying on a specific bound.