User Rating 0.0
Total Usage 0 times
0 / 2953 bytes
10px
Your QR code will appear here
Is this tool helpful?

Your feedback helps us improve.

About

QR codes encode data into a two-dimensional matrix of dark and light modules readable by optical scanners. The encoding process involves selecting the optimal data mode (Numeric, Alphanumeric, or Byte), generating Reed-Solomon error correction codewords over the Galois field GF(28), and applying one of eight mask patterns to minimize decoding errors. A misconfigured error correction level or an oversized payload silently produces an unscannable image. This tool implements the full ISO/IEC 18004 pipeline client-side: mode analysis, polynomial division for ECC, format and version bit encoding via BCH codes, and penalty-based mask optimization. It handles payloads up to version 40 (177×177 modules), supporting up to 2953 bytes at error correction level L.

Pro tip: for printed materials, use error correction level Q or H. Physical damage from weather, folds, or partial obstruction can destroy up to 30% of codewords at level H and the code remains scannable. For digital-only use (screens, PDFs), level L maximizes data density. Note: this tool approximates visual output. Actual scannability depends on print resolution, contrast ratio, and scanner quality. Always test generated codes with at least two different reader applications before production use.

qr code generator text to qr qr code maker create qr code qr code online qr png download

Formulas

QR codes use Reed-Solomon error correction over the Galois field GF(28) with the irreducible polynomial p(x) = x8 + x4 + x3 + x2 + 1 (value 0x11D). The data polynomial D(x) is divided by the generator polynomial G(x) to produce error correction codewords:

R(x) = D(x) xn mod G(x)

where R(x) is the remainder (EC codewords), n is the number of EC codewords, and the generator polynomial is:

G(x) = n1i=0 (x αi)

Format information uses a 15-bit BCH(15,5) code with generator polynomial x10 + x8 + x5 + x4 + x2 + x + 1, XORed with mask 0x5412. Mask penalty is calculated across four rules: runs of same-color modules, 2×2 blocks, finder-like patterns, and dark/light ratio deviation. The mask producing the lowest total penalty score is selected.

where α is the primitive element of GF(28), D(x) = data polynomial, G(x) = generator polynomial, R(x) = remainder (error correction codewords), n = number of EC codewords per block.

Reference Data

VersionModulesEC Level L (bytes)EC Level M (bytes)EC Level Q (bytes)EC Level H (bytes)
121×211714117
225×2532262014
329×2953423224
433×3378624634
537×37106846044
641×411341067458
745×451541228664
1057×57271213151119
1577×77520412295223
2097×97858666482364
25117×1171273998718538
30137×13717321370982742
35157×157218817321246946
40177×1772953233116631273

Frequently Asked Questions

Higher error correction reserves more codewords for redundancy, reducing usable data capacity. Level L corrects ~7% errors and allows up to 2953 bytes at version 40. Level H corrects ~30% but limits capacity to 1273 bytes at the same version. For a version 1 QR code, the difference is stark: 17 bytes (L) vs 7 bytes (H). Choose L for pristine digital environments and H for physical media subject to damage.
The error correction level changes the number of Reed-Solomon codewords appended to the data. This may also change the QR version (size) needed. A 50-character URL might fit in a version 3 code at level L but require version 4 at level H, producing a larger matrix. The mask pattern selection may also differ because penalty scores change with the additional modules.
The generator analyzes the input content. Pure digits (0-9) use Numeric mode: 10 bits per 3 characters. Uppercase letters, digits, and 9 special characters use Alphanumeric mode: 11 bits per 2 characters. All other content (lowercase, Unicode) falls back to Byte mode (ISO 8859-1): 8 bits per character. Mixed content uses Byte mode for the entire payload. This is why "HELLO" produces a smaller code than "hello".
Each module should be at least 0.33mm (about 1/76 inch) for reliable scanning. A version 2 code (25×25 modules) needs a minimum print size of approximately 8.25mm. For outdoor or distance scanning, modules should be 1-2mm minimum. The quiet zone (4-module white border) is mandatory per ISO 18004. Without it, many scanners fail to detect the finder patterns.
Yes. QR scanners rely on contrast between dark and light modules. The ISO standard specifies a minimum contrast ratio. Inverting colors (light foreground on dark background) fails on many older scanners. Using colors with similar luminance values (e.g., red foreground on green background) also fails. Rule of thumb: maintain at least 40% luminance difference between foreground and background. This tool defaults to black on white for maximum compatibility.
After data placement, 8 mask patterns are evaluated. Each XORs data modules with a geometric pattern. The generator scores each mask across 4 penalty rules: consecutive same-color runs (N1), 2×2 same-color blocks (N2), patterns resembling finder patterns (N3), and deviation from 50% dark ratio (N4). The mask with the lowest total penalty is selected. A poor mask can create large uniform areas or false finder patterns, causing scanner confusion.