Skip to content
PayableWithCrypto

Glossary

What Is an xpub? Extended Public Keys and Your Privacy

Editorial teamFact-checked against official sources Last updated 3 min read

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
  1. 1Where the xpub comes from
  2. 2Prefixes at a glance
  3. 3What an xpub can and cannot do
  4. 4The privacy problem
  5. 5The rare theft case
  6. 6Checklist before sharing an xpub
  7. 7Related reading
  8. 8Common questions

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:

  1. Pasting it into a portfolio tracker, tax tool or block explorer that logs requests.
  2. Pointing a wallet app at a public server that receives your xpub to look up balances.
  3. Sharing a screenshot of wallet settings when asking for help.
  4. 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?

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?
Not with the xpub alone. It contains no private keys, so it cannot sign transactions. The real risks are loss of privacy and, in rare cases, theft if the xpub leaks together with a single non-hardened child private key.
What is the difference between xpub, ypub and zpub?
They are the same kind of key with different version prefixes that tell wallet software which address type to generate: xpub for legacy (and often Taproot), ypub for nested SegWit addresses starting with 3, and zpub for native SegWit addresses starting with bc1q.
Where do I find my xpub?
Most wallets show it in account or wallet settings, often under 'export public key' or 'account details'. Hardware wallet companion apps such as Trezor Suite and Ledger Live display it on request.
Should I give my xpub to a tax or portfolio app?
It works, because the app can then track all addresses automatically, but you are giving that company your entire account history and future receipts. Consider whether a CSV export or single addresses would do instead.

Sources

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.

Related terms

Compare cards Find a store