# Encode HELLO WORLD by hand: a complete worked example

> HELLO WORLD encodes as an alphanumeric version 1-Q QR code: mode 0010, count 000001011, five character pairs plus a final D, a terminator and pads producing data codewords 20 5B 0B 78 D1 72 DC 4D 43 40 EC 11 EC, then thirteen Reed–Solomon check codewords, placed in a zig-zag and masked.

Source: https://useqr.app/docs/spec/encode-hello-world-by-hand · Last reviewed 2026-08-21 · UseQR is free forever, no signup.

---

## The setup

The traditional exercise: encode the string `HELLO WORLD` at error-correction level Q.
Every character is in the
[45-character alphanumeric set](/docs/spec/data-encoding-modes), and 11 alphanumeric
characters fit comfortably in **version 1-Q** (capacity: 16), so the target is a 21 × 21
symbol with **13 data codewords and 13 error-correction codewords** in a single block.
Every value below is real. You can check each stage against
[a decoder](/validate) at the end.

## Step 1: mode and count

- Mode indicator, alphanumeric: `0010`
- Character count, 11, in 9 bits (versions 1–9): `000001011`

## Step 2: encode the characters

Alphanumeric values: H=17, E=14, L=21, O=24, space=36, W=32, R=27, D=13. Characters pair
up as 45 × first + second, 11 bits per pair; the odd final character takes 6 bits:

| Pair | Calculation | Value | Bits |
|---|---|---|---|
| H,E | 17 × 45 + 14 | 779 | `01100001011` |
| L,L | 21 × 45 + 21 | 966 | `01111000110` |
| O,␣ | 24 × 45 + 36 | 1116 | `10001011100` |
| W,O | 32 × 45 + 24 | 1464 | `10110111000` |
| R,L | 27 × 45 + 21 | 1236 | `10011010100` |
| D | 13 | 13 | `001101` |

Running total: 4 + 9 + 5 × 11 + 6 = **74 bits**.

## Step 3: terminator and padding

Version 1-Q holds 13 data codewords = 104 bits, so there is room for the full 4-bit
terminator `0000` (→ 78 bits), then two `0`s to reach the 80-bit byte boundary, then the
alternating [pad bytes](/docs/spec/qr-code-bit-stream-walkthrough) `11101100 00010001
11101100` to fill 104. Slicing the stream into bytes gives the 13 data codewords:

```
20 5B 0B 78 D1 72 DC 4D 43 40 EC 11 EC
```

(In decimal: 32, 91, 11, 120, 209, 114, 220, 77, 67, 64, 236, 17, 236.)

## Step 4: Reed–Solomon check codewords

Treat the 13 data codewords as polynomial coefficients and divide by the degree-13
generator polynomial over GF(256), as described in
[Reed–Solomon error correction](/docs/spec/reed-solomon-error-correction). The remainder
is the 13 check codewords:

```
A8 48 16 52 D9 36 9C 00 2E 0F B4 7A 10
```

(Decimal: 168, 72, 22, 82, 217, 54, 156, 0, 46, 15, 180, 122, 16.) The division is
mechanical but tedious by hand, 13 rounds of XOR-and-shift using log tables for the
GF(256) multiplications. Version 1-Q is a single block, so there is
[no interleaving](/docs/spec/error-correction-block-interleaving): the final sequence is
simply data then checks, 26 codewords, 208 bits. Version 1 adds no remainder bits.

## Step 5: place, mask, finish

The 208 bits flow into the symbol in the
[zig-zag pattern](/docs/spec/qr-code-bit-stream-walkthrough): two-module columns from the
bottom-right, up then down, skipping function patterns. Then the eight
[mask patterns](/docs/spec/mask-patterns-0-to-7) are each applied and scored on the four
[penalty rules](/docs/spec/mask-selection-penalty-scores); the winner for this payload
varies by implementation detail, and any choice is valid. Finally the 15-bit
[format information](/docs/spec/format-information) for level Q and the chosen mask is
BCH-coded, XORed with `101010000010010`, and written twice.

That is a complete QR code, by hand. Generate `HELLO WORLD` at level Q with
[the text tool](/text-qr-code) and you get the same 21 × 21 symbol this arithmetic
produces, decode it and the 26 codewords above come back out.

## FAQ

### Why is HELLO WORLD the standard QR encoding example?
It is short enough to fit version 1, uses the alphanumeric mode's pairing arithmetic including a space and an odd trailing character, and exercises the terminator and both pad bytes, every interesting encoding rule in one small payload.

### What are the data codewords for HELLO WORLD at version 1-Q?
In hex: 20 5B 0B 78 D1 72 DC 4D 43 40 EC 11 EC. The first ten bytes carry the mode header and character data; the last three are the standard pad bytes filling the version's 13-codeword capacity.

### How are the error-correction codewords calculated?
By dividing the data codeword polynomial by the degree-13 generator polynomial over GF(256) and taking the remainder: A8 48 16 52 D9 36 9C 00 2E 0F B4 7A 10. Each multiplication uses the field's log and antilog tables.

### Which mask does HELLO WORLD use?
Whichever of the eight scores lowest under the encoder's penalty evaluation: implementations can legitimately differ on this, and every choice produces a valid, decodable symbol. The chosen mask number is recorded in the format information.

## Try it

- https://useqr.app/text
- https://useqr.app/validate
- https://useqr.app/scan
