Pull up any QR code — the one on the back of a shampoo bottle, the one on a restaurant menu, the one stuck to the wall at a museum. What catches your eye first? The three large squares in the corners. Those are the finder patterns, and without them, no scanner would have any idea which way up the code is or where it ends. They're the part of the code that does the most work, and they're the part the design team tries to redesign first when they decide the brand needs a custom QR. They usually regret it.
The rest of the code is more orderly than it looks. Every black or white square — called a module — has a specific job: orientation, metadata about how the data is encoded, the data itself, or extra error-correction bits that let the scanner recover when part of the code is missing. None of it is decorative.
What a QR code actually encodes
The QR spec defines four encoding modes, picked automatically based on what you give the encoder:
- Numeric. Just digits. Densest mode — about 3.3 bits per digit. Useful for serial numbers, phone numbers without punctuation, raw IDs.
- Alphanumeric. Digits, uppercase A-Z, and nine punctuation marks (space,
$,%,*,+,-,.,/,:). About 5.5 bits per character. Used for things like upper-case URLs in a fixed format. - Byte. Any UTF-8 text, including lowercase letters, all URLs, all international characters. 8 bits per byte. This is what almost every QR you scan in the wild uses.
- Kanji. A compact mode for Japanese characters that fits each kanji in 13 bits. Rare in Western contexts but actively used in Japan, which is where the QR format was invented (Denso Wave, 1994).
The encoder picks the densest mode the input allows. A lowercase URL forces byte mode; an uppercase URL in alphanumeric mode fits in about 30% less space.
The structural pieces
- Finder patterns. The three big squares in the corners (top-left, top-right, bottom-left). Define orientation. Removing one breaks the scan entirely; covering one with a logo breaks the scan unless you're using high-correction codes that can survive the damage.
- Alignment patterns. Smaller squares scattered through larger codes. They help the scanner re-align when the code is on a curved surface (a mug, a wine bottle) or photographed at an angle.
- Format information. A fixed strip near the finder patterns. Encodes the error-correction level and the mask pattern (a deterministic XOR applied to the data region to avoid runs of all-black or all-white squares that confuse scanners).
- Data and error-correction. The bulk of the dots. Roughly half data, half error-correction parity, interleaved by the Reed-Solomon algorithm.
- Quiet zone. The white border around the whole code. Modern scanners tolerate small quiet zones; older ones don't. The spec asks for four modules of clearance on every side.
Error correction levels — L, M, Q, H
- L (7%). Recovers from 7% damage. Smallest, densest codes. Use for on-screen QRs where size is constrained.
- M (15%). Default for general use. The right answer most of the time.
- Q (25%). Used for decorative or branded codes that overlay a logo in the centre — the logo eats a chunk of the code, the error correction puts it back.
- H (30%). Printed signage that will get scuffed, dirty, or partially occluded. You can blot out almost a third of an H-level code and it still scans.
Higher correction means a larger code at the same data length. The Reed-Solomon maths behind it is non-trivial, but the practical effect is what matters: H-level codes are the ones you see on stickers and outdoor signage because they survive being scratched.
Why long URLs make ugly codes
QR codes come in 40 versions, numbered 1 to 40. Version 1 is 21×21 modules; each subsequent version adds four modules per side, so version 40 is 177×177 modules. Each version holds more data than the previous one, with the data capacity also depending on the error-correction level and the encoding mode.
Versions 1 to 10 cover most realistic URLs. Version 25 and above are practically unscannable at phone-camera distance — the modules become so small that you'd need broadcast-quality optics to resolve them reliably. If your QR has crossed into postage-stamp Rorschach territory, the fix is almost never "make the code bigger". The fix is to shorten the URL.
URL shorteners vs raw URLs in QRs
A bit.ly link is 14 to 18 characters; the QR fits comfortably on a business card. The raw URL it redirects to might be 250 characters of tracking parameters; the QR for that one needs to be five centimetres wide to scan reliably.
The tradeoff:
- Shortener pros: smaller, more reliable QR. Click tracking on the redirect. Lets you change the destination after the code is printed.
- Shortener cons: a third-party redirect that slows things slightly and reveals to the shortener that you scanned the code. Users are increasingly suspicious of bit.ly and tinyurl.com links, since attackers use them for phishing.
- Raw URL pros: direct, no third party, the destination visible on hover or preview before tap.
- Raw URL cons: ugly QR if the URL is long.
Pragmatic answer: use raw URLs for short, branded domains where the URL is already 30 characters or fewer. Use a shortener — ideally on your own domain, which removes the suspicion problem — for anything longer.
What about the QR codes that have a logo in the middle?
The logo isn't part of the QR spec. The trick is to encode the data at a high error-correction level (Q or H) and then literally paint the logo over the middle of the rendered code. The scanner reads the surrounding modules, runs the Reed-Solomon decoder, and reconstructs the data that was hidden behind the logo. As long as the logo covers less than about 25% of the code area and doesn't touch the finder patterns, the code still scans.
The two failure modes: a logo too big, and a logo on top of a finder pattern. Either one will give you a code that prints beautifully and scans intermittently — fine in the office where you tested it, but failing in a poorly-lit restaurant at the angle a customer holds their phone. Always test with the worst-case device and lighting you can find before sending the code to print.
When to use the QR-code-generator tool here
The QR code generator picks the right error-correction level for your content size, exports at print quality, and runs entirely in your browser — useful when you don't want to paste a URL into a random web service to get a QR back.
Related reading
The text diff checker sits in the same general territory — both deal with structured encoded text where small changes matter. The UUID generator is what you'd use if you want a short, opaque ID to embed in a QR instead of a long URL.