The Base32 Alphabet
The Base32 Alphabet
Bech32 uses a custom 32-character alphabet. Like Base58, it is carefully designed to remove confusing characters, but it goes even further by eliminating all uppercase letters to optimize for modern user interfaces.
1. The Characters
The Bech32 alphabet consists of:
qpzry9x8gf2tvdw0s3jn54khce6mua7l
-
Lowercase Only: By using only lowercase letters (and numbers), we avoid the common "Is that a big A or a small a?" confusion.
-
Excluded Characters: The characters
b,i,o, and1(except as the separator) are completely removed.1,i, andlare often confused.o,0, andqare often confused.band8are often confused.
2. Why 32 characters?
The number 32 is a "Power of Two" ($2^5$). This is mathematically significant.
-
In Base58, we had to use complex division because 58 isn't a power of two.
-
In Base32, we can simply group bits into chunks of 5. This makes encoding and decoding incredibly fast and easy for even the simplest hardware wallets.
3. QR Code Optimization
Standard QR codes have a special "Alphanumeric Mode" that is extremely efficient.
-
This mode supports uppercase letters, numbers, and a few symbols.
-
Because Bech32 can be represented entirely in uppercase (as it is case-insensitive), it fits perfectly into this high-density QR mode.
-
The result is a QR code that is smaller and much faster for a smartphone camera to "Lock onto."
4. The Mapping
Every character in the alphabet corresponds to a 5-bit value (0 to 31).
-
q= 0 -
p= 1 -
z= 2 -
...and so on.
| Index | Char | Index | Char |
|---|---|---|---|
| 0 | q |
16 | s |
| 1 | p |
17 | 3 |
| 5 | 9 |
31 | l |
In the next section, we will discuss the HRP and Separator.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: