In this article
Look at a QR code on a restaurant table. It is torn at one corner, there is a coffee ring across it, and your phone reads it in half a second anyway. Try that with a barcode on a packet of biscuits and the till will beep angrily.
The difference is that a QR code was designed to be wrong and still work. Once you know how, you also know how to make ones that never fail at the worst moment, which is usually the moment after the printer has finished a thousand flyers.
Born in a car factory
QR stands for Quick Response. It was created in 1994 at Denso Wave, a company in the Toyota group, to track car parts as they moved through factories. Ordinary barcodes held a handful of digits and had to be scanned straight on, one line at a time. The factory needed to hold more and to scan quickly from any angle, on dirty, scuffed parts.
Denso Wave holds the patent but chose not to enforce it and published the standard openly, which is a big reason you now see these squares on everything from bus tickets to wedding invitations.
Reading the square
Every QR code is a grid of tiny squares called modules, each one either dark or light. Here is what your phone does with it in a blink:
- 1Find the three big squaresThese corner marks are the same in every code. They tell the phone where the code is and which way up it is.
- 2Straighten itA smaller square pattern helps correct for tilt, curves and perspective.
- 3Read the gridDark and light modules become ones and zeros, in a fixed zig-zag order.
- 4Repair the damageExtra error-correction data is used to fix any modules that were unreadable.
- 5Hand over the textA link opens, a phone number dials, plain text appears.
Notice that there is no fourth big square. Three corners are enough, and their layout is what tells the phone which way is up, so you can scan a code upside down or sideways and it still reads.
The part that makes it tough: error correction
Some of the modules in every code are not your data. They are repair information, calculated with a type of maths called Reed-Solomon coding (the same family used in CDs and in space communications). If part of the code is damaged, the phone uses the repair information to rebuild what was lost.
When you make a code you choose how much repair information to include:
| Level | Can lose up to | Best for |
|---|---|---|
| L, Low | about 7% | Clean screens, short codes you want as simple as possible |
| M, Medium | about 15% | A sensible default for most printing and screens |
| Q, Quartile | about 25% | Posters, packaging, anything that will be handled |
| H, High | about 30% | Codes with a logo in the middle, or outdoor and rough surfaces |
The percentage is the share of the code that can be unreadable while still decoding. Higher levels cost you extra modules.
There is a trade. More repair data means more squares, which means each square must be smaller, which makes the code harder to scan from far away. That is the whole game: robust or simple, pick based on where it will live.
The logo-in-the-middle codes you see on brands are using that built-in repair capacity on purpose. They cover the centre and trust the error correction to fill it in. That is why they are normally made at level H, and why putting a big logo on a level L code makes it fail.
Shorter content, better code
Codes come in 40 sizes called versions. Version 1 is 21 by 21 modules and each step up adds four to each side, up to 177 by 177 at version 40. The more you put inside, the bigger the version, and the smaller each module is for a given printed size.
At the top end a code can hold around 7,000 digits or about 3,000 bytes of text. Almost nobody needs that, and a code that dense is hard for a phone to read from a table.
The practical lesson: use a short link. A link of 25 characters makes a code with big, forgiving squares. A link of 250 characters, full of tracking parameters, makes a dense code that needs a steady hand and good light. If your address is long, put a short redirect page on your own site and encode that.
Static or dynamic?
This distinction decides whether your code will work in five years.
- A static code contains the information itself. The link, the text or the phone number is written into the squares. It works forever, needs no account and nobody can switch it off. You also cannot change it afterwards.
- A dynamic code contains a short address that belongs to a company, which then redirects the visitor to your real link. You can edit the destination and see scan counts. If you stop paying, the code can die, and so can every poster you printed.
The codes you make here are static. For a menu, a Wi-Fi password, a contact number, a link on a business card, that is usually the right choice. If you truly need scan analytics or a changing target, a dynamic service is the honest answer, but you are renting the code.
Print rules that save you a reprint
- Quiet zone. Leave an empty margin at least four modules wide around the code. Text or a border pressed up against it confuses the scanner.
- Contrast. Dark code on a light background. Avoid pale colours and be careful with inverted (light on dark) codes, which some scanners cannot read.
- Size. Around 2 cm square is a sensible minimum for things held in the hand. A common rule of thumb for distance is about ten times the code's width, so a 10 cm code works from roughly a metre.
- Surface. Glossy, curved or wrinkled surfaces bend the grid. Use higher error correction and test on the real object.
- Test before the print run. Scan with two different phones, an older one included, in poor light, from the distance a real person will use.
A neat trick: Wi-Fi in a code
Phone cameras understand a special text format for Wi-Fi networks. Create a code from plain text in this form:
WIFI:T:WPA;S:YourNetworkName;P:YourPassword;;
Replace the name and password, generate the code, print it and stick it near the router. Guests point a camera at it and join without typing a single letter. Our Wi-Fi QR Code Generator builds that text for you from two boxes. Two cautions: anyone who can see the code can read the password, so this suits a guest network and not your main one. And these online generators, ours included, draw the image through an outside QR service, so a password you care about deserves a generator that works fully offline.
One last warning
Questions people ask
Do QR codes expire?
A static QR code, which holds the link or text inside the squares, never expires. A dynamic code can stop working if the service that redirects it is cancelled or you stop paying.
What error correction level should I choose?
Level M is a good default. Use Q or H for printed material that may get scuffed, and H if you plan to place a logo in the middle. Level L suits clean, on-screen codes where you want the fewest modules.
What size should a printed QR code be?
At least about 2 cm square for things held in the hand, and larger for posters. A common rule of thumb is a distance of roughly ten times the code's width. Always leave a blank margin around it and test the real print.
Why will my QR code not scan?
The usual causes are too much data (a very long link), low contrast, no blank margin around the code, a code printed too small, or a logo that covers more than the error correction can repair. Shorten the link, raise the error correction and enlarge it.
Can I put a QR code on a business card?
Yes. Keep the link short, use at least level M, print it at 2 cm or more, and encode a page you control so you can update what visitors see.

