The four modes
The QR standard, ISO/IEC 18004, defines several ways of turning characters into bits. Each chunk of data starts with a 4-bit mode indicator, then a character count, then the characters.
| Mode | Characters | Cost | Indicator |
|---|---|---|---|
| Numeric | 0–9 | 10 bits per 3 digits | 0001 |
| Alphanumeric | 0–9, uppercase A–Z, space, $ % * + - . / : (45 in all) | 11 bits per 2 characters | 0010 |
| Byte | Any byte, so lowercase, punctuation and UTF-8 text | 8 bits per byte | 0100 |
| Kanji | Japanese kanji and kana (Shift JIS) | 13 bits per character | 1000 |
Leftovers cost less: a final pair of digits takes 7 bits and a lone digit 4; a lone alphanumeric character takes 6.
The character count field grows with the code's version:
| Mode | Versions 1–9 | Versions 10–26 | Versions 27–40 |
|---|---|---|---|
| Numeric | 10 bits | 12 bits | 14 bits |
| Alphanumeric | 9 bits | 11 bits | 13 bits |
| Byte | 8 bits | 16 bits | 16 bits |
| Kanji | 8 bits | 10 bits | 12 bits |
What our encoder does with real payloads
We ran a few payloads through our encoder (the open-source qrcode library) at level M and logged the segments it chose.
| Payload | Segments | Bits | Version |
|---|---|---|---|
https://example.com/menu/today | byte (30) | 252 | 3 |
HTTPS://EXAMPLE.COM/MENU/TODAY | alphanumeric (30) | 178 | 2 |
tel:+919876543210 | byte tel:+, then numeric 919876543210 | 106 | 1 |
WIFI:T:WPA;S:Cafe Guest;P:espresso-2024;; | alphanumeric WIFI:T:WPA, then byte for the rest | 328 | 3 |
The bit counts include the 4-bit indicator and the count field for each segment. Two things stand out.
The phone number and the Wi-Fi code are mixed. The encoder switched modes partway because the saving on the run outweighed the cost of a new indicator and count. You don't choose this; any decent encoder works it out.
The all-caps link dropped a whole version, from 29 × 29 to 25 × 25, because every character was in the alphanumeric set.
Should you write links in capitals?
Usually not. The scheme and domain of a web address are case-insensitive (RFC 3986), but the path often isn't: many sites treat /MENU and /menu as different pages. And ?, =, & and _ aren't in the alphanumeric set, so any link with query parameters goes back to byte mode for that part anyway.
If you control the site and have tested the uppercase address, it's a legitimate way to shrink a code. Otherwise, shorten the link.
Accents, emoji and ECI
Text outside plain ASCII goes into byte mode as UTF-8. An accented letter like é takes two bytes and most emoji take four, so they eat capacity fast. The capacity table counts bytes, not letters.
Sources disagree on how a scanner should know the bytes are UTF-8. The standard provides an ECI marker (0111) that names the character set, and without one, byte mode officially means ISO 8859-1 (Latin-1), not UTF-8. In practice most generators, ours included, leave ECI out and write UTF-8, and phone cameras read it as UTF-8.
The other special indicators you may see in a spec:
- Structured append (
0011) splits one message across up to 16 linked codes. - FNC1 (
0101,1001) marks data in GS1 or other industry formats. - Terminator (
0000) ends the data before padding.
After encoding, the bits are padded, error correction is added, and one of eight mask patterns is applied. You can watch the bits being laid down in our interactive explainer, or type into the text QR code generator and see the code grow.