Bech32 and Bech32m
The checksummed address format for SegWit, and Bech32m for Taproot, designed to resist typos and stay lowercase.
Basically
Bech32 and bech32m turn Bitcoin addresses into text that is easy to read and check. They work with SegWit and Taproot addresses, spot typing errors, and avoid confusing capital and small letters.
Key Takeaways
- Bech32 (BIP 173) encodes SegWit version 0 outputs such as P2WPKH. It uses a 32-character lowercase alphabet and a BCH error-detecting checksum. Its human-readable prefix, bc1 on mainnet, makes addresses easy to verify and compact in QR codes.
- Bech32m (BIP 350) fixes a length-extension vulnerability in bech32 by changing one constant in the checksum algorithm. All witness version 1 and higher addresses, including Taproot (P2TR), use bech32m instead of bech32.
- Together, these encodings replaced base58check for native SegWit addresses. They provide smaller QR codes, guaranteed detection of up to 4 character errors, lower transaction fees, and no mixed-case confusion.
What Is Bech32?
Bech32 is a checksummed address encoding format introduced in BIP 173 by Pieter Wuille and Greg Maxwell in 2017. It was designed for Segregated Witness outputs and gave Bitcoin its first native SegWit address format. Bech32 addresses begin with bc1q on mainnet and tb1q on testnet.
Bitcoin addresses used base58check encoding before bech32, as seen in legacy P2PKH and P2SH addresses. Base58 mixed uppercase and lowercase letters, forced QR codes into inefficient byte mode, offered no guaranteed error-detection bounds, and was slow to decode because of repeated division. Bech32 solved these problems with a 32-character lowercase alphabet and a BCH error-correcting code designed from first principles; the address types deep dive gives a full comparison of Bitcoin address types.
How It Works
Every bech32 and bech32m address has three parts. A clear structure separates these parts.
The Character Set
Bech32 uses 32 characters drawn from the 36 alphanumeric characters, 0-9 and a-z. It excludes four characters to avoid visual ambiguity.
The ordering of characters within the set is not alphabetical. Visually similar character pairs are arranged to differ by a single bit, which maximises the BCH code's ability to detect substitution errors between confusable characters.
BCH Checksum
The name "Bech32" combines "BCH", the error-correction algorithm family, with "32", the character set size. The checksum uses a degree-6 BCH code over the finite field GF(32), selected from 159,605 candidates through exhaustive computational analysis.
The checksum guarantees detection of up to 4 character-level errors in any address up to 89 characters long. It can locate up to 2 errors, but BIP 173 advises against automatic correction because an incorrect "fix" could produce a valid but wrong address and cause irreversible fund loss. The random failure rate for larger error patterns is less than 1 in 10 9.
Bech32m: Fixing the Length Extension Vulnerability
Researchers discovered a weakness after bech32 was deployed: whenever the final data character before the checksum is p, which encodes value 1, inserting or removing any number of q characters, value 0, immediately before it does not invalidate the checksum. The detection failure probability for this specific mutation drops to roughly 1 in 1,024, far worse than the intended 1 in 10 9.
The weakness was harmless for SegWit v0 because P2WPKH addresses must be exactly 42 characters and P2WSH addresses must be exactly 62 characters. Length validation, not the checksum, would catch any length change from q-insertion. Future witness versions, including Taproot, could support variable-length witness programs of 2 to 40 bytes, making the vulnerability dangerous.
BIP 350, also called bech32m, was published by Pieter Wuille in 2021. It fixes the weakness by changing a single constant in the checksum algorithm.
The constant 0x2bc830a3 was selected from over 2 30 candidates through exhaustive analysis to minimise problematic error classes. No valid bech32 string can also be valid bech32m at the same length: they differ by at least 3 characters, so decoders can unambiguously distinguish them.
Why It Matters
Bech32 and bech32m are not just encoding details. They have practical consequences for every Bitcoin user and wallet developer.
Any wallet or layer-2 protocol built on Bitcoin benefits from these properties. Spark, for example, operates on top of Bitcoin's Taproot outputs, which use bech32m encoding. When you make an on-chain deposit to Spark, you send funds to a bc1p address whose encoding guarantees that typos are caught before broadcast.
Wallet Address Generation
Modern HD wallets following BIP 84 derive native SegWit addresses encoded as bech32 (bc1q), while wallets following BIP 86 derive Taproot addresses encoded as bech32m (bc1p). The derivation path determines which encoding applies. See the wallet SDK comparison for a comparison of wallet implementations.
Payment Requests and Invoices
Bech32 addresses appear in on-chain payment requests, PSBTs, and any context where you share a receiving address. The compact QR representation is especially important for in-person payments and mobile wallet interactions.
Taproot Adoption
Every P2TR output requires bech32m encoding. Taproot adoption is growing, driven by Schnorr signatures, key-path spending efficiency, and protocols like Ordinals and Runes, so bech32m addresses have become increasingly common on the network. The Taproot and Schnorr deep dive covers how these addresses enable more efficient and private transactions.
Backward Compatibility
Older wallets and services that predate SegWit cannot send to bech32 or bech32m addresses. Most major wallets and exchanges added bech32 support between 2018 and 2020, while bech32m (P2TR) support rolled out more gradually after Taproot activation in November 2021. Some smaller services, ATMs, and custodial platforms still lack full P2TR send support, so you should verify recipient compatibility before requesting payment to a bc1p address.
Encoding Confusion
Decoders must verify that the encoding matches the witness version: version 0 requires bech32, and versions 1 and above require bech32m. Software that fails to enforce this rule could accept addresses with the wrong checksum type, undermining the error-detection guarantees that bech32m was designed to provide. Wallet developers should validate both the witness version and the encoding type during address parsing.
No Automatic Error Correction
The BCH code can locate up to 2 errors, but BIP 173 explicitly recommends against automatic correction. A "corrected" address that passes the checksum may still be a valid but wrong address, sending funds to an unrecoverable destination. Wallets should flag errors and ask you to re-enter the address rather than attempting repairs.
Length Validation Remains Essential
The bech32m fix addresses the length-extension vulnerability at the checksum level, but implementations should still enforce valid witness program lengths: 20 or 32 bytes for version 0, 32 bytes for version 1, and 2 to 40 bytes for future versions. Checksum validation alone is not sufficient because length constraints are a separate layer of defence.
The glossary entry is for informational purposes only and does not constitute financial or investment advice. You should always do your own research before using any protocol or technology.