QR Codes Are Not Just Fancy Barcodes. Here Is How They Actually Work.
A QR code is not a barcode with squares. The visual resemblance to a traditional barcode is superficial. A traditional barcode encodes around 20 numbers in a series of parallel lines. A QR code encodes up to 4,296 alphanumeric characters in a two-dimensional grid. The structural difference between them is not just capacity but an entirely different approach to encoding, error correction, and decoding, one that was specifically designed to work in hostile real-world conditions where barcodes frequently fail.
The QR code was invented by a team at Denso Wave, a Toyota subsidiary, in 1994. Masahiro Hara led the development project. The specific problem his team was solving was the inefficiency of tracking automotive components in manufacturing. A car has hundreds of parts, each needing to be tracked through assembly. Traditional barcodes required the scanner to be precisely aligned with the barcode. In a busy manufacturing environment where workers were scanning hundreds of parts per hour, precise alignment was impractical. Denso needed a code that could be scanned from any orientation at high speed.
Finder Patterns, Timing Patterns, and How the Scanner Locates the Code
The three large square patterns in the corners of every QR code, the finder patterns, are the most distinctive visual feature and also one of the most important functional ones. They allow the scanner to locate the code regardless of orientation, rotation, or viewing angle. The specific ratio of black and white modules in a finder pattern is 1:1:3:1:1, which is extremely rare in real-world visual environments. A scanner searching an image for this ratio can locate a QR code even when the code is tilted at 45 degrees, reflected in a mirror, or partially obscured.
The timing patterns, alternating black and white modules running between the finder patterns, allow the scanner to calculate how many modules the code contains and what the grid spacing is, even on an imperfectly reproduced code where the modules are slightly uneven.
The data in a QR code is stored in the remaining modules using a specific encoding scheme. QR codes support four data modes: numeric (0-9 only, most efficient per module), alphanumeric (0-9, A-Z, and nine symbols), binary (arbitrary byte values, including any characters), and kanji (Japanese character encoding). A URL like https://toolhq.app uses alphanumeric mode. A UTF-8 encoded message uses binary mode.
The modules are read in a specific path: from the bottom-right corner, moving in a zigzag pattern toward the top, then shifting two columns left and repeating. This path avoids the finder patterns and other functional patterns, which are in fixed positions.
Reed-Solomon Error Correction: Why QR Codes Survive Damage
The single most important design decision in QR codes is the error correction system. QR codes use Reed-Solomon error correction, a mathematical algorithm developed by Irving Reed and Gustave Solomon in 1960 and first described in a landmark paper in the Journal of the Society for Industrial and Applied Mathematics. Reed-Solomon is used in CDs, DVDs, Blu-ray, space communications, and QR codes. It allows the receiver to detect and correct errors that occur in the data.
QR codes implement error correction at four levels, designated L, M, Q, and H. Level L allows up to 7 percent of the code modules to be damaged or unreadable. Level H allows up to 30 percent damage. A QR code at level H can be physically damaged, obscured by a logo or decorative graphic placed in the center, or partially torn, and still decode correctly.
This is why QR codes can have logos placed on them. The central region of a QR code does not contain functional patterns and can be used for branding. As long as the logo covers less than the error correction budget allows, typically 30 percent or less of the total modules, the code remains scannable. QR codes with logos in the center use the highest error correction level (H) to ensure the logo does not consume more error correction capacity than is available.
The size of a QR code is specified in versions, numbered 1 through 40. Version 1 is the smallest, a 21-by-21 module grid. Version 40 is the largest, a 177-by-177 module grid capable of storing 4,296 alphanumeric characters or 2,953 bytes of binary data. As data increases, the version number increases and the code becomes physically larger or visually denser.
Mask Patterns and the Scanning Process
QR codes encode information about themselves in the format pattern and version information fields. The format information specifies the error correction level and the mask pattern. The mask pattern is one of eight predetermined patterns XORed with the data modules to prevent large uniform areas of all-black or all-white modules, which would confuse the scanner. The mask pattern that produces the best balance of black and white is selected automatically by the encoder.
The actual scanning process in a smartphone camera involves several steps: detecting the finder patterns in the camera frame, perspective-correcting the image to account for the angle of capture, reading the format information, applying the inverse mask, reading the data modules in the prescribed order, applying Reed-Solomon error correction, and decoding the data according to the specified mode. This entire process runs at camera frame rate, typically 30 or 60 frames per second, which is why QR codes appear to scan instantly.
URLs are the most common QR code content today, largely because of COVID-19 contact tracing and restaurant menu applications that drove mass adoption of QR code scanning in 2020 and 2021. Before 2020, QR codes had been declared dead by several technology commentators who noted their low adoption in Western markets. The pandemic made them ubiquitous within months.
Conclusion
A QR code contains a self-describing, error-corrected, orientation-independent data structure that can be scanned from any angle, withstand significant physical damage, and store thousands of characters in a space smaller than a postage stamp. The 1994 automotive manufacturing problem that produced them turned out to apply to nearly everything.
The QR Code Generator at ToolHQ creates QR codes for URLs, text, email addresses, phone numbers, and WiFi credentials. Generate and download instantly, no account required.
Frequently Asked Questions
Why do QR codes have three squares in the corners?
The squares are finder patterns. Their unique module ratio (1:1:3:1:1) allows scanners to locate the code regardless of orientation, rotation, or viewing angle.
Why can QR codes have logos in the middle?
Reed-Solomon error correction allows up to 30% of the code to be damaged or obscured (at Level H) and still decode correctly. Logos use this error correction budget.
How much data can a QR code store?
Up to 4,296 alphanumeric characters or 7,089 numeric characters in the largest version (40). Version 1, the smallest, holds only 41 numeric characters.
Why did QR codes suddenly become popular during COVID-19?
Contact tracing apps and touchless restaurant menus needed a way for phones to access URLs without typing. The pandemic created mass adoption of smartphone QR scanning within months.
Try These Free Tools
What Is My IP
Find your public IP address, location, ISP, and other network information instantly.
PDF Password Protect
Add password protection to PDF files to prevent unauthorized access. Set open and permissions passwords.
PNG to JPG Converter
Convert PNG images to JPG format to reduce file size while maintaining good visual quality.