How QR codes work
A QR code (Quick Response code) is a two-dimensional barcode that encodes data as a pattern of black and white modules arranged in a square grid. Unlike a traditional 1D barcode that can only hold ~20 characters, a QR code can encode up to 3,000+ bytes of data depending on the version and error correction level.
QR codes use Reed-Solomon error correction, a mathematical technique that allows the code to be decoded even if part of it is obscured, dirty, or damaged. Each QR code also has three distinctive finder patterns — the large squares in three corners — that allow scanners to locate and orient the code regardless of the angle it is scanned from.
Versions and data capacity
QR codes come in 40 versions, numbered 1–40. Higher versions have more modules (the black and white squares) and can store more data. Version 1 is a 21×21 grid; version 40 is a 177×177 grid. As data length increases, the generator automatically selects the appropriate version.
| Data type | Max capacity (version 40, low error correction) |
|---|---|
| Numeric only (0–9) | 7,089 characters |
| Alphanumeric (0–9, A–Z, symbols) | 4,296 characters |
| Binary / UTF-8 text | 2,953 bytes |
| Kanji characters | 1,817 characters |
In practice, keep QR code content short. Long URLs and dense data produce high-version codes with many tiny modules that are harder to scan reliably, especially when printed small.
Error correction levels
QR codes have four error correction levels that trade data capacity for damage tolerance:
- L (Low) — 7% of data can be restored. Best for clean, high-resolution digital displays where damage is unlikely.
- M (Medium) — 15% of data can be restored. Good default for general use.
- Q (Quartile) — 25% of data can be restored. Good for industrial or outdoor use where codes may get dirty.
- H (High) — 30% of data can be restored. Required when embedding a logo in the center of the code, since the logo obscures part of the data.
Common use cases
WiFi sharing
Encode a WiFi network in the format WIFI:T:WPA;S:NetworkName;P:Password;; and guests can connect without typing the password. iOS 11+ and Android 10+ decode these natively.
WhatsApp direct link
The WhatsApp link format is https://wa.me/PHONENUMBER where the phone number includes the country code without the leading + or spaces. For example, https://wa.me/6281234567890 opens a chat with a number in Indonesia. You can optionally pre-fill a message: https://wa.me/6281234567890?text=Hello%2C+I+have+a+question.
Other common uses
- App download pages — link directly to the App Store or Play Store listing
- Event check-in — encode a ticket ID or registration confirmation
- Business cards — encode a vCard with contact details
- Payment links — encode a payment URL for contactless transactions
- Restaurant menus — link to a PDF or web menu to avoid printed menus
Best practices
- Always test before printing — scan the generated code with multiple devices before committing to print.
- Add quiet zone — QR codes need a margin of whitespace (the "quiet zone") around them, at least 4 modules wide, to be reliably detected.
- Use high error correction for logos — if you overlay a logo on the QR code, use H-level error correction so the obscured modules can be reconstructed.
- Prefer short URLs — long URLs create dense, high-version codes. A URL shortener keeps the code simple and scannable.
- Check contrast — dark modules on a light background is standard. Inverted (light on dark) codes are not supported by all scanners.