QR codes explained: error correction, sizes, what to encode, and printing them properly
A QR code is a two-dimensional barcode that most people meet as a black-and-white square and never think about again — until one they printed refuses to scan on a customer’s phone, or the URL inside it turns out to be wrong on ten thousand flyers. The reasons codes fail are consistent and avoidable: too dense for the size they are printed at, not enough contrast, no quiet zone, or a destination that could not be changed afterwards. This guide covers how a code actually stores data, what the four error-correction levels really trade away, how to size and print one that works, and the URL decisions to make before you generate anything — with the QR code generator here producing PNG or SVG for whichever medium you are heading to.
What is inside the square
The individual squares are called modules, and only some of them are your data. The three big squares in the corners are finder patterns — they let a camera locate the code and work out its rotation, which is why a QR code scans upside down and at an angle. Smaller alignment patterns correct for the distortion of scanning a curved or tilted surface; the dotted timing patterns between the finders tell the scanner how wide one module is; and a band around the finders holds format information describing the error-correction level and the masking pattern applied to make the code visually noisy enough to read reliably.
Codes come in 40 versions, from version 1 at 21×21 modules to version 40 at 177×177. The generator picks the smallest version that fits your data at the error-correction level you chose — which is why adding a few characters to a URL sometimes makes the whole code visibly denser: it has crossed into the next version.
How the data is encoded matters more than people expect, because there are four modes with very different efficiency:
| Mode | Characters | Bits each |
|---|---|---|
| Numeric | 0–9 only | ~3.3 |
| Alphanumeric | 0–9, A–Z (uppercase), space and $ % * + - . / : | 5.5 |
| Byte | Anything, as UTF-8 | 8 |
| Kanji | Shift-JIS characters | 13 |
That second row is a genuinely useful trick. A URL written entirely in uppercase can be encoded in alphanumeric mode at 5.5 bits per character instead of 8 — a third smaller, which often means a lower version and visibly chunkier, easier-to-scan modules. HTTPS://EXAMPLE.COM works because schemes and domain names are case-insensitive. Be careful past the domain, though: paths, query strings and short-link codes usually are case-sensitive, so uppercase them only if you know the destination tolerates it.
Error correction: what you are actually buying
QR codes use Reed–Solomon error correction, the same family of maths behind CDs and deep-space transmissions, and it is why a code with a coffee stain or a logo over the middle still scans. You choose how much:
| Level | Recoverable damage | Use for |
|---|---|---|
| L — low | ~7% | Clean screens, large prints, maximum data in the smallest code |
| M — medium | ~15% | The sensible default for most printing and display |
| Q — quartile | ~25% | Packaging, labels, anything handled or scuffed |
| H — high | ~30% | Industrial surfaces, curved objects, or a logo covering the centre |
The trade-off is the part that gets missed: redundancy is extra data, so raising the level for the same URL produces a denser code. Choosing H and then printing at the same physical size makes each module smaller, and you can easily end up with a code that is harder to scan than the M version would have been. Raise the level and the print size together, or keep M and print it properly.
Printing one that works
- Size by distance.Minimum width ≈ scanning distance ÷ 10. A poster read from three metres wants a 30 cm code; a table tent read at arm’s length wants 3–4 cm. Below about 2 cm, only short URLs at low error correction stay reliable.
- Leave the quiet zone. The specification calls for a clear margin of four modules on every side, and scanners genuinely rely on it. This is the single most common reason a code that looks fine in a layout fails on a printed page, because a designer cropped it flush to a coloured panel.
- Dark on light, with real contrast. Cameras look for a light field with dark modules. Inverted codes work on some scanners and not others, and mid-tone brand colours on a pastel background are a coin toss. Black on white always works; if you must use brand colours, keep the dark modules genuinely dark and test on several phones.
- Vector for print.A PNG scaled up for a poster gets soft edges that blur module boundaries. The generator’s SVG download stays crisp at any size, and is what you should hand to a printer.
- Mind the surface. Glossy laminate reflects flash; a code wrapped around a bottle needs the alignment patterns of a larger version to survive the curve; fabric distorts. Test on the real material, not on your monitor.
One specific note about this generator: it renders with a two-module margin rather than the specified four. On screen that is usually fine, but when you place the image into a print layout, add white space around it so the total clear margin is at least four modules wide. It costs nothing and removes the most common cause of field failures.
Logos and colour
Putting a logo in the middle works because error correction can rebuild what the logo covers — but it is a budget you are spending, not free space. Keep the covered area well under the level’s tolerance (a logo occupying more than about a fifth of the code is pushing it even at H), keep it central where the data is least concentrated, never cover a finder pattern, and always test the printed result rather than the design file.
The generator lets you set the module and background colours directly, which is handy for matching a brand — and easy to overdo. Check the pair for genuine contrast, and remember that a code is scanned in bad light, at an angle, by a cheap camera, by someone in a hurry.
Decide the URL before you generate
The pattern is a fixed encoding of whatever text you gave it. There is no editing afterwards, which makes the destination the most consequential choice on the page:
- Encode a redirect you control. A short URL on your own domain that forwards to the real page lets you fix a mistake, move the campaign, or retarget the code later. Encoding the final destination directly means a reprint if anything changes.
- Include the scheme.
https://example.com, notexample.com— without it, many scanners treat the content as plain text and show it rather than offering to open it. - Keep it short. Every character makes the code denser. Long tracking parameters are the usual culprit; put them on the redirect target instead of in the encoded URL.
- Watch the encoding of what you paste. Spaces and non-ASCII characters in a URL should be percent-encoded — the URL encoder handles that, and the encoding guide explains which mode to use.
- Test the actual code, not the URL. Scan it with an iPhone and an Android phone, from the distance and in the light where it will really be used, before it goes to print.
QR codes can hold more than URLs — Wi-Fi credentials, a vCard contact, a calendar event, an email draft — all as specially formatted text strings. They work, and they make the code much denser, so print them large.
The security angle
A QR code is unreadable by humans, which is exactly what makes it useful for attackers: a sticker placed over the code on a parking meter, a restaurant menu or a payment terminal sends people somewhere else entirely, and nothing about the sticker looks wrong. This has a name — quishing — and it is common enough that several national agencies have issued warnings about it.
Two defences, both simple. As a scanner: read the URL preview your phone shows before opening it, and be sceptical of any code that leads straight to a login or a payment. As someone deploying codes: print them rather than sticking them on, laminate where you can, and check periodically that nobody has covered yours.
Using the generator
Type or paste the text, pick a size (128 to 1024 pixels) and an error-correction level, adjust the colours if you need to, and the preview redraws as you type. Download as PNG for screens and email, or SVG for anything that will be printed or resized. The code is generated in the page — the text you encode is not sent to a server, which matters when it is a Wi-Fi password, a private link or an unreleased campaign URL.
Do this
- Encode a redirect on a domain you control, so the destination can change without a reprint.
- Include
https://, and keep the URL short — tracking parameters belong on the redirect target. - Default to error correction M; raise it only alongside the print size.
- Size the code at roughly the scanning distance divided by ten, and never smaller than about 2 cm.
- Leave a clear margin of at least four modules, and add extra white space around the downloaded image.
- Dark modules on a light background, with real contrast. Download SVG for print.
- Test the printed code on two different phones, at the real distance, in the real light.
Frequently asked questions
How big should a printed QR code be?
The working rule is distance divided by ten: a code scanned from one metre needs to be about 10 cm across, one on a business card held at 30 cm needs about 3 cm. Below roughly 2 cm, phone cameras struggle with anything but the simplest code. Denser codes — long URLs, high error correction — need to be larger still, because what actually matters is the size of each individual square.
Which error-correction level should I choose?
M for screens and clean printing, Q or H for anything that will be scuffed, curved, printed small, or covered by a logo. Higher levels do not make a code more reliable for free — they add redundancy data, so the code becomes denser for the same URL, and a denser code needs to be printed larger. M is the sensible default for exactly that reason.
Why does my QR code scan on one phone but not another?
Nearly always contrast, size or quiet zone. Cameras need a clear light margin around the code, genuinely dark modules on a genuinely light background, and modules large enough to resolve. Inverted colours (light code on dark) and low-contrast brand palettes are the two most common causes, and the failure is intermittent, which makes it look like a phone problem rather than a design one.
Can I change where a QR code points after printing it?
Only if you printed a redirect. A QR code is just encoded text — the destination is baked into the pattern. Encode a short URL you control and you can change where it forwards to at any time; encode the final destination and a wrong link means reprinting everything. For anything printed at volume, always encode a redirect you own.
Are QR codes a security risk?
The risk is that you cannot read one. A sticker placed over a legitimate code on a parking meter or a restaurant table can send you anywhere, which is why phishing via QR codes has its own name. Your phone shows the URL before opening it — read that preview, check the domain, and be suspicious of any code that leads to a login page or a payment request.
Tools used in this guide
Every one of these runs in your browser — the files you work on never leave your device.