Floreo
Lab

What is cost basis?

The cost basis of an investment is the total amount paid to acquire it, including purchase costs such as broker fees. It is the reference point for gains and losses: the gain on a position is its current value minus its cost basis. Knowing it accurately matters for tracking performance and, in most countries, for calculating tax on gains when the investment is sold.

The formulas

For a position built with several purchases, the cost basis is the sum of all purchase amounts and fees:

C=k(qk×Pk+fk)C = \sum_k (q_k \times P_k + f_k)

where qkq_k is the number of shares bought in purchase kk, PkP_k the price paid and fkf_k the fees. The average purchase price per share is:

Pˉ=Ckqk\bar{P} = \frac{C}{\sum_k q_k}

With the average cost method, a partial sale reduces the cost basis in proportion to the shares sold, and the average price per share stays the same.

A simple illustration

PurchaseShares boughtPriceFeesAmount paid
January50€40€5€2,005
June30€50€5€1,505
November20€35€5€705
Total100€4,215
Pˉ=4,215100=42.15\bar{P} = \frac{4{,}215}{100} = 42.15

If 40 shares are then sold at €60, the gain on the sale, before selling fees, is:

Gain=40×(6042.15)=714\text{Gain} = 40 \times (60 - 42.15) = 714

The 60 remaining shares keep a cost basis of €2,529 — still €42.15 per share.

Other methods

The average cost method is common in portfolio trackers. Tax rules often prescribe another way of matching sales to purchases:

  • FIFO (first in, first out): each sale uses the oldest shares first. In the example, the 40 shares sold would come from the January purchase at €40.10 each including fees, for a gain of €796.
  • Specific identification: the investor chooses which purchase lots are sold, where the rules allow it.

Over the life of a position, the total gain is the same with every method; only its split between years — and therefore the taxes and the reported performance — differs.

What changes the cost basis

  • Stock splits change the number of shares and the price per share, but not the total cost basis.
  • Spin-offs divide the cost basis between the original company and the new one.
  • Reinvested dividends buy new shares, which get a cost basis of their own.
  • Transfers between brokers must carry the original purchase prices; without them, gains cannot be calculated correctly.

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.