TeachMeBitcoin

Bech32 Encoding (BIP 173)

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Bech32 Encoding (BIP 173)

The launch of Native SegWit brought with it the first major change to Bitcoin address formats since the beginning. Bech32 (defined in BIP 173) replaced the old Base58Check encoding for all native witness outputs.

1. Anatomy of a Bech32 Address

A typical P2WPKH address looks like this: bc1q9w3m7y7e4u7y7e4u7y7e4u7y7e4u7y7e4u

2. Base32 Alphabet

Bech32 uses a 32-character alphabet: qpzry9x8gf2tvdw0s3jn54khce6mua7l

3. The BCH Checksum

Bech32 uses a sophisticated Bose-Chaudhuri-Hocquenghem (BCH) checksum.

4. Why use Base32 instead of Base58?

  1. Compact QR Codes: Base32 uses only alphanumeric characters that fit into the "Alphanumeric Mode" of QR codes, making them 15-20% smaller.

  2. Ease of Use: It is easier to read over a phone or radio because there are no capital letters to specify.

  3. Efficiency: Base32 is mathematically simpler to compute than the large-integer division required for Base58.

Feature Base58 (Legacy) Bech32 (Modern)
Ambiguity High (0/O, l/I) Zero
Case Sensitive Yes No
Checksum Strength Strong Extreme
QR Code Size Larger Smaller

In the final section, we will build a Python P2WPKH Auditor.

☕ Help support TeachMeBitcoin

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:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!