# Toric Code
The **toric code** is a foundational [[Stabilizer Codes|stabilizer code]] in which qubits are laid out on a grid wrapped onto the surface of a torus (a doughnut), and information is stored in the *global shape* of the system rather than in any local spot. It is the original **topological** quantum code.
## First principles
Place a physical [[Qubit|qubit]] on every edge of a 2D grid. Define two kinds of local [[Syndrome Extraction|parity check]]:
- **Vertex checks** ($X$-type): look at the four edges meeting at each grid vertex.
- **Plaquette checks** ($Z$-type): look at the four edges around each square face.
A valid codeword satisfies all of them. An error flips some checks, and the flipped checks appear at the *endpoints* of the error — like the two ends of a broken string. Correction means pairing up these endpoints.
The information itself is stored **topologically**: in whether loops of operators wrap *all the way around* the torus. You cannot read or corrupt a logical value with any local action — you'd have to span the entire system.
$
\text{logical information} \;=\; \text{non-contractible loops around the torus}
$
> [!intuition] Why "topological" means "robust"
> A small scratch can't change whether a loop encircles a doughnut's hole. Likewise, only an error stretching across the whole array — exponentially unlikely — can damage the encoded data. Local noise causes only local, detectable, correctable disturbances.
## Why it matters
- It introduced the idea that **geometry and topology can protect quantum information**, directly inspiring the more practical [[Surface Code]] (the toric code "cut open" to have edges, so it doesn't need a literal doughnut).
- Its checks are **local** — each touches only neighbouring qubits — which suits hardware where qubits interact with their neighbours.
- The number of errors it can tolerate grows with the grid size, the [[Code Distance and Threshold Theorem|code distance]].
## Related
- [[Stabilizer Codes]]
- [[Surface Code]]
- [[Syndrome Extraction]]
- [[Code Distance and Threshold Theorem]]
- [[Quantum Error Correction]]