When a UTXO is spent, it must be consumed entirely. If the value of the UTXO is greater than the amount being spent, then the difference in the amount must be allocated to a new address that the spender owns; this is a change address.
In a standard payment scenario, the sender consumes a single UTXO, paying the spending amount to the receiver’s address, then receiving the change into a new address that they control to take advantage of privacy.
In this example, we can see more clearly that the difference between the input and output is the mining fee.
In this transaction a UTXO held by address 13N2c1uxZee4LYGruhWED6K4P4D8Ncmepq is spent in a transaction that writes a message onto the ledger in an OP_RETURN output, and receives the original amount minus the 276 Satoshi mining fee back into the same address.
In some cases, the spender may have many UTXOs that they would like to consolidate. In this situation, the only output is their ‘change’ address where the total amount less mining fees is sent.
These ‘consolidation transactions’ have the added benefit of reducing the size of the UTXO set, shrinking the database that all nodes maintain. While the computation for processing these inputs could be expensive it is envisaged that the savings in storage will encourage Miners to potentially process these types of transactions for a lower fee.
An example can be found here.
This content is based on content sourced from https://en.bitcoin.it/wiki/Change under Creative Commons Attribution 3.0. Although it may have been extensively revised and updated we acknowledge the original authors.