QR QR Studio

technical

QR code encoding explained

Published 7 September 2026 · 8 min read

In plain language: a QR code does not store letters. It stores bits, and the encoder has four ways of turning your text into bits, each with a different price per character. Digits are cheap, capital letters are cheap, anything else costs a full 8 bits. Knowing the prices tells you why one code is bigger than another and how to make yours smaller.

The rest of this article goes into the detail. It is written for people who want to see the bits.

The shape of the data

Every QR code’s data stream is a list of segments. Each segment has three parts:

  1. A mode indicator, 4 bits, saying which of the four encodings follows.
  2. A character count indicator, 8 to 16 bits depending on the mode and the version, saying how many characters are in the segment.
  3. The data bits for those characters.

After the last segment comes a 4-bit terminator, 0000, and then padding to fill the space the version provides. Only then are the error-correction codewords computed and everything is placed on the grid.

ModeIndicatorCharacters allowedCost
Numeric00010 to 910 bits per 3 digits (about 3.33 a digit)
Alphanumeric00100 to 9, A to Z, space, $ % * + - . / :11 bits per 2 characters (5.5 each)
Byte0100Any byte8 bits per byte
Kanji1000Shift JIS double-byte characters13 bits per character

Four other indicators exist for special headers: 0111 for ECI, 0011 for structured append, 0101 and 1001 for FNC1. They are covered below.

What the modes cost in practice

Three examples show why the mode matters more than the character count.

  • A UK mobile number, 07700900123. Eleven digits in numeric mode: three groups of three at 10 bits each plus a final pair at 7 bits, 37 bits. In byte mode the same digits would cost 88 bits. Numeric mode is less than half the size.
  • A serial number, ABC-12345. Nine characters, all in the alphanumeric set. Four pairs at 11 bits plus one single at 6 bits, 50 bits. In byte mode, 72 bits.
  • A web address, https://getqrstudio.app/scan?c=enc. The lowercase letters and the ? and = are not in the alphanumeric set, so the whole thing is byte mode: 34 characters at 8 bits, 272 bits. The https:// prefix alone is 64 of those.

The encoder is allowed to mix modes in one code, so a smart encoder puts a long run of digits inside a URL into its own numeric segment when that saves bits. Each extra segment costs a fresh mode indicator and count, so the switch only pays for a run of about ten digits or more.

QR code encoding https://getqrstudio.app/scan?c=enc
34 characters in byte mode: 272 data bits, version 3 at level M. In capitals this address would fit version 2.

In practice

Uppercase your domain and drop the https:// if your printed context makes it obvious that the code is a link. GETQRSTUDIO.APP/SCAN?C=ENC cannot be alphanumeric because of the ? and =, but GETQRSTUDIO.APP/SCAN/ENC can, at 5.5 bits a character. Phones open a bare domain as a web address. Test the path still works in capitals before printing.

The character count indicator

The count field’s length depends on the version, because larger codes can hold more characters and need more bits to say how many.

ModeVersions 1 to 9Versions 10 to 26Versions 27 to 40
Numeric10 bits12 bits14 bits
Alphanumeric9 bits11 bits13 bits
Byte8 bits16 bits16 bits
Kanji8 bits10 bits12 bits

This is why a byte-mode message that just fits version 9 may not fit version 10 at the same character count: the count indicator grows by 8 bits at the boundary.

Worked example: HELLO, bit by bit

HELLO is five capital letters, all in the alphanumeric set, so the encoder picks alphanumeric mode. Aim for a version 1 code at error-correction level M, which has 16 data codewords, or 128 bits.

Step 1: mode indicator. Alphanumeric is 0010. 4 bits.

Step 2: character count. Five characters. For version 1 to 9 the alphanumeric count is 9 bits, so 5 becomes 000000101. 9 bits.

Step 3: the data. Alphanumeric mode gives each character a value: digits 0 to 9 are 0 to 9, then A is 10, B is 11 and so on to Z at 35, followed by space and the eight symbols. So H is 17, E is 14, L is 21 and O is 24. Characters are taken in pairs. Each pair becomes a single number, first value times 45 plus second value, written in 11 bits. A leftover single character is written in 6 bits.

PairArithmeticValueBits
HE17 × 45 + 1477901100001011
LL21 × 45 + 2196601111000110
O24 (single)24011000

Check the first one: 779 is 512 + 256 + 8 + 2 + 1, which in binary is 1100001011, ten digits. Padded to eleven it is 01100001011. The second: 966 is 512 + 256 + 128 + 64 + 4 + 2, or 1111000110, giving 01111000110. The single O is 24, which is 11000, padded to six bits as 011000.

Step 4: add it up. 4 + 9 + 11 + 11 + 6 = 41 bits.

0010 000000101 01100001011 01111000110 011000

Step 5: terminator and padding. Add the terminator 0000, giving 45 bits. Pad with zeros to the next byte boundary, 48 bits, or 6 codewords. Version 1-M holds 16 data codewords, so the remaining 10 are filled with the alternating pad bytes 11101100 and 00010001, which the standard specifies so the code never has a large blank stretch.

The 16 data codewords in hexadecimal are 20 2B 0B 78 CC 00 EC 11 EC 11 EC 11 EC 11 EC 11. Ten error-correction codewords are then computed from these, giving the 26 codewords that fill a version 1 grid. The masking and Reed-Solomon article picks up from there.

QR code encoding HELLO
HELLO as a version 1 code at level M. The 41 data bits use less than a third of the 128 available.

ECI and UTF-8

Byte mode stores bytes, not letters, and the standard’s default assumption for what the bytes mean is ISO-8859-1, the old Western European character set. That covers é and ü but not Greek, Cyrillic, Chinese or emoji.

The fix is an Extended Channel Interpretation header: mode indicator 0111 followed by an 8-bit ECI number. UTF-8 is ECI 26, so the header is 0111 00011010, 12 bits in total, placed before the byte segment. In practice almost every phone treats byte mode as UTF-8 whether or not the header is there, and many encoders omit it to save the 12 bits. Include it if your code will be read by industrial scanners or if the text contains anything outside ASCII and you want it to be strictly correct.

Structured append

A message too big for one code can be split across up to 16 codes. Each carries a 20-bit header: 0011, a 4-bit position (0 to 15), a 4-bit total, and an 8-bit parity byte that is the XOR of all the original data bytes, so the reader can check it has the right set. Barcode scanners in warehouses support this. Phone camera apps do not, so a public-facing code should never rely on it. If your message is that long, put it on a web page and encode the link.

FNC1 and GS1

Retail and healthcare use GS1 rules to pack several fields into one string: a product code, a batch number, an expiry date, each introduced by a numeric application identifier such as 01 or 17. A QR code holding such a string starts with FNC1 in first position, indicator 0101, which tells a compliant scanner to parse the fields. FNC1 in second position, 1001, is a rarer variant for industry-specific formats. A phone shows the raw string; a pharmacy scanner splits it into fields. If you are printing product labels for a supply chain, the GS1 Digital Link format puts the same fields into a normal web address, which both a till and a phone can use.

Common mistake

Encoding a phone number as tel:07700900123. The tel: prefix and the lowercase letters force byte mode for the whole string. That is correct and phones need the prefix, but do not then wonder why a code for eleven digits needs version 2.

The alphanumeric table, kanji arithmetic and remainder bits

The full alphanumeric table is: 0 to 9 are values 0 to 9; A to Z are 10 to 35; then space 36, $ 37, % 38, * 39, + 40, - 41, . 42, / 43 and : 44. There are 45 values, which is why pairs are combined with a factor of 45 and fit in 11 bits (45 × 45 = 2,025, under 2,048).

Numeric mode groups digits in threes, values 0 to 999 in 10 bits. A leftover two digits take 7 bits and a leftover one digit takes 4.

Kanji mode takes each two-byte Shift JIS character, subtracts 0x8140 (for characters in the range 0x8140 to 0x9FFC) or 0xC140 (for 0xE040 to 0xEBBF), then multiplies the high byte of the result by 0xC0 and adds the low byte, giving a value that fits 13 bits. This is why kanji mode costs 13 bits a character against 16 for the same character in byte mode.

After all codewords are placed, a few versions have a handful of leftover modules that do not make a full codeword: 7 remainder bits for versions 2 to 6, 3 or 4 for some higher versions. They are simply set to zero.

Try it yourself

Type HELLO, then hello, and watch the bit count and version change as the encoder is forced from alphanumeric into byte mode. Then type your own link in capitals and see what you save.

Open the capacity calculator

Frequently asked questions

Why is a QR code for a phone number so much smaller than one for a web address?

Digits use numeric mode at about 3.3 bits each. A web address has lowercase letters and punctuation, so it uses byte mode at 8 bits a character, and the https:// prefix alone costs 64 bits.

Does a QR code support emoji and accented letters?

Yes, in byte mode as UTF-8. The standard's default for byte mode is ISO-8859-1, so a strict encoder adds an ECI header saying UTF-8. Nearly every phone assumes UTF-8 anyway.

Is it worth writing a URL in capitals to get a smaller code?

Sometimes. HTTPS://EXAMPLE.ORG/ is alphanumeric and costs about 5.5 bits a character instead of 8. Domains are case-insensitive, but the path after the slash may not be, so check the page still opens.

What is structured append?

A way to split one message across up to 16 QR codes that a reader joins back together. Industrial scanners support it; phone camera apps do not, so avoid it for the public.

What is FNC1 or GS1 mode?

A flag at the start of the data saying the content follows GS1 rules for product codes, batch numbers and expiry dates. Retail and pharmacy scanners look for it; a phone just shows the text.

Related reading

Make yours in QR Studio

Unlimited static codes free, no ads, no watermark. AI design, dynamic codes and print-ready export when you need them.

Download on the App Store