Skip to content
buybitcoinsmart

Glossary / Addresses & keys

Bech32

Definition
Bech32 is the address encoding behind bc1q strings, a lowercase base32 format whose six-character checksum detects any error affecting up to four characters.

Specified in BIP-173.

BIP-173 introduced bech32 in 2017 to replace Base58Check for SegWit outputs. The alphabet holds 32 characters and deliberately omits "1", "b", "i" and "o" so look-alike glyphs cannot be swapped by mistake, and no bech32 string runs past 90 characters. When a wallet rejects an address the instant you finish pasting it, the bech32 checksum is what caught the damage.

How it works

A bech32 string has three parts in fixed order: a human readable prefix, the separator "1", and a data section that ends with six checksum characters. Mainnet uses the prefix "bc", testnet and signet use "tb", and regtest uses "bcrt", so the leading letters identify the network before a wallet decodes anything else. The separator is also the reason "1" is missing from the alphabet. It can then appear only once, at the boundary, and a parser finds the split by scanning from the right.

The checksum is a BCH code computed across the whole string, prefix included. BIP-173 guarantees detection of any error affecting at most four characters and puts the odds of missing a larger error below one in a billion. Base58Check offers nothing comparable: its four trailing bytes are a truncated double SHA-256 hash, which tells a wallet that something is wrong without narrowing down what.

Case carries no meaning. A bech32 address is valid entirely in lowercase or entirely in uppercase, never mixed, and wallets display the lowercase form. BIP-173 asks for uppercase inside QR codes, because uppercase alphanumerics unlock the QR alphanumeric mode, which packs each character into 5.5 bits instead of the 8 that byte mode needs, and produces a coarser pattern that a phone camera locks onto faster.

Where you see it

Every bc1q address is bech32. A 42-character one encodes a 20-byte witness program and pays to a single key; a 62-character one encodes a 32-byte program and pays to a script. Both are witness version 0, and version 0 is the only version bech32 is now allowed to carry.

The encoding also turns up away from addresses. Lightning invoices under BOLT11 borrow it with prefixes such as "lnbc", and they knowingly ignore the 90-character ceiling, because an invoice carries a payment hash, an amount, a description and routing hints rather than one short program.

Where it bites is an exchange withdrawal form. A validator written before 2017 recognizes Base58 strings only and answers a perfectly good bc1q address with "invalid address". That is a limitation of the platform rather than of your wallet, and the fix is to withdraw to an address type the platform does accept, derived from the same seed, instead of hunting for different software.

Bech32 vs Bech32m

Bech32 and bech32m differ by one constant and nothing else. Both use the same alphabet, the same layout and the same six checksum characters. Bech32m changes the value combined into the checksum from 1 to 0x2bc830a3, and the split is decided by witness version: version 0 outputs keep bech32, versions 1 through 16 use bech32m. Software that treats the two as interchangeable will accept strings it should reject, which is the precise failure BIP-350 was written to prevent.

Bech32 vs Base58Check

Bech32 and Base58Check are competing encodings, not competing address types. Base58Check wraps a version byte and a 20-byte hash with a four-byte checksum and produces the case-sensitive strings beginning 1 and 3. Bech32 encodes a witness version together with a witness program and produces case-insensitive strings beginning bc1. Neither encoding decides what the coins are locked to. What they decide is how reliably a human can copy the string, how large the QR code has to be, and how loudly the software complains when a character goes missing.

Not to be confused with

Frequently asked questions

Why does my exchange say a bc1 address is invalid?

Because the platform's address validator was written before bech32 existed and recognizes Base58 strings only. Your address is fine. Withdraw to a format that platform accepts, derived from the same wallet, and move the coins on from there.

Are bech32 addresses case sensitive?

No. A bech32 string is valid entirely in lowercase or entirely in uppercase, and mixing the two makes it invalid. Wallets show lowercase, while QR codes use uppercase because that unlocks a more compact encoding mode.

Read next

Related terms

More in Addresses & keys