How QR Codes Work: Encoding, Decoding, and Error Correction
The technical explanation of how QR codes store and retrieve data. Error correction, modules, and capacity.
The Structure of a QR Code
A QR code is a 2D matrix of black and white modules (squares). Different zones serve different purposes:
Finder patterns: Three large squares in corners. Allow scanners to detect and orient the QR code.
Alignment patterns: Smaller squares scattered through larger QR codes. Help with distorted or curved QR codes.
Timing patterns: Alternating lines between finder patterns. Help calculate the module grid.
Format information: Error correction level and mask pattern used.
Data region: Where your actual encoded data lives.
How Data Is Encoded
Text and URLs are converted to binary data. The binary data is placed in the data region following a specific pattern. Multiple modes exist: Numeric (most efficient for numbers), Alphanumeric (letters and numbers), Byte (any ASCII character), Kanji (Japanese characters).
Error Correction: Why QR Codes Work Even When Damaged
QR codes have built-in error correction using Reed-Solomon codes. Four levels:
L (Low): Can restore 7% of data if damaged
M (Medium): 15% data recovery
Q (Quartile): 25% data recovery
H (High): 30% data recovery
This is why QR codes still scan when partially covered, scratched, or when a logo is overlaid in the centre (logos use the 30% error correction capacity).
QR Code Data Capacity
At error correction level L:
Numeric only: up to 7,089 characters
Alphanumeric: up to 4,296 characters
Binary/URL: up to 2,953 bytes
More data = more modules = larger or denser QR code.
Frequently asked questions
Why do QR codes still work when they are partially damaged?
QR codes use Reed-Solomon error correction, which allows them to recover 7-30% of corrupted data depending on the error correction level used. This is also why logos can be placed in the centre of QR codes.
Put this guide into practice with our free online tool — no signup required.
Open tool