Overview
A surface code is a topological code on a flat patch of qubits. Every check involves at most four neighbouring qubits of a square grid, one patch stores one logical qubit, and the protection grows with the side length of the patch. These properties match hardware in which qubits interact only with their neighbours on a chip, and they come with a threshold near one percent for realistic circuit noise. For these reasons the surface code is the reference point against which other approaches to fault tolerance are measured.
The planar code was introduced by Bravyi and Kitaev and analysed as a memory by Dennis, Kitaev, Landahl and Preskill; the review by Fowler, Mariantoni, Martinis and Cleland set out its use for computation. This page covers the two standard layouts, syndrome extraction, thresholds and experiments. The general theory is under topological codes, decoding under quantum decoders and logical gates under lattice surgery.
Intuition
Lay out data qubits and colour the squares between them like a chessboard. Each dark square measures the product of on its four corners; each light square measures the product of . A chain of bit flips is seen only at its ends, where the number of flips around a dark square is odd. A chain that runs all the way from one side of the patch to the opposite side has no ends inside the patch and is invisible: it is a logical operator. The patch is cut so that only bit-flip chains joining the left and right sides, and only phase-flip chains joining the top and bottom, escape detection. Such a chain has at least qubits, so about errors in a line are needed before the decoder is more likely to complete the chain than to undo it.
The lesson The surface code develops this picture from the repetition code.
Prerequisites
Stabilizer codes and CSS codes; the toric code and the two boundary types described under topological codes; the circuit model with noisy gates and measurements.
Mathematical Definitions
Lattice. Fix . Take a square lattice with vertices for and . Each row carries horizontal edges, joining horizontal positions and for ; the leftmost and rightmost edges of a row have a vertex at one end only. Vertical edges join to for . One qubit sits on each edge:
The left and right sides, where edges stick out, are rough boundaries; the top and bottom rows are smooth boundaries.
Checks. Each of the vertices carries , of weight 4, or weight 3 in the top and bottom rows. Each of the square or open-sided faces carries , of weight 4, or weight 3 for the faces at the left and right ends, which lack one vertical side. The checks are independent.
Parameters. .
Logical operators. is the product of on the horizontal edges of any one row: a string joining the two rough boundaries. is the product of on the horizontal edges at a fixed horizontal position, one in each row: a string on the dual lattice joining the two smooth boundaries. They share exactly one edge and anticommute. A string may end on a rough boundary and an string on a smooth boundary without violating a check, which is why open strings between like boundaries are logical operators.
Properties. CSS; all checks are local on a planar square grid. With one ancilla per check the layout uses qubits. The code is due to Bravyi and Kitaev and, independently, Freedman and Meyer; its performance as a memory is the subject of Dennis, Kitaev, Landahl and Preskill. The rotated surface code achieves the same distance with about half as many qubits.
Lattice. Fix an odd integer . Data qubits sit on the sites , , of a square grid, with the row and the column: .
Bulk checks. For the plaquette consists of the four qubits , , , . It carries the product of on its qubits if is even and the product of if is odd.
Boundary checks. Extend the checkerboard one step beyond the grid and keep the half-plaquettes that follow the same colouring, -type on the top and bottom and -type on the left and right:
- top: for odd ; bottom: for even ;
- left: for even ; right: for odd ;
with . There are bulk checks and boundary checks, in all, half of each type. Two checks of different type share zero or two qubits, so all commute.
Parameters. , proved in the parameter theorem.
Logical operators. along any row and along any column . Any row and any column share one qubit.
Properties. CSS, with every check of weight 4 or 2 and every data qubit in at most two checks of each type. With one measurement ancilla per check the layout uses qubits on a square grid with nearest-neighbour couplings: 17 for , 49 for , 97 for . For even the same construction works with the boundary checks shifted by one position. Which pair of opposite sides carries the -type boundary checks is a convention; exchanging it exchanges the roles of rows and columns.
The layout appears in the comparison of lattices by Bombin and Martin-Delgado, who found that a planar surface code can reach , and it is used for planar patches by Horsman, Fowler, Devitt and Van Meter and analysed at small distance by Tomita and Svore. Compared with the planar surface code, which has data qubits, it roughly halves the qubit count at the same distance.
Let be the logical error probability per error-correction cycle of a memory experiment with a code of distance , for a fixed device or noise model, circuit and decoder. The error-suppression factor is
When the ratio is approximately independent of it is written , and . Operation below threshold corresponds to . If the scaling ansatz holds, .
is a measured or simulated quantity and inherits every condition of the experiment: the basis and number of cycles of the memory experiment, the way is extracted from the decay of logical fidelity, and the decoder. It is the figure of merit reported in the surface-code experiments of Google Quantum AI.
Theorems
For every odd the rotated surface code is a stabilizer code with parameters
Its checks are independent. The product of along any row and the product of along any column are logical operators of weight , any two rows (or two columns) differ by a product of checks, and no Pauli operator of weight less than acts non-trivially on the code space.
That a planar surface code can reach is due to Bombin and Martin-Delgado.
- Odd and the checks of the rotated surface code record, with -type weight-two checks on the top and bottom sides and -type on the left and right.
- The distance is the minimum weight of a Pauli operator that commutes with every check and is not, up to a phase, a product of checks.
Proof · Proof of the rotated surface code parameters
Use the coordinates of the code record. It is convenient to index every check, bulk or boundary, by a plaquette position with , whose qubits are those of that lie in the grid. The -type checks are the positions with even and ; the -type checks are the positions with odd and . For odd this reproduces the lists in the record.
Commutation. Two plaquette positions that share an edge have of opposite parity and share two qubits or none inside the grid; positions that share only a corner have the same parity, hence the same type. So checks of different type overlap on an even number of qubits.
Independence. Every qubit lies in at most two -type checks, namely those at diagonally opposite plaquette positions around it. A product of a set of -type checks is the identity exactly when every qubit lies in an even number of members of . So if two -type checks share a qubit, both are in or neither is, and a check containing a qubit that lies in no other -type check is not in .
The -type positions are connected under diagonal steps: from with even one reaches by steps that stay among the -type positions, since the bulk positions of one colour of a square board of side are connected by such steps, and each boundary position or is diagonally adjacent to a bulk position. Diagonally adjacent positions share exactly one qubit. Hence contains all -type checks or none. The corner qubit lies in the plaquette and in no other -type check, because the positions and , are not -type checks. So the plaquette is not in and is empty: the checks of type are independent. The -type checks are independent by the same argument with the corner qubit , which lies only in the plaquette . An -type product equals a -type product only if both are the identity, so the stabilizer group has rank and .
Logical operators. Let and . An -type check at position meets row in the two qubits if and in none otherwise, so commutes with all checks; similarly a -type check meets a column in two qubits or none, so commutes with all checks. and share the single qubit and anticommute. Two operators that commute with the stabilizer group and anticommute with each other cannot lie in it, so and are a pair of logical operators of the single encoded qubit.
All columns are equivalent. Fix and multiply the -type checks at positions , , . Each acts with on columns and in rows and (those inside the grid). For even the rows covered are ; for odd they are . In both cases every row is covered once, so the product is . Hence all differ by stabilizers. The same argument with the -type checks at positions , , shows that all differ by stabilizers.
Distance. Since , every Pauli operator commuting with all checks equals, up to a phase, with in the stabilizer group. Let be a product of operators on a set of qubits that commutes with all checks and is not a product of checks. commutes with , so , and then . Thus anticommutes with and with every , since these differ from by stabilizers. Anticommuting with means that contains an odd number of qubits of column . The columns are disjoint, so . Exchanging the roles of rows and columns, every non-trivial -type logical operator has weight at least .
A general Pauli operator is, up to a phase, a product . In a CSS code it commutes with all checks exactly when both factors do, and if it is not in the stabilizer group at least one factor is not; that factor has weight at least . Since has weight , the distance is exactly .
The exponent has a simple origin. A code of odd distance decoded by a minimum-weight rule corrects every error of weight at most , so it can fail only when at least positions are in error; the lowest-order failures are errors on the positions of some minimum-weight logical operator, so to lowest order the failure probability is proportional to . The ansatz packages the remaining combinatorial factor and the higher-order terms into the two constants. It is used to fit Monte Carlo data, for example by Fowler, Mariantoni, Martinis and Cleland, to analyse experiments (Google Quantum AI), and to choose a distance in resource estimates.
It is not a theorem. What is proved, for suitable noise models and decoders, is the existence of a threshold below which the logical error rate falls exponentially in (Dennis, Kitaev, Landahl and Preskill); the specific form, the meaning of as the crossing point of finite-size curves and the constancy of are empirical. Under the ansatz the ratio of logical error rates at successive odd distances is the error-suppression factor . The lesson Logical error rates and thresholds shows how to fit and how to report the uncertainty.
- This is a fitting model. and are fit parameters that depend on the code family, the noise model, the syndrome-extraction circuit, the decoder and the unit in which is quoted.
- Odd distance , physical error rate well below , and errors that are independent enough for the lowest-order failure mechanism to dominate.
- It is not accurate close to threshold or at distances so small that boundary effects dominate, and it fails when correlated errors or leakage set a floor.
Circuit-level thresholds
Under circuit-level noise every operation of the syndrome-extraction circuit can fail, and the threshold depends on the details. The published values below are not interchangeable; each row states what was assumed.
| Source | Noise model | Decoder | Threshold |
|---|---|---|---|
| Raussendorf and Harrington | preparation, gate, storage and measurement errors, each at rate | minimum-weight matching | |
| Wang, Fowler and Hollenberg | several circuit-level models with nearest-neighbour gates | minimum-weight matching | to , depending on the model |
| Stephens | varied: noise model, measurement circuit and decoding algorithm are compared | varied | to per gate |
| Gidney, Newman, Fowler and Broughton | rotated code compiled to controlled-NOT gates, several circuit-level models | correlated minimum-weight matching | to |
For comparison, with perfect measurements and independent bit flips the optimal threshold is (result). The factor of ten between the two regimes comes from the number of fault locations per check and from measurement errors, not from a change of code.
Worked Examples
The distance-3 rotated code
Number the nine data qubits , so the rows are , , . The rotated code has the eight checks
and logical operators , . Every check shares zero or two qubits with every check; for example meets in and in . meets in and in , and meets in the single qubit 0. Counting: logical qubit.
A bit flip in the centre flips both weight-four checks. A bit flip flips only : an error next to a boundary produces a single flipped check. Now let two bit flips occur, . The check is flipped twice and once, so the syndrome is the same as that of the single error . A minimum-weight decoder applies , and the result is . Distance 3 corrects one error and not two.
Choosing a distance with the ansatz
Take illustrative values , and in the scaling ansatz, and ask for per round. The condition gives , so . A rotated patch then has data qubits and ancillas, in total. Halving the physical error rate to changes the condition to , so and qubits. A factor of two in saved about a third of the qubits, because the distance enters the qubit count quadratically and the error rate only logarithmically.
Extrapolating a measured suppression factor
Google Quantum AI report per cycle and . If stayed constant, reaching would need
so and physical qubits. The calculation is an extrapolation over ten further steps of distance; the assumption of a constant has only been tested over the measured range.
Algorithms and Implementations
Measuring a check
Each check has its own ancilla qubit. For a -type plaquette the ancilla is prepared in , is the target of a controlled-NOT from each of the four data qubits and is measured in the computational basis; the outcome is the parity of the four data qubits. For an -type plaquette the ancilla is prepared in , is the control of four controlled-NOT gates and is measured in the basis.
All checks of the patch are measured in parallel, in four layers of two-qubit gates between a layer of preparation and a layer of measurement. Two requirements fix the order in which each ancilla visits its data qubits. First, neighbouring and plaquettes share two data qubits, and the interleaved circuits measure the intended commuting operators only if the two ancillas visit those shared qubits in a consistent order. Second, a single fault on an ancilla half-way through its circuit spreads to two data qubits, a hook error. The order is chosen so that the two qubits hit by a hook lie across the direction of the logical operator of that type and not along it; otherwise faults, instead of , could produce a weight- chain and the effective distance of the circuit would be halved (Tomita and Svore). The lesson Syndrome extraction with Stim computes this effect for both orders.
Because measurements are themselves faulty, a single round is not trusted. The decoder works with detection events, the changes of each check outcome from one round to the next, over about rounds, so that the decoding problem lives in space and time. Circuits of this kind are generated and sampled with Stim.
Logical qubits from defects and twists
A patch with four boundaries is one way to store a qubit. Two others are worth knowing.
- Holes. Switching off the checks in a region creates an internal boundary, smooth or rough. A pair of holes of the same type stores a qubit: one logical operator encircles a hole and the other joins the pair. Moving a hole of one type around a hole of the other type by changing which checks are measured implements a logical controlled-NOT. This is the basis of the scheme of Raussendorf and Harrington, described at length by Fowler and co-authors.
- Twists. A lattice defect line across which the two types of excitation are exchanged ends at points called twists, which behave under braiding and fusion like Ising anyons (Bombin). The corners of a planar patch, where a rough and a smooth boundary meet, can be identified with twists, and moving corners gives single-qubit Clifford gates (Brown, Laubscher, Kesselring and Wootton).
In current resource estimates logical operations are mostly done by lattice surgery on patches (Horsman, Fowler, Devitt and Van Meter).
Limitations and Common Pitfalls
- Quoting a threshold without its model. The values in the table differ by more than a factor of two for the same code. A threshold is meaningful only with its noise model, circuit and decoder.
- Reading the ansatz as a law. The scaling formula is a fit. Leakage out of the qubit subspace, crosstalk and rare correlated events, such as the high-energy impacts reported in repetition-code experiments (Google Quantum AI), are outside it and can set a floor.
- Assuming the measurement order is a detail. A poor order of the four gates halves the effective distance without changing the code.
- Counting only data qubits. A rotated patch needs qubits, and computation needs additional space for routing and for magic-state distillation.
- Expecting a transversal universal gate set. Being a CSS code, the surface code has a transversal controlled-NOT between two patches, but no non-Clifford gate can be implemented by a constant-depth circuit on a two-dimensional code of this kind; see topological codes.
- Rate. One patch stores one qubit, so the rate vanishes as the distance grows. Quantum LDPC codes trade locality for rate.
State of the Art
The statements below summarise individual publications and are current as of 2026-11 only in the sense that these are the sources this page has checked; it is not a complete survey.
- 2022, distance 3. Repeated error-correction cycles on a 17-qubit distance-3 surface code were reported on superconducting processors by Krinner and co-authors, with a logical error probability of about per cycle when runs with detected leakage are rejected, and by Zhao and co-authors.
- 2023, distance 5 against distance 3. Google Quantum AI measured a logical error per cycle of at distance 5 against averaged over distance-3 codes on the same device: a larger code performing slightly better.
- 2023 to 2024, neutral atoms. Bluvstein and co-authors operated a reconfigurable atom array with up to 280 physical qubits and showed that a logical two-qubit gate improves as the surface-code distance is increased from 3 to 7.
- 2024 to 2025, below threshold. Google Quantum AI reported a distance-7 memory on 101 qubits with error per cycle and , a logical lifetime exceeding that of the best physical qubit by a factor , and real-time decoding of a distance-5 code with an average latency of at a cycle time of .
Related Research
Color codes offer transversal Clifford gates on a similar planar layout; Floquet codes replace four-body checks by sequences of two-body measurements; biased-noise variants adapt the checks to asymmetric noise.