What is an extended public key (xpub)?
An extended public key, or xpub, lets anyone derive every receiving address of a wallet account without being able to spend. Whoever holds it can see all of those addresses and their full history.
Also called xpub, ypub, zpub or master public key.
Explain it like I’m five
Imagine a mailbox factory that stamps out numbered boxes in a fixed order from one master recipe, box 0, box 1, box 2 and so on. A friend who gets a copy of the public half of the recipe can build the same row of boxes, so the friend knows every box number and can watch what arrives in each. The friend cannot open a single box, because the keys come from the private half, which stays with you.
That is handy for a shop that wants a fresh box for every customer. It also means that the friend sees every box and everything that ever went into it, and so does anybody who finds the copy.
What problem it solves
Privacy advice says to use a new address for every payment, but a wallet with hundreds of addresses is hard to back up and to watch. Hierarchical deterministic wallets, defined in BIP 32 by Pieter Wuille, solve the backup half, because one seed produces every key in a fixed order. The extended public key solves the watching half. A program that holds only the xpub can generate each new address and follow it without ever holding a spending key.
BIP 32 gives its own example, a web server that makes a fresh address for each order or customer without holding the keys that can spend.
How it works, step by step
- A wallet starts from a random seed and runs it through HMAC-SHA512 to get a master private key and a 32-byte chain code (the master extended key).
- A key and its chain code together form an extended key. The private version is (k, c) and the public version is (K, c).
- A child key comes from HMAC-SHA512 over the parent’s chain code, the parent’s key and a child number. The left half is added to the parent key, and the right half becomes the child’s chain code (child key derivation).
- For an ordinary child, with a number below 2 to the power 31, the input is the parent’s public key, so the public half can do the same sum with public values and get the child’s public key. A hardened child mixes in the parent’s private key, so only the private half can make it (hardened derivation).
- Dropping the private key from an extended key gives the extended public key, which BIP 32 calls the neutered key. It is 78 bytes written in Base58Check, and on Bitcoin’s main network it starts with xpub.
- Wallets follow a path such as m/44'/0'/0'/0/5 (BIP 44). The first three levels, purpose, coin and account, are hardened. Then come 0 for receiving addresses or 1 for change, and the address number. The xpub is usually exported at the account level, so everything below it can be derived.
- Anyone with the xpub computes the public key for address number 0, 1, 2 and onward, hashes each key into an address and watches the chain for payments.
A worked example
A shop’s server holds the xpub of account 0 of its owner’s hardware wallet. Order 1 gets the receiving address at m/44'/0'/0'/0/0, order 2 the one at m/44'/0'/0'/0/1, and so on. The server shows each customer a fresh address and notices the payment when it arrives, while the spending keys stay in the hardware wallet.
Now suppose the xpub leaks from the shop’s database to a portfolio app. It shows every past and future order address with its balance. It also gives a quantum attacker the public key behind every address in the account, including addresses that have never received a coin, because those keys follow from the xpub. The hash that normally hides the key of an unspent address no longer hides anything.
What it guarantees
- It cannot spend. BIP 32 states that going from a public parent to a private child is not possible.
- It derives every ordinary descendant, so it shows all addresses below its level, past and future, and it cannot derive hardened children.
- An xpub together with any ordinary child private key gives the parent extended private key, so one leaked child key can cost the whole account. BIP 32 calls this equal to knowing the parent extended private key.
- The Bitcoin developer guide advises securing the chain code part of an xpub better than a standard public key.
- The prefixes xpub, ypub and zpub differ in their version bytes, which tell a wallet which address type to build: legacy, wrapped SegWit or native SegWit. SLIP-0132 registers them.
- Google Quantum AI treats the disclosure of an xpub as a pernicious form of off-chain exposure, because a quantum attacker could then compromise many private keys at the cost of one.
Common misunderstandings
- An xpub is not a password or a backup. It cannot spend or restore anything.
- An xpub is more than a public key. It is a public key plus the chain code that makes children.
- Hardened derivation does not make an xpub safe to share. It keeps hardened children out of reach, but receiving addresses sit in the ordinary part below the account.
- Addresses from one xpub are linked for anyone who holds it.
- Sharing an xpub does not lose coins by itself. The danger starts when it meets one leaked child private key.
Where it is used
- Watch-only wallets and the companion apps of hardware wallets follow addresses with an xpub.
- Merchant servers, as in the BIP 32 example, make a fresh address for each order.
- Bitcoin Core’s output descriptors describe a multisig wallet as a list of the cosigners’ xpubs.
- Google Quantum AI’s whitepaper names portfolio monitoring apps and other third-party services among those that ask for xpubs.
History
Pieter Wuille proposed BIP 32 in 2012. BIP 44 by Marek Palatinus and Pavol Rusnak, assigned in 2014, fixed the layout of the path, and SLIP-0132 registered the ypub and zpub prefixes for SegWit wallets. In 2026 the Google Quantum AI whitepaper added a new reason for care, because an xpub reveals the public key of every address below it.
In Redacted
In bunker mode your Redacted account is 25 words of its own and is never derived from a wallet key, so the keys behind a wallet’s xpub do not open it.
Bunker mode →Related terms
Sources: BIP 32, Hierarchical deterministic wallets, Wuille · Wallets, Bitcoin developer guide · BIP 44, Multi-account hierarchy for deterministic wallets · SLIP-0132, Registered HD version bytes for BIP 32 · Securing elliptic curve cryptocurrencies against quantum vulnerabilities, Babbush et al., March 2026
Updated November 1, 2026. All terms