QR Code
A QR code is a two-dimensional matrix code for information such as URLs, text, and contact data. The letters QR come from Quick Response, but the official name is QR Code. ISO/IEC 18004 defines the specification; readers still need to support the chosen format and character encoding.
🔳 Basic Structure and Characteristics
A QR code represents data using black and white modules arranged in a square matrix. Compared to 1D barcodes, QR codes provide higher density and built-in error correction.
Key Components
- 📌 Position detection patterns: three large markers used to detect orientation and position.
- 📌 Timing patterns: lines that help determine the module grid.
- 📌 Format information: stores error correction level and mask pattern.
- 📌 Data area: contains encoded data and error correction codewords.
Standards and compatibility
QR Code is standardized in ISO/IEC 18004. DENSO WAVE permits standards-compliant symbol generation and reading without a usage fee or licensing procedure, including commercial use. See trademark and usage conditions for use of the name.
Selected variants
Reader support varies by variant. Consult the developer description rather than assuming every QR scanner supports every form.
| Variant | Characteristics | Use |
|---|---|---|
| Model 1 / Model 2 | Model 1 is the original form; Model 2 is the commonly used form. | General printed or displayed codes |
| Micro QR | One finder pattern and versions M1 to M4. | Small labels and component identification |
| Frame QR | A dedicated canvas area for images or lettering. | Promotion and designed labels |
🔢 Versions and Capacity
QR codes have versions numbered 1–40; larger versions increase the number of modules and data capacity.
Capacity considerations
Capacity depends on encoding mode and error correction. For Model 2 at level M, versions 1/5/10 hold up to 34/202/513 numeric characters, 20/122/311 alphanumeric characters, 14/84/213 bytes, or 8/52/131 kanji characters in a single mode. Additional control information or mixed modes can reduce payload capacity.
🔤 Encoding Modes
QR codes support multiple encoding modes to efficiently convert data into bitstreams depending on content type.
Common modes
- ✔️ Numeric: digits 0–9 (highest density).
- ✔️ Alphanumeric: digits, uppercase letters, space and some symbols.
- ✔️ Byte: arbitrary byte sequences (e.g., UTF-8).
- ✔️ Kanji: efficient encoding for Shift JIS Kanji (used for Japanese text).
🛡️ Error Correction (ECC)
QR codes use Reed–Solomon error correction. Percentages refer to recovery relative to total codewords, not the percentage of image area that may safely be covered. Damage to finder patterns or unsuitable scanning conditions can prevent recovery.
Levels
- 🔎 L (~7%): low redundancy, more capacity.
- 🔎 M (~15%): medium level, a common default.
- 🔎 Q (~25%): higher redundancy.
- 🔎 H (~30%): highest redundancy for damaged labels.
⚙️ Generation and Implementation
QR codes can be generated by many libraries and online tools; server-side and client-side implementations are widely available.
Popular libraries
- 📚 PHP: chillerlan/php-qrcode, endroid/qr-code
- 📚 JavaScript: qrcode.js, QRCode.js
- 📚 Python: qrcode, segno
Practical tips
For ordinary Model 2 QR codes, leave an empty quiet zone of at least four modules on all four sides. Micro QR uses one finder pattern and requires a two-module quiet zone. Do not assume that all scanners support every variant. Preserve contrast and test at the intended size on target devices; error correction does not guarantee that a logo overlay is safe.
Printing and design checks
Test the final printed material at its intended size, with the devices and viewing conditions readers will use.
Check the printed result
See quiet-zone requirements and the developer FAQ.
- Leave a quiet zone of at least four modules around ordinary Model 2 codes.
- Keep strong contrast between dark modules and a light background.
- Do not calculate a safe logo area from an error-correction percentage; obscuring a pattern can prevent reading.
- Check folds, curved surfaces, glare, and scanning distance on the actual material.
- Label the destination clearly so readers can recognize the intended site before opening it.
⚠️ Security and Operational Considerations
While QR codes are data carriers, they can be abused to direct users to malicious resources. Consider UX and safeguards.
Mitigations
- 🔐 Show full URL previews in scanner apps before opening.
- 🔐 Label shortened URLs clearly.
- 🔐 Include issuer information on printed materials.
💡 Typical Use Cases
Common scenarios include website links, ticketing, payments, contact (vCard), Wi‑Fi credentials, and offline interactions.
Check specifications and usage
QR Code versions / Error correction / Micro QR / Margins / Trademark and usage