Weighted Average Cost Basis, Explained with Examples
How to work out your average cost per share across several purchases, why fees belong in it, what happens when you sell part of a position, and how that gives you your break-even price.
If you've bought the same shares more than once, at different prices, "what did I pay?" doesn't have a single obvious answer. The weighted average cost method gives you one, and it's the basis for your break-even price and your realized gains.
The calculation
Average cost per share = total amount paid ÷ total shares held
"Total amount paid" means everything it cost you to buy: price × quantity, plus brokerage commission and any levies or fees.
A worked example
| Purchase | Shares | Price | Fees | Total cost |
|---|---|---|---|---|
| March | 100 | 20.00 | 50 | 2,050 |
| August | 50 | 26.00 | 30 | 1,330 |
| Total | 150 | 3,380 |
Average cost per share = 3,380 ÷ 150 = 22.53
Notice that it isn't the simple average of the two prices (23.00). The March purchase was larger, so it carries more weight — and the fees push the figure up slightly.
Your break-even price
Your average cost per share is also your break-even price: the price at which selling everything would return exactly what you paid, before any selling costs. If the shares trade above 22.53, the position is ahead; below it, behind. (Selling fees will raise the true break-even a little.)
Selling part of a position
Under the weighted average method, a sale doesn't change your average cost per share. It reduces the number of shares, and the cost basis drops in proportion.
Continuing the example, you sell 60 shares at 30.00, paying 40 in fees:
- Proceeds after fees: 60 × 30.00 − 40 = 1,760
- Cost of the shares sold: 60 × 22.53 = 1,352
- Realized gain: 1,760 − 1,352 = 408
You now hold 90 shares, still at an average cost of 22.53, with a remaining cost basis of about 2,028.
Buying again after a sale
If you later buy more, the new purchase blends into the remaining position the same way: add its total cost to the remaining cost basis, add its shares to the remaining shares, and divide.
Other methods exist
Some tax systems use different rules — for example first-in, first-out (FIFO), or specific rules for shares bought within a short window. If you're calculating a figure for a tax return, check which method your tax authority requires. Weighted average is common, simple, and gives a clear picture of your position.
How Clarifolio handles it
Clarifolio calculates cost basis using the weighted average method from the trades you record, with brokerage fees and other charges included. Each holding shows its cost basis and break-even price, and realized gains are calculated on every sale or redemption — no formulas to maintain.


Frequently asked questions
How do you calculate weighted average cost per share?
Add up the total amount paid for all purchases, including fees, and divide by the total number of shares. For example, 3,380 paid for 150 shares is an average cost of 22.53 per share.
Does selling shares change the average cost per share?
Not under the weighted average method. A sale reduces the number of shares and the total cost basis proportionally, so the average cost per share stays the same.
Should brokerage fees be included in cost basis?
Yes. Fees and levies paid to buy shares are part of what the shares cost you, so including them gives an accurate break-even price and realized gain.