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.
| Error | Z-checks | As binary | Qubit position |
|---|---|---|---|
| XIIIIII | 001 | 1 | 1 |
| IXIIIII | 010 | 2 | 2 |
| IIXIIII | 011 | 3 | 3 |
| IIIXIII | 100 | 4 | 4 |
| IIIIXII | 101 | 5 | 5 |
| IIIIIXI | 110 | 6 | 6 |
| IIIIIIX | 111 | 7 | 7 |
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
| Code | p = 0.1% | p = 1% | p = 5% | Leading term |
|---|---|---|---|---|
| No code | 0.100% | 1.00% | 5.00% | p |
| 3-qubit repetition | 0.200% | 1.98% | 9.51% | 2·p^1 |
| 5-qubit code | 9.98e-6 | 9.78e-4 | 2.23% | 10·p^2 |
| Steane 7-qubit code | 1.63e-5 | 0.158% | 3.44% | 16.333333333333332·p^2 |
| Shor 9-qubit code | 1.30e-5 | 0.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
- P. W. Shor, “Scheme for reducing decoherence in quantum computer memory” (1995)
- A. M. Steane, “Error correcting codes in quantum theory” (1996)
- D. Gottesman, “Stabilizer codes and quantum error correction” (PhD thesis, 1997)
- Google Quantum AI, “Quantum error correction below the surface code threshold”
- M. Nielsen and I. Chuang, Quantum Computation and Quantum Information, chapter 10
Check the original sources for exact citations.