What is the difference between realized and unrealized gains?
An unrealized gain (or loss) is the change in value of an investment that is still held. It exists only on paper and keeps moving with the price. A realized gain is the profit or loss locked in when the investment, or part of it, is sold. From that moment it no longer changes.
Both are measured against the cost basis: what was paid for the investment, including the costs of buying it.
The formulas
For a position that is still held:
For shares that were sold:
where
- is the number of shares still held and the number sold,
- is the current price and the selling price,
- is the average purchase price per share, including purchase fees,
- is the cost of selling.
A simple illustration
100 shares are bought at €50 each, plus €10 in fees: the cost basis is €5,010, or €50.10 per share. The price rises to €70, and 40 shares are sold with another €10 in fees.
Together they make up the gain on the position so far: €1,980. If the price falls back to €50 tomorrow, the €786 stays; the €1,194 disappears.
Why the difference matters
- Taxes. In most countries capital gains tax is due when a gain is realized, not while it is on paper.
- Risk. An unrealized gain can shrink or turn into a loss. Realizing it removes that risk for the part sold — and with it the chance of further gains.
- Honest performance. A portfolio's total return includes both kinds of gain. Looking only at realized gains flatters an investor who sells winners and keeps losers, a pattern known as the disposition effect.
Which purchase a sale is matched to
When shares were bought at different prices, the realized gain depends on which purchases a sale is matched to. The two common methods are:
- Average cost: every share carries the average purchase price of the position, as in the illustration above.
- FIFO (first in, first out): each sale is matched to the oldest shares still held. German tax rules use FIFO for securities held in a normal custody account.
The two methods give the same total gain over the life of a position, but they split it differently between realized and unrealized, and between tax years.
Related topics
See these numbers for your own portfolio
Floreo works out every figure on this page from your own holdings — returns, risk, allocation, currencies — and the assistant explains them the way this page does. Import from your broker, or try it on the sample portfolio first.
The demo opens straight away on a sample portfolio — no account needed.

