Coding & Information Theory

Error Detection vs Error Correction

Detecting an error tells you something went wrong; correcting it fixes the data. How both keep codes and downloads reliable.

Error detection spots that something went wrong; error correction fixes it without asking for a retry. Both rely on adding redundancy to a message — and the difference between them is exactly why a scratched QR code can still scan perfectly.

Send any message through the real world — a wire, a radio wave, a printed label — and sooner or later a piece of it gets mangled. The clever response isn't to hope for the best; it's to build the message so mistakes reveal themselves, and better still, repair themselves. Here's how detection and correction differ, and where each shows up in daily life. 🐾

What is error detection?

Error detection is the ability to notice that a message has been corrupted. It doesn't fix anything — it just raises a hand and says "this doesn't look right." When a system detects an error, it typically discards the bad data and asks for it to be sent again, or flags it for a human.

The classic example is the parity bit: a single extra bit added to a group so that the total number of 1s is always even (or always odd). If a single bit flips in transit, the count no longer matches, and the receiver knows something broke. It can't tell which bit went wrong — only that one did. Our guide to checksums, hashes and parity bits covers these detectors in detail.

What is error correction?

Error correction goes one step further: it not only detects a problem but reconstructs the original message, right there, with no retransmission needed. This is essential whenever asking for a retry is impossible or impractical — a spacecraft can't easily resend data across the solar system, and a printed QR code can't ask you to un-smudge it.

Correction works by adding more structured redundancy than mere detection needs. Instead of a single alarm bit, the message carries enough extra information to pin down where the error is and what the right value should be. The first practical scheme to do this was invented by Richard Hamming — see Hamming codes for that origin story.

Detection asks "is this wrong?" Correction asks "what should it have been?" The second question costs more redundancy to answer, but it means the message survives on its own.

Why does redundancy make this possible?

Both detection and correction run on the same fuel: redundancy, meaning extra information beyond the bare message. This sounds wasteful, but it's the whole trick. Claude Shannon, who founded information theory, showed that carefully chosen redundancy is what lets us communicate reliably over unreliable channels.

A simple way to feel it: imagine sending a single letter but writing it three times — "AAA." If one copy arrives as "AAB," you can still detect the error (the copies disagree) and correct it by majority vote (two A's beat one B). That crude repetition wastes a lot of space, but it captures the principle. Real codes achieve the same protection far more efficiently.

How much redundancy do you need?

The more errors you want to catch or fix, the more redundancy you must add. Detecting a single flipped bit is cheap — one parity bit does it. Correcting an error costs more, because you have to locate and repair it, not just notice it. Correcting many errors costs more still.

  • Detect one error: a single parity bit is enough to spot any single bit flip.
  • Correct one error: a small handful of parity bits, arranged cleverly, as in Hamming(7,4), can pinpoint and fix one flipped bit.
  • Correct many errors: powerful codes like Reed–Solomon add multiple check symbols; every two check symbols buy the ability to correct one symbol error.

This is always a trade-off. Redundancy takes up space that could have carried more message, so designers tune the amount to the expected level of damage. Our piece on Reed–Solomon error correction shows how that dial gets set for demanding uses.

Where do we see error detection and correction in real life?

Once you know to look, these techniques are everywhere quietly keeping data intact:

WhereWhat it does
QR codesCorrect damage from smudges, scratches, and logos so the code still scans
CDs and DVDsCorrect read errors from scratches and dust as the disc spins
Deep-space probesCorrect errors in signals weakened by vast distances, where resending is slow or impossible
Computer memory (ECC)Detect and correct occasional bit flips in server RAM on the fly
Network transfersDetect corrupted packets with checksums and request a resend

Notice the split: networks often lean on detection because resending a packet is cheap, while discs, spacecraft, and QR codes need correction because a retry isn't an option.

How does a QR code use both?

A QR code is a lovely showcase of correction in the physical world. When a code is created, extra error-correction data is calculated from your message and woven into the grid using Reed–Solomon coding. When a scanner reads a damaged code, that redundancy lets it both locate the damaged areas and rebuild the missing data — detection and correction working together.

This is precisely why a coffee stain, a crease, or a deliberately placed logo doesn't kill a QR code. As long as the damage stays under the code's recovery threshold, the math fills in the gaps. You choose how much protection to include when you make the code; the levels and trade-offs are laid out in QR code error correction.

Detection or correction — which should you want?

It depends on whether a retry is cheap. If the sender can easily resend — as on most computer networks — lightweight detection plus a "please repeat that" is efficient and simple. If a retry is slow, costly, or flat-out impossible — a printed code, a scratched disc, a signal from Mars — you need correction, and you pay for it in redundancy.

QR codes fall firmly in the second camp. Once a code is printed, it can't renegotiate, so it carries its own repair kit. That self-sufficiency, rooted in a century of ideas from Shannon and Hamming onward, is what makes the humble black-and-white square so dependable.

Want a code that shrugs off wear? You can create a free QR code with QR Puppy and choose the error-correction level that fits where it will live.

Frequently asked questions

What's the core difference between detection and correction?

Detection tells you an error happened but not how to fix it, so the usual response is to request a resend. Correction adds enough redundancy to rebuild the original message on the spot, with no retransmission needed.

Why not always use correction if it's more powerful?

Because correction costs more redundancy, which eats into the space available for your actual data. When a retry is cheap — as on a network — simple detection plus a resend is more efficient than carrying a full repair kit.

Can a parity bit correct errors?

No. A single parity bit can detect an odd number of flipped bits but can't identify which bit is wrong, so it can't correct anything. Correction requires more structured redundancy, as in Hamming or Reed–Solomon codes.

Why do QR codes need correction rather than detection?

A printed QR code can't ask to be re-sent, so detecting damage alone would be useless. It carries error-correction data so a scanner can rebuild the message directly, even when part of the code is obscured or worn.

Is redundancy just wasted space?

It uses space, but it isn't wasted — it's the price of reliability over an imperfect channel. Shannon's information theory showed that well-chosen redundancy is exactly what lets messages survive noise and damage.

Make a QR code the honest way 🐾

Free forever, no tracking, no expiry — generated right in your browser.

🎨 Create a QR code →