QR code glossary · Encoding and capacity
Reed–Solomon error correction
Also called: Reed-Solomon code, RS code
Definition
Reed–Solomon error correction is a family of error-correcting codes, published by Irving Reed and Gustave Solomon in 1960, that QR codes use to add calculated check codewords to their data so a scanner can find and repair codewords it misread.
How it works
Reed–Solomon codes work on whole symbols rather than single bits. In a QR code each symbol is an 8-bit codeword, treated as an element of a finite field with 256 values. The data codewords are read as the coefficients of a polynomial, and the error correction codewords are the remainder after dividing it by a generator polynomial. A reader recomputes that relationship; if it does not hold, the mathematics locates the wrong codewords and their correct values.
A block with n − k error correction codewords can correct up to (n − k) ÷ 2 codewords whose positions are unknown, or up to n − k whose positions are known. Because a codeword is wrong whether one of its bits flipped or all eight did, the method suits burst damage, such as a scratch or a smudge, that wrecks a small area completely.
Larger codes split their data into several blocks, each with its own error correction, up to 81 blocks for version 40 at level H. The codewords of all blocks are interleaved across the symbol, so a local stain spreads its damage thinly over many blocks instead of overwhelming one.
Why it matters
Reed–Solomon coding is what lets a QR code survive wear, glare, a fold, or a logo placed over its center. It is the same family of codes used on CDs and DVDs, by deep-space probes such as Voyager, and in other 2D barcodes such as Data Matrix.
The budget is finite, and the error correction level sets it. When damage exceeds it, a well-built decoder reports a failure rather than returning wrong text. The standard sets aside a few codewords in the smallest codes purely to detect such misreads. The QR code’s small fixed fields use a different code: format information is protected by a BCH code.
Example
A version 1 code at level H has 26 codewords: 9 for data and 17 for error correction. That lets a scanner correct up to 8 misread codewords, about 30% of the code, which is where level H’s figure comes from.
Related terms
- Error correction levelAn error correction level is the setting, L, M, Q or H, that decides how much redundant data a QR code carries; the four levels let a scanner restore roughly 7%, 15%, 25% and 30% of the code’s codewords when they are damaged, dirty or covered.
- Data capacityData capacity is the most content a QR code can hold, which depends on its version, error correction level and encoding mode; the largest code, version 40 at level L, holds 7,089 numeric digits, 4,296 alphanumeric characters, 2,953 bytes or 1,817 kanji characters.
- Logo in a QR codeA logo in a QR code is an image placed over part of the pattern, usually the center, which works because Reed–Solomon error correction can rebuild the modules the logo hides, provided the logo stays within the correction budget and clear of the finder patterns.
- Format informationFormat information is a 15-bit field printed twice in every QR code, beside the finder patterns, that tells the scanner which error correction level and which mask pattern the code uses, so it can be read before any of the data.
- 2D barcodeA 2D barcode is a barcode that stores data across both the width and the height of its pattern, unlike a 1D (linear) barcode such as a UPC, which stores a short number in the widths of its bars; QR codes, Data Matrix, Aztec and PDF417 are all 2D barcodes.
Learn more
- QR code error correction levels explained: How the levels change density, with real examples.
Sources
Last updated . Written by the CirculateQR team; technical facts follow the sources listed above. Example codes and sizes are computed with the open-source qrcode encoder that CirculateQR uses. Spotted something wrong? Email support@circulateqr.com. QR Code is a registered trademark of DENSO WAVE INCORPORATED.
← Browse the full glossary