The 3-qubit bit-flip code, step by step

The simplest quantum code: three qubits, two parity checks, and one error fixed. With every case written out.

8 min read · reviewed December 2026

Encoding

The qubit a|0⟩ + b|1⟩ becomes a|000⟩ + b|111⟩. This is not three copies of the qubit. It is one entangled state in which the pair of values |000⟩ and |111⟩ carries the original amplitudes.

Checking for flips

Two parity checks compare qubits 1 and 2, and qubits 2 and 3. Both give 0 for |000⟩ and for |111⟩, so they do not disturb the superposition. If one qubit has flipped, one or both checks give 1, and the pattern points to the culprit.

The 3-qubit repetition code with encoded 0 = 000. Every bit-flip pattern, its syndrome, and what majority voting does.
Flipped patternSyndrome (q1⊕q2, q2⊕q3)Decoder outputResult
00000000recovered
10010000recovered
01011000recovered
00101000recovered
11001111logical error
01110111logical error
10111111logical error
11100111logical error

What it cannot do

Two flips look like one flip on the third qubit, so the decoder makes things worse and produces a logical error. The table shows it. Also, the code cannot see a phase flip: Z on any qubit changes the sign of the |111⟩ part and every check still reads 0.

Does it help?

Only if flips are rare. The chance of two or more flips out of three is 3p² − 2p³, which is smaller than p when p is below one half. The table gives exact values for larger repetition codes too.

P(logical error) = 3p² − 2p³

Repetition code with independent bit flips: exact logical error rate for each number of qubits.
Qubitsp = 1%p = 5%p = 10%p = 20%
1 (no code)1.00%5.00%10.00%20.00%
32.98e-40.725%2.80%10.40%
59.85e-60.116%0.856%5.79%
73.42e-71.94e-40.273%3.33%
91.22e-83.32e-58.91e-41.96%

Try it

Questions

Why is the syndrome table not the same as reading the qubits?

The syndrome compares neighbours. 000 and 111 give the same syndrome, so it never reveals which logical value is stored.

Is the 3-qubit code used in practice?

Not alone. It shows the principle. Real codes protect against both bit and phase errors.

What if the checks themselves fail?

Then the syndrome lies. Fault-tolerant design handles that. This lab assumes perfect checks.

Read next

Sources and further reading

Check the original sources for exact citations.