Home › Glossary › Bech32

Bech32

Also called: bech32 address, bc1 address, bc1q, native SegWit address format, base32 address, BIP173.

Bech32 is the checksummed base32 address format from BIP 173, used for native SegWit version 0 addresses that start with bc1q.

Bech32 is an address encoding defined in BIP 173 by Pieter Wuille and Greg Maxwell. It is used for native SegWit version 0 outputs, P2WPKH and P2WSH, whose addresses start with bc1q.

Anatomy of a Bech32 address

bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 has three parts:

  • Human-readable part: bc for mainnet, tb for testnet.
  • Separator: always 1.
  • Data part: the witness version (q means 0), the witness program converted to 5-bit characters, and a 6-character checksum.

The alphabet has 32 characters: lowercase letters and digits except 1, b, i and o, which are easy to confuse. Version 0 addresses are always 42 characters (P2WPKH) or 62 (P2WSH).

Why it replaced Base58

BIP 173 lists the problems with Base58Check: mixed case is hard to read aloud or type, it takes more space in QR codes, and its double SHA-256 checksum is slow and has no error-detection guarantees. Bech32 uses a BCH code that is guaranteed to detect any error affecting up to 4 characters, with less than a 1 in 10^9 chance of missing larger errors. Addresses are single-case: lowercase for display and uppercase in QR codes, where alphanumeric mode is about 45% more compact. Decoders must reject mixed-case strings.

The weakness and Bech32m

Bech32 has one flaw: if a string ends in p, inserting or deleting q characters just before it doesn't break the checksum. Version 0 addresses are protected by their fixed lengths, but BIP 350 introduced Bech32m for version 1 and later, such as Taproot. See BIP 173 vs BIP 350, or check an address with the address checker.

BIPs that define Bech32

Related terms

  • Bech32m: Bech32m is the modified Bech32 address format from BIP 350, used for SegWit version 1 and later, such as Taproot addresses starting with bc1p.
  • P2WPKH: P2WPKH (Pay to Witness Public Key Hash) is the native SegWit single-key output type. Its bc1q addresses are always 42 characters long.
  • P2WSH: P2WSH (Pay to Witness Script Hash) is the native SegWit output for scripts such as multisig: a 32-byte script hash with a 62-character bc1q address.
  • Base58Check: Base58Check is the original text encoding for Bitcoin addresses and keys: Base58 characters plus a 4-byte checksum from double SHA-256.
  • SegWit (Segregated Witness): SegWit (Segregated Witness) is the 2017 soft fork that moved signatures into a separate witness, fixing malleability and introducing block weight.

Learn more

Guides