How to calculate the average cost of a stock
The average cost (or average cost basis) is what each share you own cost you on average, including commissions and fees. It is the reference for knowing whether a position is at a gain or a loss, and in many tax systems it is the basis for computing the taxable gain when you sell.
The formula
Average cost = total paid on purchases, including fees ÷ number of shares held
Example
| Date | Trade | Quantity | Price | Average cost after |
|---|---|---|---|---|
| Jan | Buy | 50 | $65.00 | $65.02 |
| Mar | Buy | 25 | $57.80 | $62.63 |
| May | Buy | 40 | $52.80 | $59.22 |
| Jul | Sell | 30 | $60.20 | $59.22 (unchanged) |
Each purchase blends into the average; the sale does not change it. The gain on the July sale is 30 × $60.20 − $1 fee − 30 × $59.22, about $28.48.
Selling does not change the average
When you sell, the quantity and the total cost fall in proportion, so the average cost of the shares you keep stays the same. That is why a partial sale never “improves” your average cost.
Lowering the average cost
Buying more when the price is below your average cost pulls it down, but each additional share lowers it a little less. Lowering the average is not a reason to buy on its own: ask whether the investment is still sound, or you may just be adding to a mistake.
Practical tips
- Keep all broker confirmations: they show quantity, price and fees for each trade.
- Stock splits, reverse splits and stock dividends change the number of shares and require an adjustment.
- Tax rules differ by country: some use average cost, others first-in, first-out or specific lots. Check the method that applies to your account.