Surface Codes Explained: The Path to Fault-Tolerant Quantum Computing

A surface code is a quantum error-correcting code that lays qubits out on a flat grid and checks each qubit only against its neighbours. It powered Google’s 2024 error-correction milestone, and it descends from the Shor code, the first quantum error-correcting code (Peter Shor, 1995).
- Note: Shor’s code is not Shor’s algorithm. They come from the same researcher but are different work. The 1994 algorithm factors integers, and the 1995 code protects qubits.
- On the grid, data qubits hold the protected information. Measurement qubits sit between them. These are also called ancilla qubits, meaning helper qubits used only for checking.
- Each measurement qubit repeatedly checks the combined parity of its neighbouring data qubits. If the answer changes, that signals an error nearby, and the check never reveals the stored value.

As the grid grows, the code distance grows with it. Code distance is how much damage the code can take and still recover.
The Path to Fault-Tolerant Quantum Computing
Fault-tolerant quantum computing means getting reliable answers from noisy qubits and gates. The path there starts with the Shor code, the first quantum error-correcting code (Peter Shor, 1995), and runs to surface codes working below threshold on Google hardware in 2024.
- Shor’s code is not Shor’s algorithm. The 1994 algorithm factors integers; the 1995 code protects qubits.
- The path has five steps. Each one closes a gap the previous step left open, and the table below maps the route in order:
| Milestone | What it added |
| 1. Three-qubit bit-flip code | Catches bit flips |
| 2. Three-qubit phase-flip code | Catches phase flips |
| 3. Shor’s nine-qubit code (1995) | Catches any single-qubit error |
| 4. Surface code | Local checks, adjustable protection |
| 5. Google’s below-threshold result (2024) | Bigger codes, fewer errors |
Why Quantum Computers Need Error Correction
A qubit can fail in more ways than a bit can. It can suffer a bit flip, a phase flip (a sign change that bits don’t have), both at once, or any small rotation in between.
The classical fix of copying and voting doesn’t work, because an unknown qubit can’t be copied and looking at it destroys it. Every code on this path needs redundancy without copying and checks without looking.
What Is Shor’s Nine-Qubit Quantum Error-Correcting Code?
Shor’s code is the first quantum error-correcting code, published by Peter Shor in 1995. It protects one qubit of information by spreading it across nine physical qubits. It can correct any single-qubit error: a bit flip, a phase flip, or both at once.
Its parameters are [[9,1,3]]: nine physical qubits, one logical qubit, and code distance 3. Source: Shor’s original 1995 paper, P. W. Shor, “Scheme for reducing decoherence in quantum computer memory,” Phys. Rev. A 52, R2493 (1995).
Shor’s code protects qubits. Shor’s algorithm factors numbers.
How Shor’s Code Combines Bit-Flip and Phase-Flip Error Correction
Shor’s code is easiest to understand as two small codes stacked together. Each one fixes a single kind of error, and neither is enough on its own.
How the Three-Qubit Bit-Flip Code Detects and Corrects Errors
This code stores |0⟩ as |000⟩ and |1⟩ as |111⟩. A superposition becomes the matching mix of both, which is entanglement rather than copying.
You never measure the qubits themselves. Ancilla qubits (helpers used only for checking) measure the parity of pairs: do qubits 1 and 2 agree, and do qubits 2 and 3 agree? The two answers form the syndrome:
| 1 and 2 agree? | 2 and 3 agree? | Diagnosis |
| Yes | Yes | No bit flip |
| No | Yes | Flip qubit 1 back |
| No | No | Flip qubit 2 back |
| Yes | No | Flip qubit 3 back |
This is the key idea. The syndrome tells you which qubit disagrees, but never what any qubit holds. You learn about the error without learning the value, so the superposition survives. Every later step builds on this.
This code’s blind spot is phase flips.
How the Three-Qubit Phase-Flip Code Protects Quantum Information
A phase flip changes the sign between 0 and 1 instead of swapping them. The fix is to change which question you ask, so that a phase flip looks like a bit flip.
Hadamard gates rotate qubits into the |+⟩ / |−⟩ basis, and a phase flip swaps those two states. If you store logical 0 as |+++⟩ and logical 1 as |−−−⟩, the same pair checks from Step 1 now catch phase flips.
This code’s blind spot is bit flips.
How Concatenating Bit-Flip and Phase-Flip Codes Creates Shor’s Nine-Qubit Code
Shor’s key step was concatenation, which means nesting one code inside another. Each code then covers the other’s blind spot.
Start with the three-qubit phase-flip code. Replace each of its three qubits with a three-qubit bit-flip block. Three blocks of three qubits gives 3 × 3 = 9.
The checks inside each block catch bit flips. The checks across blocks compare the blocks’ signs and catch phase flips. Any single-qubit error, even a small rotation, can be broken into these two parts, and the code catches both.

Why Shor’s Code Is Difficult to Scale for Quantum Hardware
Shor’s code solved the problem on paper, but two limits kept hardware from being built around it:
- Overhead with no dial. Nine qubits only buy distance 3. The only way to go further is to concatenate again, which multiplies the qubit count.
- Connectivity. Each of its sign checks spans six qubits across two blocks. Chips where qubits can only talk to their neighbours struggle to wire that.
Shor’s code proved that quantum error correction was possible at all, which was its job. Everything after it is engineering built on that proof.
What Is a Surface Code in Quantum Computing?
The surface code, introduced by Alexei Kitaev in the late 1990s, is a different construction: a topological code on a flat grid. It keeps Shor’s core trick of checking parity without reading data, and it fixes both limits above.
How Surface Code Lattices Use Data Qubits and Ancilla Qubits
On the grid, data qubits hold the protected information and measurement (ancilla) qubits sit between them. Each measurement qubit checks the parity of its neighbouring data qubits, so every check stays local.

As the grid grows, the code distance grows with it, so protection becomes a dial rather than a fixed setting.
Why Surface Codes Are Suited to Superconducting Quantum Processors
Its neighbour-only checks match what superconducting chips can wire, and it tolerates comparatively high noise. The standard reference is Fowler, Mariantoni, Martinis and Cleland, “Surface codes: Towards practical large-scale quantum computation,” Phys. Rev. A 86, 032324 (2012).
The cost is qubits. In Google’s layout, a distance-d code uses 2d² − 1 physical qubits per logical qubit. That works out to 17 qubits at distance 3, and a projected 1,457 at distance 27 for a one-in-a-million error rate per cycle.
The table below compares the two codes on the points that decided which one hardware adopted.
| Feature | Shor’s code | Surface code |
| Qubits per logical qubit | 9, fixed | 2d² − 1, grows with distance |
| Qubits per check | Two, or six across blocks | Up to four neighbours |
| Hardware use today | Small demonstrations | Leading superconducting design |
Google’s 2024 Willow Experiment: Surface Code Error Correction Below Threshold
Every qubit you add to a code is also another place for errors, so a bigger code can perform worse. The threshold is the physical error rate below which this reverses and bigger codes start to win.
On 9 December 2024, Google Quantum AI reported crossing that threshold in Nature, in “Quantum error correction below the surface code threshold” (vol. 638, issue 8052). On its Willow processor, Google reports:
- An error suppression factor Λ = 2.14 ± 0.02 each time the code distance rose by 2.
- A 101-qubit distance-7 logical qubit with a logical error rate of 0.143% ± 0.003% per correction cycle.
- A logical qubit that outlived its best physical qubit by 2.4 ± 0.3×.
“Below threshold” means one specific thing: on this hardware, adding qubits to the code now helps rather than hurts. It does not mean quantum computers are error-free.
Google’s paper notes that these error rates are still orders of magnitude away from what practical algorithms need. It also notes that the experiment protected stored information (a memory), not a full computation.
How to Learn Quantum Error-Correcting Codes and Surface Code Decoding
For most readers, not as a specialisation. The field runs largely on postgraduate physics and mathematics, and dedicated roles are few. Three things still make it worth an afternoon:
- It is the most honest measure of how far quantum hardware is from production.
- Its maths (vectors, matrices and tensor products) is the same linear algebra that machine learning uses.
- Decoder work is one of the few ways into the field that starts from software rather than physics. Decoders are the classical software that turns syndromes into corrections.
The maths behind all of this is linear algebra and basic probability.
If you’re ready to Take Your Quantum Computing Knowledge Further?
Understanding quantum error correction is one step toward exploring how quantum computers can solve real-world problems. If you’re ready to move beyond the theory, the Certification in Applied Quantum Computing & AI by CEP, IIT Delhi offers 156 hours of learning, Qiskit-based hands-on labs, and capstone projects covering quantum computing, AI/ML, optimisation, and cybersecurity.
Build practical quantum computing skills and work toward applying them to real-world challenges.
Explore the Applied Quantum Computing & AI Programme by IIT Delhi
Frequently Asked Questions
A surface code is a quantum error-correcting code that arranges physical qubits on a two-dimensional grid. It uses local parity checks to detect errors without directly measuring the quantum information being protected. By increasing the grid size and code distance, surface codes can improve the reliability of a logical qubit.
Surface codes use ancilla qubits to measure the parity of neighbouring data qubits. These measurements produce a syndrome, which reveals information about possible errors without exposing the logical quantum state. Repeating the checks helps identify changes caused by errors over time.
Code distance is the minimum number of physical-qubit errors required to cause an undetectable logical error. A surface code with distance d can generally correct up to ⌊(d − 1)/2⌋ arbitrary errors, assuming suitable error correction. Increasing code distance improves protection but requires more physical qubits and additional operations.
The number depends on the code distance, lattice layout, and implementation. In the Google surface-code layout discussed in this article, the physical-qubit count is 2d² − 1, where d is the code distance. This corresponds to 17 physical qubits at distance 3 and 1,457 at distance 27, illustrating the overhead required for stronger error protection.
A physical qubit is a hardware-level quantum system that can store and process quantum information but is vulnerable to noise. A logical qubit is a protected unit of quantum information encoded across multiple physical qubits using quantum error correction. Logical qubits are designed to reduce errors, although they are not completely immune to them.
A quantum error-correcting code is below threshold when the physical error rates are low enough that increasing the code distance reduces the logical error rate. Google’s 2024 Willow experiment demonstrated this behaviour with a surface code. It means that adding more physical qubits can improve logical-qubit reliability, not that the system has become error-free.
Quantum errors can occur throughout a computation, and a single round of checks cannot reliably protect information indefinitely. Repeated error correction cycles track changes in error syndromes and help distinguish actual data errors from measurement errors. This ongoing process is essential for maintaining logical-qubit reliability during longer computations.
A quantum error correction decoder is classical software that analyses error syndromes produced by quantum measurements. It uses those measurement patterns to estimate which errors occurred and determine an appropriate correction or recovery operation. Efficient decoding is essential because a quantum computer must process error information fast enough to keep up with its correction cycles.
No. Surface codes can reduce the probability of logical errors, but they cannot eliminate every possible source of noise. Their effectiveness depends on physical error rates, code distance, measurement quality, and the accuracy of the decoder. Even below threshold, practical fault-tolerant quantum computing requires further reductions in logical error rates.
Scaling surface codes requires large numbers of physical qubits, reliable local operations, repeated measurements, and fast classical decoding. As code distance increases, the hardware overhead and control complexity also grow. Quantum processors must maintain sufficiently low error rates across the entire system while supporting the operations needed for useful fault-tolerant computations.






