QR error correction helps

Error correction sounds good. It means fewer errors, right?

hen it comes to QR codes, that’ll mean easier scanning for people, surely? It seems like that’s not the whole story. I wondered about this, and couldn’t find an answer, so I did some exploration, and found there’s two factors in tension: the error correction on one hand, and the resulting data density on the other:

  1. For fixed data, like a particular URL, it’s easier to read a QR code with lower error correction, but only when there’s minimal damage to the code (like reflections and dirt).
  2. Error correction works as advertised when there’s damage: higher error correction means more codes can be read.

The rest of this article explores what this means.

QR (quick response) codes are now extremely widespread in Australia, because they’re used for COVID contact tracing check-ins and placed in every shop window, but they’re somewhat magic. Before diving into the details, Wikipedia says a whole lot about QR codes; the summary is: a QR code is a pattern of black and white squares that encodes some data (often a URL), that cameras can read. The article even has diagrams. Here’s one with a whole lot of detail, highlighting a bunch of key concepts going into a QR code, however there’s two that are most important when considering how easy it is to scan a QR code: version and error correction.

I’ve learnt that the four different QR error correction levels influence both data volume and ability to scan. For a given QR version, increasing error correction allows storing less data, but makes scanning easier and more reliable. However, for storing a fixed amount of data, like a particular URL, the version is computed automatically, and the easier scanning can trade off against the data volume. This ties back to the size of the individual modules (little squares): there is a minimum certain size before a code is scannable, and so a denser code needs to be larger.

Full Version

A QR code (abbreviated from Quick Response code) is a type of matrix barcode (or two-dimensional barcode) invented in 1994 by the Japanese automotive company Denso Wave.