The surface code is a topological quantum error correcting code, and an example of a stabilizer code, defined on a two-dimensional spin lattice. The first type of surface code introduced by Alexei Kitaev in 1997 was the toric code, which gets its name from its periodic boundary conditions, giving it the shape of a torus. These conditions give the model translational invariance, which is useful for analytic study. The toric code is the simplest and most well studied of the quantum double models. It is also the simplest example of topological order—Z2 topological order (first studied in the context of Z2 spin liquid in 1991). The toric code can also be considered to be a Z2 lattice gauge theory in a particular limit. However, on many quantum computation platforms, experimental realization of a surface code is much easier if the code can be embedded on a 2D plane. This motivated the design of another type of surface code with open boundary conditions, the planar code. As of 2025, Google Quantum AI has implemented a distance-7 planar code on their newest generation of superconducting quantum processors, Willow processor, demonstrating a below-threshold physical error rate.
Definition The surface code is defined on a two-dimensional lattice, usually chosen to be the square lattice. Below, we will first illustrate the basic concept with the toric code, where the lattice has periodic boundary conditions, i.e., the top boundary is connected to the bottom and the left boundary to the right. Topologically, this is equivalent to defining the lattice on a torus.
A qubit is located on each edge of the lattice. For a d × d lattice, there are d2 horizontal edges and d2 vertical edges, thus 2d2 qubits in total. Stabilizer operators are defined on the qubits around each vertex v and plaquette (face) p of the lattice as follows: Av=∏i∈vXi,Bp=∏i∈pZi. Here i∈v denotes the edges touching the vertex v, and i∈p denotes the edges surrounding the plaquette p. The code space of the toric code is the subspace for which all stabilizers act trivially, hence for any state |ψ⟩ in this space it holds that Av|ψ⟩=|ψ⟩,∀v,Bp|ψ⟩=|ψ⟩,∀p. For the toric code, this space is four-dimensional, and so can be used to store two qubits of quantum information. This can be proven by considering the number of independent stabilizer operators: For a d × d lattice, there are d2 vertex stabilizers and d2 plaquette stabilizers, but the product of all vertex stabilizers is I and so is the product of all plaquette stabilizers. Therefore there are 2d2 − 2 independent stabilizers, leaving 2 qubits worth of degrees of freedom. The occurrence of errors will usually move the state out of the code space, resulting in vertices and plaquettes for which the above condition does not hold. Specifically, a Pauli Z error on qubit i flips the two vertex stabilizers Av such that i∈v (the endpoints of the edge i), and a Pauli X error on qubit i flips the two plaquette stabilizers Bp such that i∈p (the plaquettes on either side of the edge i). The positions of these violations is the syndrome of the code, which can be used for error correction. The unique nature of topological codes such as the surface code is that stabilizer violations can be interpreted as quasiparticles. Specifically, if the code is in a state |ϕ⟩ such that Av|ϕ⟩=−|ϕ⟩, a quasiparticle known as an e anyon can be said to exist on the vertex v. Similarly a violation of some Bp is associated with an m anyon on the plaquette p. The code space, with no stabilizer violation, corresponds to the anyonic vacuum. The above-mentioned fact that the product of all vertex (resp. plaquette) stabilizers is I means that the number of e (resp. m) anyons on a toric code is always even.
A single-qubit Z error can be associated with an edge, and creates a pair of e anyons at both endpoints of that edge. However, two e anyons at the same location will annihilate each other, so a Z error can also effectively move an e anyon along an edge, allowing e anyons to be transported on the lattice. If the initial pair of anyons end up meeting each other and annihilating, then their paths form a loop.
If the loop is topologically trivial, then it can be written as a combination of plaquettes (Z stabilizer generators) on the lattice. Therefore the loop represents a Z stabilizer of the code, and has no effect on the stored information. The annihilation of the anyons, in this case, corrects all of the errors involved in their creation and transport. However, if the loop is topologically non-trivial, then it represents a non-trivial logical operator. Although re-annihilation of the anyons returns the state to the code space, it also implements a logical operation on the stored information. The errors, in this case, are therefore not corrected but consolidated. On a torus, there are two independent topologically non-trivial loops: One looping horizontally on the toric code lattice, one looping vertically. These can be identified with the Z operators of the two logical qubits encoded in the toric code. By considering the dual graph of the lattice, it can be seen that the above paragraph also applies to X errors and m anyons. Note that the horizontal Z operator and the vertical X operator belong to the same qubit, and vice versa. This ensures the correct commutation relations between logical operators.
… excerpt ends here. Continue reading the full article.

