Friday, October 23, 2026
Learn / Wallets and keys

What is an xpub and is it safe to share?

An xpub is an extended public key that lets software generate and view every address in a wallet account, but it cannot be used to spend funds.

Wallets and keys Illustration: Cryptoweek

An xpub is an extended public key, a long string that starts with "xpub" and lets software derive every public address in one account of a Bitcoin wallet. It is defined in BIP-32, the standard for hierarchical deterministic wallets. Because it contains no private key, an xpub can show and track funds but cannot spend them.

What does xpub mean?

The "x" stands for extended. According to BIP-32, an extended public key pairs an ordinary public key with a 32-byte value called a chain code. Together they let software calculate child public keys, and from those, receiving addresses, without ever touching the private keys.

Written out, it is a 111-character string beginning with "xpub" on Bitcoin's main network. The matching private version starts with "xprv" and must never be shared. It also records the key's position in the wallet's derivation path.

BIP-32 describes a common use: a web shop server can hold only an xpub and create a fresh receiving address for every order, while the keys that can spend the money stay offline. That is also how a watch-only wallet works.

What is the difference between xpub and zpub?

BIP-32 does not say which address format an extended key should produce. To fix the confusion, wallet developers registered different version bytes in SLIP-0132, so the prefix tells software which type of address to generate:

  • xpub: legacy addresses (P2PKH) or P2SH
  • ypub: SegWit nested inside P2SH, under BIP-49
  • zpub: native SegWit (P2WPKH), under BIP-84
  • Ypub and Zpub: the P2WSH equivalents, used for script-based setups such as multisig

Only the version bytes at the start differ, while the rest of the structure follows BIP-32. Our guide to Bitcoin address types explains each format.

How does an xpub lookup work?

Some block explorers and portfolio apps let you paste an xpub to see every address it has derived, along with balances and transactions. Trezor says this is a way to watch an account without connecting the hardware wallet. It also warns that pasting an xpub into an explorer links your IP address to that wallet, which the site operator may be able to see.

Is it safe to share your xpub?

It is safe in the sense that an xpub alone cannot move funds, according to Trezor. The risk is privacy. Anyone holding it can see the account's past and future addresses, its balance and its transaction history, even after you spend or consolidate coins.

BIP-32 adds a technical caution. If someone has a parent xpub and also obtains any single non-hardened child private key from below it, they can work out the parent private key. That is why the standard says extended public keys need more care than regular public keys, and why wallets use hardened derivation at the account level so one leaked account does not expose others.

In a multisig wallet, xpubs also matter for recovery. Trezor notes that every xpub in the set is needed to rebuild the wallet, so losing one can cut off access to the funds.

This guide explains how things work. It is not financial, legal or tax advice. Last updated .