The total number of bitcoins that will ultimately be in circulation is slightly less than the commonly stated 21 million due to several factors:
  1. Rounding errors from the mining reward halving process mean the maximum supply is actually 20,999,999.9769 BTC.[1][2]
  2. The genesis block coins of around 50 BTC are unspendable.[1]
  3. Two incidents early on (blocks 91842 and 91880) caused 100 BTC to be permanently lost due to duplicate coinbase transactions.[1]
  4. Various bugs and miner errors have resulted in further small losses, bringing the total down to around 20,999,817 BTC as of block 528,333.[1]
  5. An unknown but potentially significant number of bitcoins have been permanently lost due to lost/forgotten private keys over the years.[1][3]
So while 21 million is a good approximate maximum supply, the actual number will be slightly under that due to the rounding effect from the halving process and the miscellaneous losses over time. The precise final circulating supply is unknown but is estimated to be around 20,999,817 BTC based on known incidents of permanent loss.[1]
Sources [1] Will there be 21 million bitcoins eventually? https://bitcoin.stackexchange.com/questions/38994/will-there-be-21-million-bitcoins-eventually/38998#38998 [2] Controlled supply - Bitcoin Wiki https://en.bitcoin.it/wiki/Controlled_supply [3] Will all Bitcoin be lost eventually? : r/BitcoinBeginners - Reddit https://www.reddit.com/r/BitcoinBeginners/comments/1b1vlwa/will_all_bitcoin_be_lost_eventually/ [4] What Happens to Bitcoin After All 21 Million Are Mined? - Investopedia https://www.investopedia.com/tech/what-happens-bitcoin-after-21-million-mined/ [5] Bitcoin Halving 2024: Everything You Need to Know | IG International https://www.ig.com/en/bitcoin-btc/bitcoin-halving [6] Bitcoin's latest halving is now complete. Here's what could happen ... https://fortune.com/crypto/2024/04/20/bitcoin-halving-btc-price-outlook-mining-reward-450-crypto-supply/