Glossary
What Is an xpub? Extended Public Keys and Your Privacy
Definition
xpub (extended public key): An xpub is an extended public key that can generate every receiving and change address of one wallet account. It cannot spend funds, but it exposes your full balance and history.
On this page
An xpub (extended public key) is a single string, starting with letters such as xpub, ypub or zpub, from which a wallet can derive every public address in one account. It cannot spend coins, but anyone holding it can see your full balance, every past payment and every future receiving address. Treat it as private financial data, not as a secret that protects your money.
Where the xpub comes from
The xpub is a product of BIP-32 hierarchical deterministic wallets. Your seed phrase produces a master key, and the wallet walks down a derivation path to an account level, for example m/84'/0'/0' for the first native SegWit Bitcoin account. At that level it exports two things:
- The account’s public key
- A 32-byte “chain code” that allows more child keys to be computed
Together they form the extended public key. From it, software can compute the receiving chain (/0/0, /0/1 …) and the change chain (/1/0, /1/1 …) without ever touching a private key.
Prefixes at a glance
| Prefix | Address type it signals | Addresses start with | Defined in |
|---|---|---|---|
| xpub | Legacy P2PKH (also used by many wallets for Taproot) | 1 (or bc1p) | BIP-32 / BIP-44 / BIP-86 |
| ypub | Nested SegWit P2SH-P2WPKH | 3 | BIP-49 |
| zpub | Native SegWit P2WPKH | bc1q | BIP-84 |
| tpub / vpub | Testnet versions | m, n, 2, tb1 | Various |
The prefix does not change the underlying key; it only tells the importing wallet which script type to use. Importing a zpub as an xpub can make a funded wallet appear empty.
What an xpub can and cannot do
| Action | Possible with xpub only? |
|---|---|
| Show balance and full transaction history | Yes |
| Generate new receiving addresses | Yes |
| Build an unsigned transaction (PSBT) | Yes |
| Sign or broadcast a spend | No |
| Recover the seed phrase | No |
This is why xpubs power watch-only wallets, merchant invoicing tools and the online half of an air-gapped setup.
The privacy problem
On a transparent chain, the main defence of your privacy is that outsiders do not know which addresses belong together. An xpub removes that defence completely. Whoever receives it can link every address, past and future, to one owner.
Typical ways xpubs leak:
- Pasting it into a portfolio tracker, tax tool or block explorer that logs requests.
- Pointing a wallet app at a public server that receives your xpub to look up balances.
- Sharing a screenshot of wallet settings when asking for help.
- Giving it to a merchant tool or payment processor that you later stop trusting.
If you run your own node, or use a wallet that connects to your own server, the lookups stay with you.
The rare theft case
BIP-32 itself warns that knowing a parent extended public key plus any one non-hardened child private key lets an attacker compute the parent private key. In practice this matters if you export a single private key from an address (for a paper wallet or a sweep) while your xpub is also known. Hardened derivation at the account level limits the damage to that one account.
Checklist before sharing an xpub
- Do you need full-account tracking, or would one public address do?
- Is the receiving service one you would show your bank statements to?
- Have you used a separate account (a new account index) for this purpose?
- Have you never exported individual private keys from this account?
- Can your wallet use your own node instead of a third-party server?
Related reading
For the bigger picture on linking addresses, read how to avoid address reuse and Bitcoin coin control. Hardware wallet owners can find the xpub export in Trezor Suite or Ledger Live, and the overall privacy trade-offs of spending are covered in How to Pay with Crypto Privately.
Frequently asked questions
Can someone steal my bitcoin with my xpub?
What is the difference between xpub, ypub and zpub?
Where do I find my xpub?
Should I give my xpub to a tax or portfolio app?
Sources
- BIP-32: Hierarchical Deterministic Wallets
- BIP-44: Multi-account hierarchy
- BIP-84: Derivation scheme for P2WPKH accounts
Facts were checked against these pages on the date shown above. Terms change; confirm on the official page before acting. General information, not financial, tax or legal advice. See our methodology.