---
title: Surface Codes Overview
url: https://www.emergentmind.com/topics/surface-codes
type: topic
---

# Surface Codes Overview

Surface codes are topological quantum error-correcting codes defined from a cellulation of a two-dimensional surface. In the standard CSS construction, one physical qubit is placed on each edge, vertex-edge incidence operators generate one stabilizer type, and face-edge incidence operators generate the other. For a code associated with a tiling \(G=(V,E,F)\), the blocklength is \(n=|E|\), while the encoded dimension is determined by the topology: \(k=2-\chi\), and \(k=2g\) for a closed orientable surface of genus \(g\). Logical Pauli operators correspond to nontrivial cycles of the primal and dual lattices, whereas contractible error strings are stabilizer-equivalent to trivial errors. Surface codes combine bounded-weight local checks, planar layouts, string-like logical operators, and decoding methods based principally on syndrome-defect matching.

## 1. Algebraic and topological foundations

A quantum stabilizer code is commonly specified by parameters \([[n,k,d]]\), where \(n\) is the number of physical qubits, \(k\) is the number of encoded qubits, and \(d\) is the minimum weight of a nontrivial logical Pauli operator. It can correct up to

\[
\left\lfloor\frac{d-1}{2}\right\rfloor
\]

arbitrary errors. The encoding rate is \(R=k/n\). A code family has nonzero asymptotic rate when \(k/n\) remains bounded away from zero as \(n\to\infty\).

Surface codes are CSS codes. Given binary matrices \(H_X\) and \(H_Z\) satisfying

\[
H_XH_Z^{T}=0,
\]

the encoded dimension is

\[
k=n-\operatorname{rank}H_X-\operatorname{rank}H_Z.
\]

For a tiling \(G=(V,E,F)\) of a closed surface, qubits are placed on edges. The vertex-edge incidence matrix and face-edge incidence matrix provide the two parity-check matrices. Over \(\mathbb F_2\), the orthogonality condition follows because the boundary of every face is a cycle:

\[
\partial_1\partial_2=0.
\]

Equivalently, the cellular chain complex is

\[
C_2(G)\xrightarrow{\partial_2}C_1(G)\xrightarrow{\partial_1}C_0(G).
\]

For an error \(x\in C_1(G)\), its syndrome is

\[
s=\partial_1(x),
\]

the set of vertices incident to an odd number of erroneous edges. Face boundaries form the \(Z\)-type stabilizer equivalence relation. The \(X\)-error problem is described on the dual cellular complex.

The topological parameters follow from Euler characteristic,

\[
\chi=|V|-|E|+|F|.
\]

The surface code has

\[
k=2-\chi.
\]

For a closed orientable surface of genus \(g\), \(\chi=2-2g\), so

\[
k=2g.
\]

The distance is the smaller of the primal and dual combinatorial systoles:

\[
d=\min\{\operatorname{csyst}(G),\operatorname{csyst}(G^*)\}.
\]

A logical operator is therefore a cycle that is not a sum of face boundaries, either in the primal tiling or its dual. Local error strings create boundaries and remain stabilizer-equivalent to trivial errors; a sufficiently long noncontractible string implements a logical operation.

The same structure extends to arbitrary qudit dimension \(D\geq 2\). For generalized Pauli operators,

\[
X=\sum_{j\in\mathbb Z_D}|j+1\rangle\langle j|,
\qquad
Z=\sum_{j\in\mathbb Z_D}\omega^j|j\rangle\langle j|,
\qquad
\omega=e^{2\pi i/D},
\]

one has \(ZX=\omega XZ\). An oriented \(2\)-complex over \(\mathbb Z_D\) yields vertex and face operators with orientation-dependent powers of \(X\) and \(Z\). The code-space dimension is exactly the cardinality of first homology,

\[
K=|H_1(\Sigma)|.
\]

For a closed orientable genus-\(g\) surface, \(H_1(\Sigma;\mathbb Z_D)\cong\mathbb Z_D^{2g}\), giving \(K=D^{2g}\). Composite \(D\) can introduce torsion, so the code dimension need not always be a power of \(D\) [2112.01752].

## 2. Geometries, parameters, and asymptotic tradeoffs

The planar surface code uses rough and smooth boundaries to encode logical qubits. A logical \(Z\) operator is a string joining appropriate rough boundaries, and a logical \(X\) operator is a dual string joining smooth boundaries. For a square surface-code family of distance \(D\),

\[
n_{\square}=2D^2-2D+1
\]

physical qudits encode one logical qudit. A diamond surface-code family uses

\[
n_{\diamond}=D^2
\]

physical qudits and also has distance \(D\).

The asymptotic behavior of ordinary two-dimensional surface codes is

\[
k=O(1),\qquad n=\Theta(d^2),\qquad d=\Theta(\sqrt n),
\]

so the rate vanishes. This is a consequence of the two-dimensional topological tradeoff

\[
kd^2\lesssim n.
\]

For bounded-degree, bounded-face-size surface and color codes, a stronger form is

\[
kd^2\leq C(\log k)^2n,
\]

where \(C\) depends only on the locality bound. The proof uses a smooth Riemannian realization of the tiling and Gromov’s systolic inequality. The genus is proportional to \(k\), the area is \(O(n)\), and the distance is bounded by primal and dual systoles. Consequently, any bounded-locality surface or color-code family with nonzero asymptotic rate satisfies

\[
d=O(\log n).
\]

Hyperbolic surface codes attain nonzero rate with logarithmic distance. Hyperbolic color codes provide an analogous family: finite quotients of regular hyperbolic tilings, followed by a double-cover construction that ensures face 3-colorability, have

\[
d=\Omega(\log n)
\]

and rate converging to

\[
2\left(\frac12-\frac1\ell-\frac1m\right)
\]

when \(1/\ell+1/m<1/2\). Thus logarithmic distance is asymptotically optimal at nonzero rate within these bounded-degree surface and color-code families [1301.6588].

The tradeoff is not universal for all quantum LDPC codes. Hypergraph-product codes can have constant nonzero rate and

\[
d=\Theta(\sqrt n),
\]

while homological constructions encoding one qubit can achieve distance of order

\[
O\!\left(\sqrt{n\log n}\right).
\]

The logarithmic restriction is therefore geometric: it applies to these two-dimensional topological code families rather than to quantum LDPC codes in general.

## 3. Color codes, hypermaps, and local equivalences

Color codes place qubits on vertices rather than edges. Their tilings must be trivalent and face-3-colorable. If \(H\) is the face-vertex incidence matrix, then

\[
H_X=H_Z=H.
\]

For a tiling \(G\), a color code has

\[
n=|V|,\qquad k=4-2\chi,
\]

and \(k=4g\) on an orientable genus-\(g\) surface. Logical operators can be described through cycles in shrunk lattices. A local criterion states that if the faces incident to the support of a codeword form a planar subgraph, then the codeword lies in \(C^\perp\); nontrivial logical operators must therefore detect the global topology.

Color codes can be decoded by projection onto three surface codes. A trivalent, face-3-colorable tiling gives a dual triangulation with three vertex colors. Each color defines a monochromatic surface-code subgraph, and a chain-complex morphism projects the color-code error and syndrome onto that surface code. Every color-code hyperedge projects to one edge in each of the three surface codes. The three surface corrections are combined and then lifted through a polynomial-time compatibility test. If the corrections do not form a liftable boundary, the decoder returns **NO LIFTING**.

For independent phase errors of probability \(p\), each projected surface edge has error probability

\[
p_{\mathrm{proj}}=2p(1-p).
\]

If the three surface-code thresholds are \(p_c(\mathbf c)\), the induced color-code threshold obeys

\[
p_c\geq
\min_{\mathbf c\in\{R,G,B\}}
\left\{
\frac12\left(1-\sqrt{1-2p_c(\mathbf c)}\right)
\right\}.
\]

For hexagonal color codes decoded by minimum-weight perfect matching on the three projected surface codes, the reported phase-error threshold is approximately

\[
p_c\simeq 8.7\%,
\]

while the associated hexagonal surface-code threshold is approximately \(15.9\%\) [1308.6207].

A stronger local equivalence holds for closed two-dimensional color codes. Contracting all faces of one color produces a surface-code lattice \(\tau_c(\Gamma)\), and a color code on \(\Gamma\) is locally Clifford equivalent to two copies of the corresponding surface code:

\[
\mathrm{CC}(\Gamma)\simeq
\mathrm{SC}(\tau_c(\Gamma))\otimes
\mathrm{SC}(\tau_c(\Gamma)).
\]

The equivalence is invertible, locality-preserving, uses CNOT, Hadamard, and SWAP gates, and requires no ancillary qubits. It preserves the number of physical qubits. Independent noise on the color code, however, becomes correlated and nonuniform noise on the two surface-code copies, so an independent MWPM decoder need not be optimal. For the square-octagonal color code, the reported hard-decision MWPM threshold is approximately \(5.3\%\) for bit-flip noise and \(30.8\%\) for the improved erasure decoder [1804.00866].

Hypermap-homology codes provide another extension. Canonical hypermap codes are identical to surface codes after an explicit graph construction. Noncanonical hypermap codes are transformable into surface codes using CNOT gates; a basis transformation can be decomposed into at most \(n^2\) elementary CNOTs. The transformation preserves encoded dimension but need not preserve distance, stabilizer locality, or stabilizer weight. Thus canonical hypermap codes do not constitute a distinct code family from surface codes, whereas noncanonical choices can alter physical parameters while remaining CNOT-equivalent [1312.6344].

## 4. Decoding and noise adaptation

For a surface code, decoding means finding an error representative with the measured syndrome, modulo stabilizer boundaries. Minimum-weight perfect matching pairs syndrome defects by minimum-length paths. The union of the paths gives a correction \(\tilde x\) satisfying

\[
\partial_1(\tilde x)=s.
\]

For hexagonal toric surface codes, MWPM using Edmonds’ algorithm and Blossom V gives a reported phase-error threshold of approximately

\[
p_{\mathrm{surf}}\simeq 15.9\%.
\]

Other decoding methods include union-find, belief propagation and ordered-statistics decoding, renormalization-group decoders, cellular automata, tensor-network decoders, neural-network decoders, and MaxSAT formulations. Their essential tradeoff is between likelihood performance, latency, computational complexity, and robustness to correlated or circuit-level noise [2307.14989].

With faulty syndrome measurements, decoding becomes a space-time problem. Spatial edges represent data errors, temporal edges represent measurement errors, and detection events are changes between consecutive syndrome rounds. The decoder must distinguish a genuine data-error chain from an isolated measurement fault.

Noise tailoring changes the performance of a fixed surface-code geometry without changing its topological phase. Clifford-deformed surface codes apply independent single-qubit Clifford operators to the physical qubits. The code parameters, locality, and ordinary distance remain unchanged, but the Pauli composition of stabilizers and logical operators changes. Under biased noise, this can substantially alter logical failure rates. Effective distance \(d'\) measures the probability-weighted cost of the most likely logical operator rather than its ordinary Pauli weight. Random and translation-invariant Clifford-deformed families can outperform established XZZX and XY codes in selected finite-bias regimes, although several phase-diagram claims remain conjectural [2201.07802].

A related construction exchanges selected \(Z\) measurements for \(Y\) measurements, producing ZZZY surface codes. The resulting \([[13,1,3]]\) and \([[41,1,5]]\) codes retain the underlying surface-code parameters while adding syndrome information that distinguishes likely \(Z\)-error patterns. Decoding uses a preprocessing stage followed by MWPM. In the \([[13,1,3]]\) code, the fraction of weight-two \(Z\)-patterns corrected is reported as

\[
\beta_2=0.987.
\]

The method is designed for \(Z\)-dominated channels and maintains comparable behavior to ordinary surface codes under depolarizing noise [2409.10162].

For highly biased noise, rectangular surface codes with \(\gcd(j,k)=1\), and odd-dimensional rotated codes, have especially favorable dominant-error properties. In the pure-\(Y\) representation, a standard \(j\times k\) code has

\[
d_Y=\frac{(2g-1)jk}{g^2},
\qquad
g=\gcd(j,k),
\]

and \(2^{g-1}\) nontrivial \(Y\)-type logical operators. Coprime codes have \(d_Y=jk\) and one such logical operator. Odd rotated codes have

\[
d_Y=n,
\]

with the only nontrivial \(Y\)-type logical operator equal to \(Y^{\otimes n}\). The pure-dephasing threshold reaches

\[
p_c=\frac12
\]

with a polynomial-time decoder, and the subthreshold logical failure rate can scale as \(\exp[-\alpha O(n)]\) rather than \(\exp[-\alpha O(\sqrt n)]\) for square codes [1812.08186].

## 5. Variants beyond static two-dimensional codes

Folded surface codes introduce a mirror-dual two-layer geometry so that surface-code stabilizers retain their topological structure while supporting transversal or constant-depth logical Clifford gates. The construction applies to qudits of arbitrary dimension. Logical Hadamard and phase gates are implemented through paired operations on the two virtual layers, with stabilizer exchange between the mirror-dual \(X\)- and \(Z\)-type structures. Folding itself has depth \(6D-5\) for the square family, although the logical gates are constant depth after folding. The principal costs are deeper syndrome extraction, additional swaps, correlated errors, and the absence of a complete circuit-level threshold analysis [1603.02286].

Three-dimensional surface codes retain qubits on edges, vertex \(X\)-stabilizers, and face \(Z\)-stabilizers, but their excitations and logical operators change dimension. Magnetic excitations become flux strings, and one logical operator becomes membrane-like. A distance-\(d\) three-dimensional patch uses \(O(d^3)\) qubits; its logical \(Z\) is string-like while its logical \(X\) has weight \(O(d^2)\). A stack of three three-dimensional surface codes supports transversal \(CCZ\) and \(CZ\) gates. The reported perfect-measurement threshold is approximately \(3.3\%\), with an asymmetric \(Z\)-error threshold of approximately \(3.3\%\) and \(X\)-error threshold of approximately \(23.5\%\). The architecture avoids magic-state distillation in the proposed three-dimensional settings, but requires three-dimensional connectivity and more complex syndrome extraction [1801.04255].

Dynamic surface codes modify the space-time pattern of syndrome extraction rather than fixing a static stabilizer layout. Experiments have demonstrated three variants: a hexagonal-lattice implementation, a walking surface code in which data and measurement roles alternate, and an iSWAP-based implementation. The distance-3-to-distance-5 error-suppression factors are

\[
\Lambda_{35,\mathrm{hex}}=2.15(2),
\]

\[
\Lambda_{35,\mathrm{walk}}=1.69(6),
\]

\[
\Lambda_{35,\mathrm{iSWAP}}=1.56(2).
\]

The hexagonal implementation reduces the required local connectivity from four to three couplings per qubit; the walking implementation periodically measures and resets every qubit; and the iSWAP implementation replaces the conventional CNOT/CZ interaction family while using time-reversed schedules to compensate for dynamically distorted stabilizers [2412.14360].

Subsystem surface codes replace directly measured high-weight stabilizers with lower-weight gauge operators. Generalized subsystem surface codes based on four-valent cellulations use weight-three \(XXX\) and \(ZZZ\) gauge checks, encode \(2g\) logical qubits into \(3v\) physical qubits, and decode by mapping the \(X\)- and \(Z\)-error problems to two ordinary surface-code decoding graphs. A square-octagon subsystem code simulation reports a depolarizing-noise threshold of approximately

\[
p_{\mathrm{th}}\simeq1.75\%.
\]

The principal tradeoff is reduced measurement weight at the cost of gauge freedom and more elaborate decoding [1805.12542].

## 6. Rate enhancement, higher-dimensional constructions, and practical realization

Several recent constructions augment surface-code patches with structured connectivity while retaining bounded-weight checks.

Long-range-enhanced surface codes concatenate classical LDPC codes with repetition codes and then apply a hypergraph product. They encode

\[
\llbracket \Theta(L^2),K,\Theta(L)\rrbracket
\]

with

\[
\Theta(L\sqrt K)
\]

long-range stabilizers. A lower-bound argument shows that adding logical qubits while preserving surface-code distance \(d\sim\sqrt n\) requires \(\Omega(d)\) nonlocal checks. The construction is intended for trapped ions and reconfigurable neutral-atom arrays. Simulations indicate that such codes can outperform conventional surface-code copies under noisy syndrome measurements, with a representative rate \(k/n=4/244\) and break-even behavior around operation fidelities of approximately \(99.5\%\) [2309.11719].

Lift-connected surface codes apply the lifted-product construction to repetition-code parity checks. The resulting codes are stacks of surface-code patches interconnected by neighboring-layer links. Their parameters are

\[
[[n,k,d]]
=
\left[
\left[
\big((\ell+1)^2+\ell^2\big)L,\,
L,\,
\min(L,2\ell+1)
\right]
\right].
\]

They are \((6,6)\)-QLDPC codes: stabilizer weight and qubit degree are bounded by six. For selected finite-size comparisons, LCS codes have lower logical error rates than disconnected surface-code copies with the same \([[n,k,d]]\) parameters. Reported code-capacity pseudo-thresholds include approximately \(8.7\%\) for a \([[39,3,3]]\) LCS code compared with approximately \(6.4\%\) for three \([[13,1,3]]\) surface codes. Phenomenological-noise thresholds are approximately \(4.6\%\) and \(3.0\%\), respectively, in that comparison [2401.02911].

Layer codes geometrize arbitrary CSS codes in three spatial dimensions. Each input qubit becomes an \(xz\)-oriented surface-code layer, each \(X\)-check becomes an \(xy\)-oriented layer, and each \(Z\)-check becomes a \(yz\)-oriented layer. Local defect junctions implement the input-code relations. The output has maximum stabilizer weight six and parameters

\[
[[n,k,d]]
\longmapsto
\left[
\left[
\Theta(nn_Xn_Z),\,
k,\,
\Omega\!\left(\frac{d}{w}\min(n_X,n_Z)\right)
\right]
\right].
\]

For good CSS LDPC inputs, this gives

\[
[[\Theta(L^3),\Theta(L),\Theta(L^2)]],
\]

which achieves the optimal three-dimensional topological scaling. The construction also yields a polynomial energy barrier for suitable input families, but it does not establish a finite-temperature self-correcting quantum memory or provide a complete decoder [2309.16503].

Measurement-based quantum computation provides another implementation route. A two-dimensional cluster state is prepared using symmetric controlled-\(Z\) gates, selected qubits are measured in the \(X\)- and \(Z\)-bases, and the remaining qubits form a surface-code block. The reported constructions include a \([[5,1,2]]\) code from a \(3\times3\) cluster and a \([[13,1,3]]\) code from a \(5\times5\) cluster. Measurement outcomes produce known Pauli byproducts that can be tracked in a Pauli frame [2306.10267].

At the architecture level, surface codes therefore form a platform rather than a single fixed code. Their common invariant is the relation between local stabilizer checks, chain complexes, topological excitations, and nontrivial cycles. Geometry, boundary conditions, local Clifford dressing, gauge structure, dynamic schedules, higher-dimensional defect networks, and structured interconnections can alter rate, distance, gate transversality, noise tolerance, decoding complexity, and hardware requirements without abandoning the surface-code framework.

Source: https://www.emergentmind.com/topics/surface-codes