How Do QR Codes Work? The Technology Behind the Square

QR codes are everywhere — restaurant menus, product packaging, boarding passes, payment terminals — but surprisingly few people understand what is actually happening when a phone camera reads one. The technology is more elegant than it looks, and understanding the basics helps you make better decisions about how to create, print, and deploy QR codes.
A QR code is not a simple barcode rotated into two dimensions. It is a self-contained data storage system with built-in error correction, positioning markers, and encoding logic designed for instant machine reading. The entire system was invented in 1994 by a single engineer at a Japanese auto parts company, and the core technology has not fundamentally changed since — it just became an open standard that anyone can use.
Summary: QR codes store data in a two-dimensional grid of black and white modules using Reed-Solomon error correction. Each code contains positioning patterns (the three large squares in corners), alignment patterns, timing patterns, format information, and the encoded data itself. The system supports four encoding modes (numeric, alphanumeric, byte, and kanji) across 40 version sizes, storing from 7 to 4,296 characters depending on configuration. This guide explains how the encoding, error correction, and scanning process work at a practical level.
The Anatomy of a QR Code
Every QR code contains the same structural elements, regardless of what data it encodes. Understanding these elements explains why QR codes look the way they do.
Finder Patterns (The Three Big Squares)
The three large square patterns in the top-left, top-right, and bottom-left corners are finder patterns. They serve one purpose: helping the scanner locate and orient the code instantly, regardless of the scanning angle.
Each finder pattern is a 7×7 module square with a specific ratio (dark-light-dark = 1:1:3:1:1) that is unique enough to be distinguished from any actual data pattern. The scanner identifies these three corners to determine the code's position, size, and rotation. This is why QR codes can be scanned at any angle — even upside down — as long as all three finder patterns are visible.
The bottom-right corner intentionally has no finder pattern. This asymmetry tells the scanner which way the code is oriented.
Alignment Patterns
Larger QR codes (Version 2 and above) include one or more smaller square patterns called alignment patterns. These help the scanner compensate for distortion — when a QR code is printed on a curved surface, photographed at an angle, or wrinkled on a piece of paper.
A Version 2 code has one alignment pattern. Larger versions have more. A Version 40 code (the largest standard size) has 46 alignment patterns distributed across the grid.
Timing Patterns
The alternating black-and-white lines connecting the finder patterns are timing patterns. They help the scanner determine the width of individual modules and establish the coordinate system for reading the data.
Quiet Zone
The blank margin around the entire code is the quiet zone — a minimum 4-module-wide border that separates the code from its surroundings. Without this margin, the scanner may include adjacent graphics or text as part of the code, causing scan failures. This is one of the most common printing mistakes: cropping the QR code too tightly or placing it flush against other design elements.
Data and Error Correction Modules
Everything else in the QR code — the seemingly random pattern of black and white squares — is the actual encoded data mixed with error correction information. The data is not stored in a simple left-to-right, top-to-bottom sequence. Instead, it follows a specific path that zigzags through the code in 2-module-wide columns, which optimizes redundancy distribution.
How Data Encoding Works
QR codes support four encoding modes, each optimized for different types of data:
| Mode | Characters Supported | Bits per Character | Best For |
|---|---|---|---|
| Numeric | 0-9 | 3.33 | Phone numbers, IDs |
| Alphanumeric | 0-9, A-Z, space, $ % * + - . / : | 5.5 | Short URLs, codes |
| Byte (ISO 8859-1) | Full ASCII + Latin-1 | 8 | URLs, text, email |
| Kanji | Japanese kanji characters | 13 | Japanese text |
The encoding mode affects how much data a QR code can hold. A Version 10 code (57×57 modules) at medium error correction can store:
- 652 numeric digits, or
- 395 alphanumeric characters, or
- 271 byte-mode characters (typical URL length)
Most QR codes you encounter use byte mode because URLs contain lowercase letters and special characters that alphanumeric mode does not support.
Why Shorter URLs Make Better QR Codes
The amount of data encoded directly affects the code's complexity. More data requires a higher version (larger grid), which means more modules, which means each individual module is smaller at the same print size.
A URL like example.com/menu (19 characters) produces a Version 2 code with 25×25 modules — clean and scannable even at small sizes. A URL like example.com/restaurant/locations/downtown/seasonal-menu?utm_source=qr&utm_medium=print&utm_campaign=spring_2026 (113 characters) produces a Version 8 code with 49×49 modules — nearly four times as dense.
For printed QR codes, keeping the encoded data short improves scannability, especially at smaller print sizes. URL shorteners or dynamic QR codes (which use short redirect URLs) help keep the code compact.
Error Correction: How Damaged Codes Still Scan
One of the most practical features of QR codes is Reed-Solomon error correction — the ability to reconstruct data even when part of the code is damaged, obscured, or missing.
There are four error correction levels:
| Level | Recovery Capacity | Data Overhead | When to Use |
|---|---|---|---|
| L (Low) | ~7% | Minimal | Digital display only, no damage risk |
| M (Medium) | ~15% | Moderate | Default — suitable for most print uses |
| Q (Quartile) | ~25% | Significant | Logo overlay, partial obstruction expected |
| H (High) | ~30% | Maximum | Heavy customization, harsh environments |
Higher error correction means the code can survive more damage, but it also means more of the code's capacity is used for redundancy rather than data. A code using level H stores roughly 40% less data than the same version at level L.
This is what makes logo embedding possible. When you place a logo in the center of a QR code, you are deliberately destroying some of the data modules. The error correction algorithm compensates — as long as the destroyed area does not exceed the correction level's capacity. Using level Q or H for codes with logos is standard practice.
Want to follow along? Create a QR Code Generator now
It's free to start. Upgrade to $15 lifetime when you need editable dynamic QR codes.
How Scanning Works
When a phone camera reads a QR code, the process happens in milliseconds:
Detection: The camera or image processing software identifies the three finder patterns and calculates the code's position, size, and rotation angle.
Grid extraction: Using the finder patterns, alignment patterns, and timing patterns, the scanner establishes a grid over the image and determines the position of every module (black or white).
Format decoding: A small section of the code near the finder patterns contains format information — the error correction level and a data mask pattern number. This tells the scanner how to interpret the rest of the data.
Mask removal: QR codes apply a mask pattern over the data to prevent large areas of uniform color that could confuse the scanner. There are eight standard mask patterns. The scanner reads the mask pattern number from the format information and reverses the mask to reveal the raw data.
Error correction: The scanner applies the Reed-Solomon algorithm to check for and correct any errors in the raw data. If the damage exceeds the correction capacity, the scan fails.
Data decoding: The corrected data stream is decoded according to the encoding mode (numeric, alphanumeric, byte, or kanji) and presented to the user — typically as a URL that the phone offers to open.
The entire process takes 50-200 milliseconds on modern smartphones. The limiting factor is usually not the scanning software but the camera's ability to focus on the code, which is why QR codes sometimes take a moment to register when held too close or in poor lighting.
QR Code Versions: Size and Capacity
QR codes come in 40 versions, from Version 1 (21×21 modules) to Version 40 (177×177 modules). Each version adds 4 modules in each dimension.
| Version | Grid Size | Max Characters (Byte Mode, Level M) | Typical Use |
|---|---|---|---|
| 1 | 21×21 | 14 | Very short text |
| 2 | 25×25 | 32 | Short URL |
| 5 | 37×37 | 106 | Standard URL |
| 10 | 57×57 | 271 | Long URL with parameters |
| 20 | 97×97 | 858 | Large text block |
| 40 | 177×177 | 2,953 | Maximum capacity |
Most QR codes in everyday use are between Version 2 and Version 10. Versions above 20 are rare because the resulting code is too dense for reliable scanning at normal print sizes.
The version is chosen automatically by the QR code generator based on the amount of data and the selected error correction level. You do not need to specify a version manually — just provide the data and the generator selects the smallest version that fits.
The Standard Behind It All: ISO/IEC 18004
QR codes are governed by the international standard ISO/IEC 18004, first published in 2000 and updated most recently in 2015. The standard defines every aspect of the code: module placement, encoding modes, error correction algorithms, finder pattern ratios, and masking patterns.
Because the standard is open and free to implement, anyone can create a QR code generator or scanner without licensing fees. This openness is why QR codes became ubiquitous — unlike some proprietary 2D barcode formats, there is no cost barrier to adoption.
The original inventor, Masahiro Hara at Denso Wave (a Toyota subsidiary), developed QR codes in 1994 to track automotive parts during manufacturing. Denso Wave holds the patent but chose not to enforce it, allowing free use of the technology worldwide. This decision is arguably the single most important reason QR codes succeeded where competing 2D barcode formats did not.
Frequently Asked Questions
How much data can a QR code store?
A QR code can store up to 7,089 numeric digits, 4,296 alphanumeric characters, or 2,953 bytes of binary data at the lowest error correction level (Level L) using the maximum Version 40 size. In practice, most QR codes store URLs of 20-100 characters, which fit comfortably in a Version 3-8 code with medium error correction. The more data you encode, the denser and larger the code becomes.
Why do QR codes have three squares in the corners?
The three squares (finder patterns) enable the scanner to detect the code's position, size, and orientation instantly from any angle. The specific 1:1:3:1:1 ratio of dark-to-light modules in each square is unique enough that the scanner can distinguish finder patterns from data patterns. The asymmetry (three corners, not four) tells the scanner which way the code is oriented.
Can a QR code work if part of it is damaged?
Yes, thanks to Reed-Solomon error correction. Depending on the error correction level, a QR code can lose 7% (Level L) to 30% (Level H) of its modules and still scan correctly. This is how logo embedding works — the logo covers some modules, and the error correction algorithm compensates. If the damage exceeds the correction capacity, the scan will fail.
What is the difference between a static and dynamic QR code?
A static QR code encodes the destination URL directly into the code pattern. It works forever without any server dependency but cannot be changed after creation. A dynamic QR code encodes a short redirect URL that points to a server, which forwards to the final destination. The server allows the destination to be changed without modifying the printed code. The underlying QR code technology is identical — the difference is in what URL is encoded.
Why do some QR codes scan faster than others?
Scanning speed depends on three factors: code size (larger codes are detected faster by the camera), code complexity (simpler codes with fewer modules decode faster), and environmental conditions (good lighting and contrast enable faster focusing). A clean, well-printed Version 3 code on a white background scans almost instantly. A small, dense Version 15 code on a dark background under dim lighting may take several attempts.
- Special QR Codes: Types, Variants, and Advanced Use Cases - GLOBAL DEI: 82.5
- How to Program a QR Code: A Complete 2026 Guide - GLOBAL DEI: 82.5
- QR Code Example: A Complete Guide for 2026 - GLOBAL DEI: 82.5
Tags
Frequently Asked Questions
How much data can a QR code store?
A QR code can store up to 7,089 numeric digits, 4,296 alphanumeric characters, or 2,953 bytes of binary data at the lowest error correction level (Level L) using the maximum Version 40 size. In practice, most QR codes store URLs of 20-100 characters, which fit comfortably in a Version 3-8 code with medium error correction. The more data you encode, the denser and larger the code becomes.
Why do QR codes have three squares in the corners?
The three squares (finder patterns) enable the scanner to detect the code's position, size, and orientation instantly from any angle. The specific 1:1:3:1:1 ratio of dark-to-light modules in each square is unique enough that the scanner can distinguish finder patterns from data patterns. The asymmetry (three corners, not four) tells the scanner which way the code is oriented.
Can a QR code work if part of it is damaged?
Yes, thanks to Reed-Solomon error correction. Depending on the error correction level, a QR code can lose 7% (Level L) to 30% (Level H) of its modules and still scan correctly. This is how logo embedding works — the logo covers some modules, and the error correction algorithm compensates. If the damage exceeds the correction capacity, the scan will fail.
What is the difference between a static and dynamic QR code?
A static QR code encodes the destination URL directly into the code pattern. It works forever without any server dependency but cannot be changed after creation. A dynamic QR code encodes a short redirect URL that points to a server, which forwards to the final destination. The server allows the destination to be changed without modifying the printed code. The underlying QR code technology is identical — the difference is in what URL is encoded.
Why do some QR codes scan faster than others?
Scanning speed depends on three factors: code size (larger codes are detected faster by the camera), code complexity (simpler codes with fewer modules decode faster), and environmental conditions (good lighting and contrast enable faster focusing). A clean, well-printed Version 3 code on a white background scans almost instantly. A small, dense Version 15 code on a dark background under dim lighting may take several attempts.
Ready to own your QR codes?
One-time $15 for lifetime dynamic QR codes.
Competitors charge $120-300/year for the same features.
30-day money back guarantee