How QR Codes Work and When to Use Them (vs Barcodes, NFC, and Links)
QR codes are everywhere now, but most people do not know how they work or when to use them over a regular barcode. This guide covers the structure, the error correction, the right size, and the practical design rules.
A QR code is a 2D barcode that can store up to ~3 KB of text in a square grid of black and white modules. The three squares in the corners let the scanner detect the code’s orientation and size; the rest encodes the data with Reed-Solomon error correction that can recover the data even if 7–30% of the modules are damaged. Use QR codes for short payloads (URLs, contact cards, Wi-Fi credentials, ticket IDs) that you want a phone camera to scan without an app. For longer data, larger inventories, or 1D-only scanners, use a traditional barcode instead.
QR codes have gone from "obscure Japanese invention used in factories" to "every restaurant menu, parking meter, and boarding pass" in about a decade. The format is well-designed, surprisingly resilient, and easy to generate — but most people do not know how they actually work, what they are good for, and what their limits are. This guide covers the structure of a QR code, the error correction that lets a damaged one still scan, the practical design rules (size, contrast, quiet zone), and when a QR code is the right tool vs. when you should reach for a regular barcode or NFC instead.
What a QR code actually is
A QR code is a two-dimensional barcode: a square grid of black and white modules (the dots) that encodes data in both the horizontal and vertical direction. The original QR specification was published by Denso Wave, a Japanese automotive supplier, in 1994, originally to track parts during manufacturing. The format is now an ISO standard (ISO/IEC 18004) and is in the public domain — anyone can implement it without paying royalties, which is part of why it is everywhere.
The structure has three parts:
- Finder patterns — the three nested squares in three corners (top-left, top-right, bottom-left). They let the scanner detect the code's orientation and size in a single frame, no matter how the phone is rotated.
- Alignment and timing patterns — smaller markers that help the scanner correct for skew and perspective distortion. A code printed on a curved surface still scans because of these.
- Data area — the rest of the grid, where the actual payload is encoded. Each module represents a single bit (black = 1, white = 0), and the bits are arranged to fit as much data as possible into the grid.
QR codes come in 40 versions, from 21×21 modules (Version 1) up to 177×177 (Version 40). Larger versions hold more data; a Version 40 code with the lowest error correction can store about 2,953 bytes of alphanumeric text, or 7,089 numeric digits.
The error correction that makes QR codes "sticky"
The most underrated feature of QR codes is the error correction. The data is encoded with a Reed-Solomon error-correcting code, which means the data area contains not just the payload but also enough redundant information to recover the original data even if some of the modules are unreadable.
You can choose the level of error correction when you generate a code:
- L (Low, ~7% recovery) — the densest. Best when you have a clean, undamaged surface.
- M (Medium, ~15% recovery) — a good default for most uses.
- Q (Quartile, ~25% recovery) — better for codes that might get scratched, smudged, or partially obscured.
- H (High, ~30% recovery) — best for codes that will be in hostile environments (outdoor signage, industrial labels, the back of a ski lift pass).
The visual difference: higher error correction means more redundant modules, which means a denser-looking code for the same payload. A Version 10 QR code with the same URL will be visually busier at H than at L, because more of the data area is dedicated to error correction. The trade-off is real: if you need the highest reliability and can spare the size, use H; if you need a smaller code or a longer payload and trust the surface, use L or M.
This is also why QR codes with logos in the middle work. The Reed-Solomon code treats the logo as a region of damaged modules; as long as the logo does not cover more than the error-correction threshold, the original data is recoverable. A 25% level allows a logo covering up to a quarter of the data area; 30% allows almost a third.
What you can encode
QR codes have built-in modes optimized for different data types. Choosing the right mode lets you fit more data into the same grid:
- Numeric — digits only. 7,089 digits at Version 40, lowest error correction. Used for ticket numbers, IDs.
- Alphanumeric — uppercase letters, digits, and a few symbols (space, $, %, *, +, -, ., /, :). 4,296 characters at Version 40. Used for short codes and reference numbers.
- Byte — any 8-bit data, default for UTF-8 text. 2,953 bytes at Version 40. Used for URLs, vCards, Wi-Fi credentials.
- Kanji — Japanese characters, optimized encoding. 1,817 characters at Version 40.
The mode is signaled in the code itself, so a scanner knows how to interpret the bits. Most practical uses — URLs, contact cards, Wi-Fi config — use the byte mode.
What QR codes are good for
QR codes shine in one specific situation: a person with a phone camera needs to capture a short piece of data without typing. The most common use cases:
- URLs — open a website without typing the address. The dominant use case since 2020.
- Contact cards (vCard / meCard) — add a new contact without typing the name, email, phone, and address. A QR generator can output a vCard-formatted QR code that pre-fills the add-contact form on the phone.
- Wi-Fi credentials — connect to a network without typing the SSID and password. A specific QR format encodes the SSID, password, and encryption type, and the phone's Wi-Fi settings can read it directly.
- Payment addresses — pay to a Bitcoin or other crypto address without typing a 40-character string. Some payment apps support this too.
- Two-factor setup — the QR code your authenticator app scans to set up TOTP. The QR encodes an
otpauth://URI with the secret, account name, and parameters. - Boarding passes and tickets — encoded as Aztec codes (a related 2D format) on most airline boarding passes, but QR is the standard for train, bus, and event tickets.
The unifying property: a short, machine-readable payload that a phone camera can capture instantly. If the use case fits, QR is the right answer. If the payload is longer than ~500 characters, or the user is not on a phone, or you are not trying to bridge physical-to-digital, a different tool is probably better.
What QR codes are not good for
A few things QR codes are not the right tool for, even though they are sometimes used that way:
- Long text or documents. A QR code can hold up to 2,953 bytes, but the resulting code is huge and dense. Scanning a 100-character URL is fast; scanning a 2,000-character document is slow and error-prone. For anything longer than a paragraph, the user is better off with a URL they can tap.
- Very long, recurring data. Inventory labels in a warehouse, for example, are usually 1D barcodes (UPC, Code 128) because they are smaller, cheaper to print, and faster to scan with handheld laser scanners. QR is overkill for "scan a 12-digit SKU a thousand times a day".
- Payments at point of sale. The "QR code on the merchant's screen" pattern (used widely in China, less in the West) is fine for low-value transactions but has security issues for high-value ones — a malicious QR code displayed on a screen can be replaced by an attacker. NFC (tap-to-pay) is harder to spoof and is the Western default for card-present transactions.
Design rules that matter
A QR code that does not scan is worse than no QR code. A few design rules that prevent the most common failures:
Size
The minimum scannable size depends on the distance and the scanner. A rough rule: the code should be at least 1/10 the size of the scanning distance. For a phone held 20 cm from the code, that is 2 cm. For a poster scanned from 1 m, 10 cm. For a billboard scanned from 5 m, 50 cm. Below these sizes, scanners struggle. A QR code generator that lets you set the size in pixels is useful, but always test with a real phone at the intended distance.
Quiet zone
The "quiet zone" is a 4-module-wide white border around the code. Scanners use the quiet zone to detect the code's edges and ignore surrounding graphics. Without it — for example, when the code is placed too close to other text or images — scanners fail. The quiet zone is non-negotiable; do not let a designer's instinct to "fill the space" override it.
Contrast
The code must be darker than the background, with at least 4:1 contrast (the same WCAG threshold used for large text). The classic black-on-white is the safest. Inverted (white on black) also scans, but some older scanners struggle. Colored codes (the brand color on a tinted background) look great in marketing materials but scan less reliably. Test before you ship.
Logo placement
As mentioned above, a small logo in the center is fine if you have at least 15% error correction (Q or H). The logo should not cover more than ~20% of the code's data area. The "modules under the logo" become unreadable, and the error-correction code has to recover them. Going over the threshold produces a code that looks fine but fails to scan.
Print surface
A QR code printed on a matte, non-reflective surface scans better than one on glossy paper, plastic, or metal. The reflection confuses the camera. If you have to use a glossy surface, a matte laminate solves it.
Dynamic vs static QR codes
Static QR codes encode the data directly in the modules. Dynamic QR codes encode a short URL that redirects to a destination you can change. The destination URL is fixed in the printed code; the page it points to is what changes.
Dynamic codes are useful when:
- You are printing on physical materials (a poster, a business card) and want the destination to be changeable without reprinting.
- You want to track scans (a dynamic-code service counts the scans and reports on the audience).
The downside: dynamic codes require the redirect service to stay online forever. If the service shuts down, every code printed becomes a dead link. For a long-lived print run (a poster, a permanent sign), a static code pointing to a URL you control is the more durable choice. The scan tracking is a nice-to-have; the broken links from a defunct service are a real cost.
Generating a code
A QR code generator takes the payload (a URL, text, a vCard, a Wi-Fi config) and produces an image. The best ones let you:
- Set the error-correction level (L / M / Q / H).
- Set the module size and the quiet zone.
- Export at the resolution you need (vector SVG for print, PNG for web, multiple sizes for retina displays).
- Preview the scan with a real phone before printing.
For most uses — a URL on a website, a link in a slide deck, a small code on a business card — a PNG at 300–600 pixels wide is enough. For larger prints (signage, packaging), an SVG is the right format: it scales without aliasing and prints cleanly at any size.
QR codes are a small, well-designed piece of infrastructure that punches above its weight. The format has been around for 30 years, is in the public domain, and works on every phone made in the last decade. For the right use case — short, machine-readable data that a phone camera can capture — nothing else is close. For anything else, the right tool is somewhere else, and the worst thing you can do is force a QR code into a role that does not fit.