The Steane code and the 5-qubit code

Two more distance-3 codes: one built from a classical code, one the smallest possible.

8 min read · reviewed December 2026

The Steane code

Andrew Steane’s 1996 code uses seven qubits and six checks. Three checks detect bit flips and three detect phase flips, and in both cases the checks are those of the classical Hamming code. The Hamming code has a lovely property: the syndrome, read as a binary number, is the position of the faulty bit.

Steane code: the syndrome of a single X error on each qubit, read from the three Z-type checks (last three generators). Reading the bits as a binary number gives the position.
ErrorZ-checksAs binaryQubit position
XIIIIII00111
IXIIIII01022
IIXIIII01133
IIIXIII10044
IIIIXII10155
IIIIIXI11066
IIIIIIX11177

The 5-qubit code

Five qubits is the smallest size that can correct an arbitrary error on one qubit. Its four checks are cyclic shifts of XZZXI. The lab confirms the counting argument: sixteen syndromes, one for no error and fifteen for the fifteen single-qubit errors, so none are left over.

Side by side

Logical error rate under depolarizing noise at three physical error rates, with perfect checks.
Codep = 0.1%p = 1%p = 5%Leading term
No code0.100%1.00%5.00%p
3-qubit repetition0.200%1.98%9.51%2·p^1
5-qubit code9.98e-69.78e-42.23%10·p^2
Steane 7-qubit code1.63e-50.158%3.44%16.333333333333332·p^2
Shor 9-qubit code1.30e-50.126%2.81%13·p^2

Reading the table

All three distance-3 codes fix every single-qubit error, so their logical error starts at order p². The factor in front differs: in this noise model the 5-qubit code has the smallest leading term (10p², against 13p² for the Shor code and about 16p² for the Steane code), so it wins at small p. The Steane code is often preferred in practice because many of its logic gates act on each qubit separately. That second point comes from the literature and is not something the lab computes.

Try it

Questions

Why is the 5-qubit code called perfect?

Its syndromes are exactly used up by the no-error case and the single-qubit errors, with none left.

Which code is best?

It depends on the noise, the gates available and the overhead. No code wins on every count.

Are these used in current machines?

Mostly not. Experiments focus on surface codes, the subject of a later guide.

Read next

Sources and further reading

Check the original sources for exact citations.