Glossary
Encoding mode
Encoding mode is how characters are packed into bits. QR codes support numeric (3.33 bits/char), alphanumeric (5.5), byte (8) and kanji (13), and a single code can switch modes mid-stream to use the cheapest one for each run.
The four modes
| Mode | Bits per char | Character set |
|---|---|---|
| Numeric | 3.33 | 0-9 |
| Alphanumeric | 5.5 | 0-9, A-Z, space, $ % * + - . / : |
| Byte | 8 | any, UTF-8 in practice |
| Kanji | 13 | Shift-JIS double-byte |
Note what alphanumeric mode does not include: lowercase letters, ?, =, &, #,
_, ~. A single lowercase letter or query separator forces the whole segment into byte
mode.
Mode switching
A good encoder segments the input and switches modes to minimise total bits, paying a small
mode-indicator and character-count cost per switch. A serial number like ABC-123456789012
is cheaper as an alphanumeric run than as bytes.
The practical lesson
If you control the payload — a serial number, a coupon token, a short URL — restricting it to digits and uppercase makes the code materially smaller for free.
Related
- Data capacity — Data capacity is how much a QR code can hold, and it depends on three things at once: the version, the error-correction level and the encoding mode. The…
- ECI (Extended Channel Interpretation) — ECI is a mechanism for declaring which character set a QR code's byte data uses. Without it, byte mode has no declared encoding, and decoders simply guess…
- Kanji mode — Kanji mode packs Shift-JIS double-byte characters into 13 bits each instead of the 16 bits they would take in byte mode. It exists because QR codes were…