Average cost basis explained: the math behind your profit number
You bought a stock at €50, then more at €80, then more at €40. It now trades at €60. Whether you are up or down on a single share depends on which purchase that share is counted against.
Your total result on the position is shares times price, minus what you paid in total. That number is a fact, whichever method you use.
As soon as you buy the same security more than once at different prices, any per-share profit figure needs a rule for which purchase a sold share belongs to. That rule is an accounting convention, and different conventions produce different numbers from the same trades.
This article covers the two conventions you will meet, average cost and FIFO, with the same trades run through both. It then covers the three details, fees, currency and splits, that change profit figures more than the method does.
The average cost method
Many brokers and trackers, including BullBenchmark, use average cost. That is total money in, divided by total shares. In the example that is (50 + 80 + 40) / 3 = €56.67. At €60 you are up about 6%. Sell one share and your realized gain is €60 minus €56.67, measured against the average and not against any specific purchase.
The method is stable and matches how most people think about a position. It has one property worth knowing. Your average only moves when you buy. Selling shares at any price leaves the average cost of the remaining shares unchanged, and the sale only realizes part of the gain or loss.
This is why an average cost figure moves less than a FIFO ledger. There are no lots being consumed in sequence, only one pool of money and one pool of shares. It also means that buying more at a lower price, averaging down, lowers your average at once, and the profit figure shows that immediately.
The same method with unequal lots
The one-share-per-purchase example hides something. In most portfolios the lots have different sizes, and the average is weighted by money, not by the number of purchases. Say you bought 10 shares at €50 (€500), then 5 at €80 (€400), then 20 at €40 (€800).
Total in is €1,700 for 35 shares, an average cost of €48.57. That is well below the €56.67 from the equal-lot version, because most of your shares were bought at the lowest price.
At €60 the position is worth 35 × €60 = €2,100 against €1,700 invested. You are up €400, or €11.43 per share, about 23.5%.
This is why the three purchase prices say little on their own. The average is weighted by how much you put in at each price, and a large cheap lot pulls it down more than a small expensive lot pushes it up.
FIFO, the method US brokers use
US brokers often default to FIFO, first in, first out. Sell one share at €60 and your realized gain is measured against the first share, the one bought at €50, which gives +€10. FIFO makes realized gains look different, often larger and earlier, and US investors can pick specific lots for tax purposes.
Neither method changes your wealth. It only changes how that wealth is split between realized and unrealized on paper. If your tracker uses one method and your broker another, the per-position numbers will not match. That is usually the answer to the question why a tracker disagrees with a broker.
The same sale under both methods
Run the unequal-lot position through both methods. You sell 10 of your 35 shares at €60. Under average cost, the realized gain is 10 × (€60 − €48.57) = €114.29, and the remaining 25 shares keep a cost basis of €1,214.29.
Under FIFO, the sale consumes the oldest lot, the 10 shares bought at €50, for a realized gain of 10 × €10 = €100.00. The remaining shares keep a basis of €1,200.00.
Same trades, same cash, same portfolio, but one method reports €114.29 realized and the other €100.00. The difference did not disappear. It moved into the unrealized column.
Sell everything at €60 and both methods arrive at the same total gain of €400, because an accounting method spreads a fixed result over time and does not create or destroy any of it. That is worth remembering when two apps show different profits on the same position, before concluding that one of them is broken.
Fees, currency and splits
The choice between average cost and FIFO gets the forum arguments, but in practice three duller details corrupt more profit numbers than the method does.
Fees. Is the €2 transaction fee part of your cost basis or booked separately? It is small per trade. After 400 trades it is €800, and a profit figure that leaves it out is too high by that amount.
For tax purposes fees usually belong inside the cost basis. We book them separately, so you can see what your broker cost you.
Currency. Buy a US stock as a European investor and your cost basis is the euro amount at that day's exchange rate. Track in dollars only, and years of EUR/USD movement distort every position.
This one fails silently. A US position can be up 10% in dollars and up 4% in euros, or up 16%, depending on what the exchange rate did between your purchase dates and today.
If the question is what your money did, the cost basis has to be recorded in your own currency, at the historical rate for each purchase, and not at one rate applied later. We cover this in more detail in multi-currency portfolio tracking.
Splits and ISIN changes. After a 4:1 split the cost of your position stays the same, but a naive tracker records it as if it had quadrupled. Corporate actions are a common source of errors in portfolio math, so whether a tool handles them is worth checking.
Taxes: when the method is prescribed
Several countries prescribe a method for taxable gains. Germany requires FIFO, and the UK uses Section 104 pooling. Per-position figures from any tracker are performance information, not tax filings.
The two jobs are different. A tracker answers how a position is doing day to day, in whichever method makes that readable. A tax return follows the method the tax authority prescribes, calculated from the broker's own records. Mixing the two up leads to overpaying or to correspondence with the tax office.
When your tracker and your broker disagree
Sooner or later you will see two different profit figures for the same position. Usually neither is wrong. The causes, in order of likelihood, are a different cost method (average versus FIFO), fees booked inside or outside the basis, currency converted at different dates or rates, and an unhandled split or ticker change.
The first three produce small, stable differences. The last produces large ones. A position that shows −75% after a 4:1 split is the classic case.
BullBenchmark uses average cost, books fees separately, converts at each day's historical exchange rate and handles splits, so the per-position figures can be checked against your broker's.
Everything above is per-position bookkeeping. Whether your portfolio as a whole is doing well is a different question with its own math, covered in time-weighted vs money-weighted return. That is the question that decides whether the portfolio beats an index fund.
In short
- Average cost divides total money in by total shares. It only moves when you buy. Selling leaves the average of the remaining shares unchanged.
- FIFO measures each sale against the oldest purchase. Realized gains differ from average cost, but the total gain after selling everything is the same.
- Fees, currency and splits change profit figures more than the method does. A 4:1 split handled wrongly shows up as −75%.
- Several countries prescribe a method for tax. A tracker's per-position figure is performance information, not a tax filing.
BullBenchmark reads the transaction export from your broker and shows your return next to the S&P 500 and the Nasdaq 100, fed with the same deposits on the same dates, in your own currency. The first two weeks are free and no card is needed.
Related: Realized vs unrealized gains