How to Read a Surface Code Diagram

Surface code diagrams are everywhere in quantum error correction papers, but they can look like abstract art if you don’t know what you’re looking at.

Two quantum error-correcting code diagrams side by side: on the left, a surface code with green and white square tiles; on the right, a color code arranged as a triangle with red, blue, and yellow hexagonal and triangular tiles. Both show qubit dot placements.

Those colorful grids and symbols actually encode crucial information about how qubits are arranged and how errors get detected. The field has developed a whole visual language for this, and once you learn to read it, these diagrams become a powerful shorthand for understanding what a QEC code is doing.

In this post, we’ll break down what all those shapes and colors actually mean, using the surface code as our example.

Encoding quantum information

Say you want to protect a single qubit of quantum information. In a quantum error correction code, you do this by spreading that information across multiple physical qubits.

Let’s consider the surface code, for the case where there are 9 of these physical qubits.

It helps to picture these qubits arranged on a grid:

A 3-by-3 grid of nine dark dots on a light gray background, representing a simple array of data qubits.

We call these physical qubits data qubits. These data qubits collectively hold the encoded quantum information.

Errors

Like any kind of physical qubit, data qubits are prone to errors.

A 3-by-3 grid of data qubits with two red lightning bolt symbols between adjacent qubits and the word ERROR in red, illustrating errors occurring between qubits.

When errors happen, we want to know about it, so we need a way to check.

The challenge is that measuring a data qubit directly destroys the quantum information it carries. So we need an indirect way to check for errors.

That’s where we introduce additional physical qubits, shown here as yellow dots:

A qubit grid showing dark data qubits and orange measurement qubits interleaved in a checkerboard-like pattern, illustrating the two types of qubits in a surface code.

We call these physical qubits measurement qubits (or sometimes ancilla or syndrome qubits). Their job is to check for errors on the nearby data qubits, without disturbing the encoded information.

Measurement

Each measurement qubit checks a specific group of neighboring data qubits. The diagram uses shapes and colors to tell you what kind of error each measurement qubit is looking for.

The shapes are determined by the geometry of the qubits in the code. The colours are left up to the person drawing the diagram to specify.

A qubit grid with one blue square plaquette highlighted in the center, connecting four surrounding data qubits, illustrating a single Z-type stabilizer measurement.

In our example, we’ll say that a blue square is how we indicate that we’re checking if there was a bit flip error on four adjacent data qubits.

A blue semicircle does the same thing, but for two adjacent data qubits. You’ll see these on the edges of the grid where there aren’t four neighbors to check.

A qubit grid with a blue half-circle highlighted on the left boundary, connecting two data qubits, illustrating a boundary stabilizer with only two qubits.

We’ll choose gray as our second colour, so that gray squares and gray semicircles indicate checks for phase flip errors on four or two adjacent data qubits, respectively.

A qubit grid with a gray half-dome on the top boundary and a gray square plaquette in the middle highlighted, illustrating both a boundary and a bulk stabilizer with their associated measurement qubits.

Putting it all together, here’s the full diagram for a 3x3 (a.k.a. distance-3) surface code, showing all the checks that make errors detectable:

A small surface code patch showing blue and gray plaquettes representing detected errors, with a legend: dark dot for data qubit, orange dot for measurement qubit, blue square for bit flip error, gray square for phase flip error.

Each shape in this diagram corresponds to what’s known as a stabilizer measurement. It flags whether an error has occurred in its neighborhood, without revealing (or disturbing) the actual quantum state.

Why this matters

Every QEC code has a corresponding diagram, and learning to read these diagrams gives you immediate insight into important properties of the code:

  • Connectivity: How many qubits are connected to each other.

  • Range of interactions: Whether qubits interact with neighbors or distant ones.

Surface code diagrams are especially important for quantum hardware design. But it’s worth noting that the diagram only shows the arrangement of qubits in the code, not the full picture of how they interact over time or how the error correction protocol actually runs. For that, you need a quantum error correction circuit.

This is where Plaquette comes in. With Plaquette, users can easily specify how qubits are arranged and how they interact.

How Plaquette helps

Users can load codes from Plaquette’s vast library (from planar codes to more exotic LDPC codes).

Side-by-side comparison of a surface code (green and white checkerboard patch) and a color code (triangle with red, blue, and yellow tiles), labeled 'Surface code' and 'Color code'.

Users can also easily construct their own codes by specifying stabilizers and logical operators.

A table listing the X and Z stabilizers for a surface code (X0X1X3X4, X1X2, X4X5X7X8, X6X7 and Z0Z3, Z1Z2Z4Z5, Z3Z4Z6Z7, Z5Z8) along with the logical operators Logical X = X2X4X6 and Logical Z = Z0Z4Z8.

Plaquette then automatically compiles a circuit showing how the QEC code works and calculates respective fault tolerant thresholds.

Three columns each showing a different code representation — a surface code diagram, a color code diagram, and a stabilizer table — with arrows pointing to bar charts showing error thresholds for bit flip, dephasing, leakage, and erasure errors. Captioned 'Thresholds for different codes'.

If you’re curious how Plaquette can work for your platform, get in touch and we can share a demo.

Not ready yet? You can also join our practitioners mailing list to be notified when we release new features or publish technical content like this.

This post was originally published in January 2025 and updated in April 2026.