Making it scan reliably
QR codes fail for a short list of reasons. Once you know the order a scanner works in, it becomes obvious which parts you can restyle and which you must leave alone.
How a scanner reads a code
- Binarize. Split the photo into small blocks and pick a brightness threshold per block.
- Find the three corner squares. These give position and rotation.
- Rebuild the grid. The dotted lines between the corners set the module spacing.
- Sample the centre of each cell. Not the whole cell, just the centre point.
Leave these alone
The three corner squares are how a scanner notices a QR code exists at all. Do not shrink them or wash them out.
Rounding their corners is fine, though. The 1:1:3:1:1 ratio a scanner looks for is measured along lines through the centre, and rounding the corners does not change the run lengths on those lines. Rounded all the way to circles and decoded 60 times under noise, the rate matched the square version exactly.
The quiet border matters too. The spec asks for four modules of clear space. Codes butted right up against a background image lose their edge.
These you can restyle
Do not take dot size below 80 percent
Scanners read only the centre of each cell, so shrinking dots is allowed. What surprises people is how abruptly it fails.
| Dot size | Decode rate |
|---|---|
| 100% | 100% |
| 85% | 98% |
| 72% | 2% |
| 60% | 0% |
The cliff sits between 85 and 72 percent. On a clean screen even 60 percent reads fine, so you will never find this edge by eyeballing it on a monitor.
Keep grey below about 40 percent luminance
Pure black is not required, but the scanner has to judge the module clearly darker than its surroundings. Around #666666 is a safe stopping point; lighter than that and lighting starts deciding for you.
In short: shape is nearly free, size and colour are expensive. Round the dots as much as you like, but shrink or lighten them one step at a time.
Where emptied codes struggle most
- Dim rooms where camera noise is heavy
- Moiré when photographing a screen
- Printed so small that a module is only a few pixels
- Creased paper or curved surfaces
Print sizing
A module should be at least 0.4mm for a typical phone camera to read it comfortably. In practice, leave headroom and go 25mm or larger.
| Version | Modules per side | Minimum size |
|---|---|---|
| V2 | 25 | 20mm |
| V5 | 37 | 25mm |
| V7 | 45 | 30mm |
| V10 | 57 | 38mm |
Raising the version to gain blank space makes each module smaller at the same printed size. For print, raise the error level instead.
Before you ship it
- Test with the stock camera app on both iPhone and Android
- Test in whatever app your audience actually uses
- If it is going to print, print it and test the print
- Check that it still reads at arm's length