ZeroUtil
QR & Barcode

How QR Codes Actually Work: A Practical Guide

What the squares mean, how error correction works, when to use which encoding mode, and why your printed QR code sometimes doesn't scan.

By · · 8 min read

QR codes went from “novelty” to “ubiquitous” without most people ever learning how they work. They show up on restaurant menus, wine labels, Wi-Fi router stickers, and parking meters. If you’ve ever wondered why one QR code scans instantly while another — the same size, same printer — refuses to read, the answer is in the structure of the code itself.

This is a practical walkthrough of what’s actually encoded in those squares.

The anatomy of a QR code

Look at any QR code and you’ll see the same structural features:

  • Three large squares in the corners. These are the finder patterns — they tell the scanner “this is a QR code, and it’s oriented this way.”
  • A small square in the fourth corner (inside, not at the edge). That’s an alignment pattern, used when the code is large enough to warp under imaging.
  • Dashed lines connecting the finder patterns. These are timing patterns — a reference for the scanner to know the grid size.
  • A grid of black and white squares filling the rest. These are the modules — the actual data.

The smallest QR code is 21×21 modules (Version 1). The largest standard version is 177×177 (Version 40). Bigger versions hold more data but need more resolution to scan.

The encoding modes

QR codes don’t encode bytes the same way regardless of content. The spec defines four modes:

ModeAlphabetBits per character
Numeric0-93.33 (10 bits per 3 digits)
Alphanumeric0-9 A-Z $ % * + - . / : space5.5 (11 bits per 2 chars)
ByteAny 8-bit byte (usually UTF-8 or Latin-1)8
KanjiJIS X 0208 characters13

A generator picks the most efficient mode for the input. "12345" encodes with Numeric mode (17 bits). "HELLO WORLD" encodes with Alphanumeric (61 bits). "hello world" in lowercase forces Byte mode (88 bits) because lowercase isn’t in the Alphanumeric alphabet.

This matters when you’re trying to keep a QR code small: shorter content in a more efficient mode gives you more error-correction budget and smaller output. A URL like HTTPS://EXAMPLE.COM in caps encodes smaller than https://example.com in lowercase, even though they look the same to a user after scanning (most scanners are case-preserving for URLs, but the protocol layer handles the scheme).

Error correction levels

Every QR code includes redundant data so it can be read even if part of the code is damaged, dirty, or obscured. The spec defines four levels:

LevelRecovery capacityBest use
L (Low)~7%Clean indoor displays, screens
M (Medium)~15%Printed materials, standard use
Q (Quartile)~25%Rough environments, small logos in the center
H (High)~30%Outdoors, embedded logos, long-lived print

The tradeoff is size vs. robustness. An L-level QR holding a 100-character URL might be 29×29 modules; an H-level for the same content might be 41×41. More error correction means more modules, which means a larger minimum print size.

The “small logo in the center” use case specifically depends on error correction. The logo covers some of the modules; the error correction lets the scanner reconstruct them. This works only if the logo size stays below the error correction capacity — a logo covering more than ~25% of the code will fail to scan at level Q or below.

Why your QR code doesn’t scan

Common culprits, ranked by how often I’ve seen them cause trouble:

1. Too-small print

A QR code’s smallest feature is one module. For reliable scanning, each module should be at least 0.4mm wide (roughly 1/64 inch). A 29×29 module QR at 0.4mm per module needs to be at least ~12mm (1/2 inch) on a side.

Business cards and wine labels often get this wrong. A 15mm QR code that works under a lab scanner fails at arm’s length with a phone camera.

Rule of thumb for print: 2cm × 2cm minimum for URLs of ~50 characters, and scale up proportionally for longer content.

2. Insufficient quiet zone

QR codes require a quiet zone — a blank margin around the code, at least 4 modules wide, that helps the scanner distinguish the code from its background. Designers often crop this margin to make the code fit.

A QR code flush against a logo, image border, or the edge of a card becomes significantly harder to scan.

3. Low contrast

Black-on-white is the reference. Dark-blue-on-light-blue often works but is less reliable, especially in low light. Printed on dark paper, a dark-colored code that looked fine on a monitor can disappear from a scanner’s view.

Some brand-conscious designs invert the code (white squares on dark background) — most modern scanners handle this, but not all, and older scanners may refuse. If you must invert, test with several scanners before committing to print.

4. Reflective surfaces

A QR code on glossy paper, a phone case, or a screen reflecting overhead light produces glare that confuses the scanner. Matte prints are more forgiving.

5. Warped or curved surfaces

A QR code on a round wine bottle or a curved magnet can distort enough to fail. The alignment patterns help, but only to a point. For curved surfaces, a smaller code with higher error correction (level H) is more forgiving than a larger code with less correction.

Designing QR codes that last

If you’re generating QR codes for long-term use:

  • Pick error correction level M or higher. L is fine for screens; M is the minimum for print.
  • Keep the URL as short as possible. A URL shortener (your own domain, not a free service that might disappear) reduces the module count and the minimum print size.
  • Test on multiple phones, both iOS and Android, under realistic conditions — arm’s length, the lighting the customer will use, the angle they’ll scan from.
  • Avoid complex center logos beyond ~20% of the code area. If you need branding, put it below the code, not inside.
  • Don’t reuse URLs. A QR code on thousands of printed items that points at a URL you might change is a liability. Use a redirector you control so the destination can change without reprinting.

Our QR Code Generator exposes all the parameters — size, error correction level, encoding mode — and runs entirely in the browser, so the URLs you encode aren’t uploaded anywhere.

Specialized QR codes

Wi-Fi QR codes encode SSID and password in a specific format (WIFI:S:<ssid>;T:<auth>;P:<password>;;). A phone camera reading this code will offer to join the network directly. This is genuinely the nicest way to share a guest password — type once, print, done. Our Wi-Fi QR Code Generator handles the encoding.

vCard QR codes encode contact information (name, phone, email). Scan at an event, tap “Add to contacts.” Useful, but note that most scanners show the vCard data before adding — users see your information, which is usually fine but worth knowing.

Geo QR codes encode a latitude/longitude. Less common now that most maps apps have their own sharing.

Bulk generation for things like asset tags or event tickets: our Bulk QR Code Generator takes a list of URLs and generates them all at once with consistent sizing and error correction.

Reading a QR code

For reading, modern phone cameras have QR scanning built in. The camera app usually handles it automatically — no third-party app needed.

For programmatic reading (say, from a scanned PDF or an image file), our QR Code Reader runs in the browser and returns the decoded content. This is useful when you’re auditing a pile of codes and need to verify they point where you expect.

The meta-point about QR codes

A QR code is a durable, offline-readable, machine-readable pointer. It’s not magic, it’s not encrypted, and anything you put in one is readable by anyone who scans it. The URL visible under the square is the URL everyone gets.

That sounds obvious, but I’ve seen QR codes on restaurant menus that point at a Google Docs URL with “Anyone with the link can comment” — anyone who scanned could leave comments on the restaurant’s operational documents. A QR code is a link, and a link is a credential when the destination expects one.

Treat QR codes the way you treat URLs: assume they’ll be scanned by anyone, printed in unexpected places, and still readable in five years. Design accordingly.

Tools mentioned in this article

  • QR Code Generator — Generate QR codes for URLs, text, email, phone and WiFi.
  • QR Code Reader — Scan and decode QR codes from any image online - upload a photo or screenshot and read the QR contents instantly in your browser.
  • WiFi QR Code Generator — Generate a QR code for your WiFi network so guests can connect by scanning.
  • Bulk QR Code Generator — Generate multiple QR codes at once from a list of URLs or text.

Related articles