Guide

QR code encoding modes

A QR code stores text in one of four main modes. Numeric packs digits most tightly. Alphanumeric covers digits, uppercase letters and nine symbols. Byte mode handles everything else, including lowercase and UTF-8. Kanji mode stores Japanese characters. The narrower the character set, the fewer bits each character costs, and the smaller the code.

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.

ModeCharactersCostIndicator
Numeric0–910 bits per 3 digits0001
Alphanumeric0–9, uppercase A–Z, space, $ % * + - . / : (45 in all)11 bits per 2 characters0010
ByteAny byte, so lowercase, punctuation and UTF-8 text8 bits per byte0100
KanjiJapanese kanji and kana (Shift JIS)13 bits per character1000

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:

ModeVersions 1–9Versions 10–26Versions 27–40
Numeric10 bits12 bits14 bits
Alphanumeric9 bits11 bits13 bits
Byte8 bits16 bits16 bits
Kanji8 bits10 bits12 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.

PayloadSegmentsBitsVersion
https://example.com/menu/todaybyte (30)2523
HTTPS://EXAMPLE.COM/MENU/TODAYalphanumeric (30)1782
tel:+919876543210byte tel:+, then numeric 9198765432101061
WIFI:T:WPA;S:Cafe Guest;P:espresso-2024;;alphanumeric WIFI:T:WPA, then byte for the rest3283

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.

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.

Written by Last updated