developer · · Updated
How to Use QR Codes for Marketing, Docs, and Events
By Chirag
A QR code is a grid of black and white squares called modules. Almost every scanning problem comes down to how many modules the code needs and how big each one ends up on paper. Both are things you control when you create the code.
Size grows with the amount of data
QR codes come in 40 sizes, called versions. Version 1 is 21 × 21 modules, and each version adds 4 modules per side, up to 177 × 177 at version 40. The generator picks the smallest version that fits your text, so every extra character can push you into a bigger, denser grid.
Two things decide how many characters fit:
- Encoding mode. Digits alone use numeric mode, the most compact. Uppercase letters, digits, space and the symbols
$ % * + - . / :can use alphanumeric mode. Anything else, including lowercase letters,?,=and&, needs byte mode, the least compact. - Error-correction level. More redundancy means less room for data (see below).
At error-correction level M, a version 1 code holds 14 bytes, version 2 holds 26, version 3 holds 42, and version 4 holds 62. So https://shop.example.in/menu/7 (30 characters) needs a version 3 code (29 × 29) in byte mode. The same address written as HTTPS://SHOP.EXAMPLE.IN/MENU/7 qualifies for alphanumeric mode, which holds 38 characters at version 2 (25 × 25).
Domain names aren't case-sensitive, but paths often are. Only uppercase the path if your server actually answers at /MENU/7. Otherwise the reliable fix is simply a shorter link.
What error correction does, and doesn't, protect
Every QR code includes redundant data so it still scans when part of it is damaged. There are four levels:
| Level | Recoverable damage (approx.) |
|---|---|
| L | 7% |
| M | 15% |
| Q | 25% |
| H | 30% |
Higher levels survive more scuffing, glare, or a logo pasted in the middle, but they need more modules for the same text. Error correction also has limits:
- The three large squares in the corners (finder patterns) must stay intact.
- A code printed too small won't read at any level, because the phone can't tell the modules apart.
The QR Code Generator on this site uses level M. That's a sensible default for codes on flyers, posters, and documents that won't have a logo over them.
Leave the quiet zone alone
The QR specification requires a blank margin 4 modules wide around the code. Scanners use it to find where the code starts. The generator includes this margin in both the PNG and the SVG it creates. The usual way to break it is in layout: cropping the image tight, or placing the code against a busy background or a coloured panel edge. Keep dark modules on a light background, too. Many older scanner apps fail on inverted (light-on-dark) codes.
Sizing for print
A rule of thumb for print is that a code scans reliably from about ten times its own width. A 3 cm code works at arm's length (around 30 cm); a poster read from 2 metres away needs a code about 20 cm wide.
Check the module size, too. The generator's PNG always uses a whole number of pixels per module, so its width snaps near the size you pick. A version 3 code is 37 modules across including the margin; at the 400-pixel setting that gives 11 pixels per module and a 407-pixel image, which prints about 3.4 cm across at 300 DPI, roughly 0.93 mm per module. That is comfortable for a flyer or letterhead. For anything larger, download the SVG instead: it is drawn as shapes rather than pixels, so it can be scaled to poster size with perfectly sharp edges.
Useful things to encode besides a URL
- Wi-Fi login. Phones recognise the format
WIFI:T:WPA;S:CafeGuest;P:chai2026;;and offer to join the network. If the network name or password contains\ ; , :or", put a backslash before that character. AddH:true;for a hidden network. - A document's current version. Print a code on a manual, equipment label, or packaging that points to the online copy, and you can update the document without reprinting the label.
- Event check-in. Put a code on each badge or ticket that links to the attendee's record, so staff scan instead of searching lists.
Static codes vs. "dynamic" codes
The code you generate here is static: the destination is written directly into the pattern and never changes. Paid "dynamic QR" services encode their own short link instead and redirect it to your page, so you can change the destination later. The trade-off is dependence: if that service shuts down or your subscription lapses, every printed code stops working. For anything printed in bulk, a static code pointing at a URL on your own domain gives you the same flexibility (you control where that URL redirects) without depending on someone else's service.
Test at final size, on the final material
Before a print run, print one proof at actual size and scan it with at least two different phones, under the lighting where it will be used. Glossy lamination can reflect light across the code, and a code that reads perfectly on screen can fail on a curved cup or a crumpled flyer.
Generate the code with the QR Code Generator. It updates as you type, so you can shorten a link and watch the grid get simpler before you download it.
Related guides
- How to Format and Read Messy SQL Queries · A one-line report query, formatted step by step, and the AND/OR precedence bug the formatting exposes, plus why picking the right SQL dialect matters and a LEFT JOIN rule worth memorising.
- HTTP Status Codes You Will Actually See, From One Real Site · Every status code this site and the two APIs it uses returned in one afternoon of curl requests (301, 308, 304, 204, 400, 404 and 405), what each means, and the redirect that broke a CORS request.
- Understanding UUIDs — What They Are and Why Developers Use Them · Why UUIDs are used instead of auto-incrementing IDs, what the version number means, and when a UUID is (or isn't) the right choice.