How QR Code Personalization Works: an in-depth look at QR Code Error Correction

Lately we’ve been talking a lot about QR codes, first we created a guide that demonstrates how to easily create personalized QR codes, and more recently our CTO Christian discussed QR codes on Swiss National Television. Today we want to continue the discussion by taking an in-depth look at the error correction capabilities of QR codes.

It turns out that all QR codes have built-in error correction capabilities that allow for the decoding of the QR code if the code is corrupted. Certain parts of a QR code can thus be edited (=corrupted) without affecting the ability to decode the content, while others must always be visible. In order to understand which parts of a QR code can be modified, let’s start by examining a structural layout of a QR code:

 

Diagram 1: Structure of a QR Code (source: Wikimedia)

 

Take a look at the legend in the diagram to note the areas (modules) of the code that cannot be modified. The three big squares in the corners of the code are the position markers that let the scanner know where the edges are, the smaller square in the bottom right is the alignment marker, which gives the scanner a point of orientation, and the little lines of squares are called the timing patterns, which define the layout of rows and columns.  The red portions around the position markers indicate the format of the data in the QR code, such as a website, image, text message, etc. Lastly, the blue areas indicate the version number. Outside of these fundamental modules lies the modifiable area of the code, which also contains the data and error correction keys. So just how much of this area can be modified? It boils down to the size of your code—the larger the version, the more you can edit.

Let’s look at an example that illustrates how you choose the appropriate size of a QR code and how you can estimate the size of the patch you can edit. If we were to encode “https://www.scandit.com”, we would need space for 22 characters. The QR version and maximum capacity table tells us that we can encode 22 alphanumeric characters in a QR code of 29×29 modules (version 3) with the strongest error correction level (H). With this error correction level, 30% of the QR code can be “corrupted” and the code can still be decoded successfully. Since such a QR code stores 208 data bits according to the above table, we can roughly edit a patch of 8-by-8 modules in the QR code of this size. If you need a larger editable patch, simply choose a larger QR code with more modules. Here’s a look at the different error correction levels:

 

Level L

7% of the code can be altered

Level M

15% of the code can be altered

Level Q

25% of the code can be altered

Level H

30% of the code can be altered

 

We hope you find this information helpful in understanding how QR code personalization works, and we encourage you go ahead and create your own codes! Through error correction capabilities partial and modified QR codes can still be scanned, give it a try using our Scandit QR scanner: