After sending some bitcoins, why do I have zero available to spend when I clearly didn't send my entire balance? With some of the clients I use regularly (Multibit, Bitcoin for Android), I've noticed that, after I send bitcoins to an address, I have 0 BTC available to spend despite having perhaps a several bitcoin balance. 

Looking more closely at the transaction details on Blockchain.info or Blockexplorer.com, I observe that the client sent my entire balance back to myself in the same transaction.

For example, my balance in my wallet before the transaction is 1 BTC. I send 0.5 BTC to address C from my wallet, plus 0.0005 BTC for transaction fees. I should have 0.4995 available immediately to spend on another transaction. However, the clients show 0 BTC available, but a balance of 0.4995 BTC.

When I look at the transaction, I see two input addresses, addresses A and B. The outputs are 0.5 BTC to address C, the destination of my payment, and 0.4995 to address B.

Why then do I have 0 BTC available when I clearly should have 0.4995 BTC available?
In this scenario, neither address A nor address B had a sufficient balance to pay 0.5 BTC by itself. The two together did have enough. So, the clients are intelligent enough combine the amounts of two addresses together in order to meet the desired transaction amount. 

Unfortunately, the combination has the effect of sending bitcoins to yourself as "change" in the transaction. In this scenario, all of the available balance was split between address A and address B. In combining those in order to satisfy the payment to C, some was consolidated as "change" into address B.

Think of it mathematically, as well. This shows the equilibrium, from the point of view of the accounts you control.

balance(A) + balance(B) = payment_to(B) + payment_to(C) + transaction_fee(0.0005)


This is the transaction.

balance(A) + balance(B) - payment_to(C) - transaction_fee(0.0005) = payment_to(B) 


That payment_to(B) is the change.

Unfortunately, because of the number of confirmations the clients wait before allowing one to spend incoming transactions, the balance is present but unavailable to spend for several minutes, or as much as hour or more.

Clients should handle this better by warning if transaction about to be sent will create this confusing situation.