Part of the robustness of QR codes in the physical environment is their ability to sustain “damage” and continue to function even when a part of the QR code image is obscured, defaced or removed.
This is acheived by using the Reed-Solomon Error Correction algorithm – some serious algebra that happens in background when the QR code is created. The original data in the QR code is converted into a polynomial, the number of unique points required to uniquely define that polynomial is determined, and this point set is added back into the QR code so that it then also contains the original data expressed as a polynomial.
If that description threatened to make your head explode, just call it “mathematically adding backup data to the QR code”.
There are 4 error correction levels used for QR codes, with each one adding different amounts of “backup” data depending on how much damage the QR code is expected to suffer in its intended environment, and hence how much error correction may be required:
- Level L – up to 7% damage
- Level M – up to 15% damage
- Level Q – up to 25% damage
- Level H – up to 30% damage
A fundamental part of the way QR codes work is that the more data you put into them, the more rows and columns of modules will be introduced into the QR code to compensate for the increased data load. As the error correction level increases, this means there will also be an increase in the number of rows and columns of modules required to store the original data plus the increasing amount of backup codewords. This is shown in the diagram below – the QR code becomes more dense as the error correction increases from Level L to Level H even though the QR codes contain exactly the same website URL.
Quite conveniently, there’s also 2 modules down in the bottom left-hand corner of every QR code that display what the error correction level used in that QR code is.
So here are the take-outs:
- The lower the error correction level, the less dense the QR code image is, which improves minimum printing size.
- The higher the error correction level, the more damage it can sustain before it becomes unreadabale.
- Level L or Level M represent the best compromise between density and ruggedness for general marketing use.
- Level Q and Level H are generally recommended for industrial environments where keeping the QR code clean or un-damaged will be a challenge.
As an aside, this is also one of the reasons why a QR code containing the same data will look different depending on which QR code generator you use – it depends on the error correction level being used by that particular website. Even though there is a single ISO standard for QR codes, there are variables within the ISO standard (error correction level being one of them) that will result in a different looking QR code image based on how that particular QR code creation website sets these variables.
This doesn’t mean that any particular QR code generator is any more or any less standards-compliant than any other, it just means that the people behind the different generators have made different choices when setting the underlying technical specifications and parameters for the QR codes that their website creates.