An Extended Public (xPub) Key is a part of the Bitcoin standard (BIP32). It can be thought of a master view into a wallet.
xPub keys are useful because Bitcoin employs the concept of unspent transaction outputs (UTXOs) in return addresses. This means that the full balance of a wallet is spent on every transaction, and any excess holdings in the wallet are forwarded to a new, fresh, unused wallet address.
For example let’s say that Carol has Wallet address A with 10 BTC and wants to send Tim 7 BTC. What actually happens on the blockchain is:
Wallet A (10 BTC) ----------> Wallet B (7 BTC), owned by Tim
Wallet C (3 BTC), owned by Carol
So now Wallet A has 0 BTC and Carol maintains 3 BTC in a brand new wallet C. This is done to protect Carol’s privacy and security in the event that Wallet A is every compromised.
The difficulty with UTXOs above is that in order to track your balances with regular public keys, you need to add every single wallet address from every transaction and UTXO (this can balloon to hundreds of addresses quickly).
Instead, an xPub key allows full read-only view to all transactions, addresses, and balances in a specific wallet. Basically the xPub key allows you to generate all the public addresses (including all the UTXO addresses). For spending funds, private keys are required, and an xPub key does not contain any private keys.
An xPub key can be useful, for example, for tracking the full history of a wallet (e.g. Ledger Nano S, Trezor, Exodus, etc.).
The latest bitcoin standards expand xPub (generates 1-prefixed addresses) to yPub (generates 3-prefixed addresses) and zPub (bc1-prefixed addresses) for bitcoin segwit wallets. Read on for more details.