Floreo
Lab

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:

Unrealized gain=q×(PnowPˉcost)\text{Unrealized gain} = q \times (P_{\text{now}} - \bar{P}_{\text{cost}})

For shares that were sold:

Realized gain=qsold×(PsalePˉcost)Csale\text{Realized gain} = q_{\text{sold}} \times (P_{\text{sale}} - \bar{P}_{\text{cost}}) - C_{\text{sale}}

where

  • qq is the number of shares still held and qsoldq_{\text{sold}} the number sold,
  • PnowP_{\text{now}} is the current price and PsaleP_{\text{sale}} the selling price,
  • Pˉcost\bar{P}_{\text{cost}} is the average purchase price per share, including purchase fees,
  • CsaleC_{\text{sale}} 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.

Realized gain=40×(7050.10)10=786\text{Realized gain} = 40 \times (70 - 50.10) - 10 = 786 Unrealized gain=60×(7050.10)=1,194\text{Unrealized gain} = 60 \times (70 - 50.10) = 1{,}194

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.

Start Demo

The demo opens straight away on a sample portfolio — no account needed.