How QR Codes Work - A Technical Deep Dive
The QR code (Quick Response code) was invented in 1994 by Denso Wave, a subsidiary of Toyota, to track automotive parts during manufacturing. Unlike traditional one-dimensional barcodes that store data in a single row of varying-width bars, QR codes are two-dimensional matrix codes that encode information in both horizontal and vertical directions. This fundamental design difference allows QR codes to store dramatically more data in a smaller physical space while remaining readable even when partially damaged.
Every QR code is built from several structural components that work together to ensure reliable scanning. The three large squares in the corners are called finder patterns, and they allow any scanner to instantly detect the code's position, size, and orientation regardless of the angle at which the code is viewed. Alignment patterns (smaller squares found in larger QR versions) compensate for image distortion when scanning from curved surfaces. Timing patterns, the alternating black-and-white modules running between finder patterns, establish the coordinate system that maps every data module's exact position. The remaining area contains format information (error correction level and mask pattern), version information (for versions 7 and above), and the actual data and error correction codewords encoded using Reed-Solomon error correction.
QR codes support four error correction levels defined by the ISO/IEC 18004 standard: Level L recovers up to 7% of damaged data, Level M recovers 15%, Level Q recovers 25%, and Level H recovers up to 30%. Higher error correction means more redundant data modules, which reduces the total amount of user data the code can hold but makes the code far more resilient. Data is encoded using one of four modes depending on the content: Numeric mode (digits 0-9) is the most efficient at roughly 3.3 bits per character, Alphanumeric mode handles uppercase letters, digits, and a few symbols at about 5.5 bits per character, Byte mode encodes any ISO 8859-1 character at 8 bits each, and Kanji mode encodes double-byte Japanese characters at 13 bits per character.
QR Codes vs Traditional Barcodes
Traditional one-dimensional barcodes (UPC, EAN, Code 128) store data in a single horizontal row of varying-width bars and spaces. They typically hold between 20 and 25 characters of numeric or alphanumeric data. QR codes, by contrast, are two-dimensional matrix codes that encode data across both axes, enabling them to store up to 7,089 numeric characters, 4,296 alphanumeric characters, or 2,953 bytes of binary data at the largest version (Version 40, 177x177 modules). This represents a capacity increase of over 100x compared to standard barcodes.
One of the most significant advantages of QR codes is their built-in Reed-Solomon error correction, which allows data recovery even when a portion of the code is damaged, obscured, or dirty. Traditional barcodes have no such capability; a single scratch across the bars can render the entire code unreadable. Additionally, QR codes support omnidirectional scanning, meaning they can be read from any angle or orientation thanks to the three finder patterns. Barcodes must be scanned in a specific horizontal alignment, which slows down the scanning process.
The QR code standard is governed by ISO/IEC 18004, which defines 40 versions ranging from Version 1 (21x21 modules) to Version 40 (177x177 modules). Each version increase adds 4 modules per side and significantly increases data capacity. The standard also defines mask patterns that prevent large areas of uniform color, ensuring reliable scanning across different lighting conditions and surface materials. While barcodes remain dominant in retail point-of-sale scanning due to legacy infrastructure, QR codes have become the preferred choice for mobile-first applications, marketing, logistics tracking, and any use case requiring high data density.
QR Code Versions and Data Capacity
The following table shows the data capacity for selected QR code versions at Error Correction Level M (15%):
| Version |
Modules |
Numeric Capacity |
Alphanumeric Capacity |
Byte Capacity |
| 1 | 21 x 21 | 34 | 20 | 14 |
| 5 | 37 x 37 | 202 | 122 | 84 |
| 10 | 57 x 57 | 652 | 395 | 271 |
| 15 | 77 x 77 | 1,250 | 758 | 520 |
| 20 | 97 x 97 | 2,061 | 1,249 | 858 |
| 25 | 117 x 117 | 2,875 | 1,743 | 1,197 |
| 30 | 137 x 137 | 3,797 | 2,303 | 1,582 |
| 40 | 177 x 177 | 5,313 | 3,222 | 2,214 |