Two purchases
- Input
- 100 @ 15 + 300 @ 20
- Expected output
- 18.75
(1,500 + 6,000) ÷ 400.
how to calculate average cost of shares
Enter each purchase in the calculator in the order it happened, with quantity, price and the fees from your brokerage note. The top card shows the average cost and the rows below show how it evolved line by line.
(1,500 + 6,000) ÷ 400.
With equal quantities the weighted average equals the simple one.
(2,000 + 10) ÷ 100.
(500 + 1,200 + 20) ÷ 40.
4,650 ÷ 400.
6,600 ÷ 800.
Add up what you paid in each purchase (quantity × price + fees) and divide by the total quantity. With 100 shares at 15 and 300 at 20, the cost is 1,500 + 6,000 = 7,500 for 400 shares, so the average is 18.75.
Only when the quantities are equal. With different quantities it is wrong, as with 100 at 15 and 300 at 20, which gives 17.50 simple and 18.75 weighted.
Not for the average itself. Only the order of trades matters, because a sale in the middle of the sequence lowers the quantity that enters the average of later purchases.
On the brokerage note, adding brokerage, settlement fee and exchange fees for the order. If the note groups several orders, split the fees in proportion to the value traded in each.
After 4 trades
Position 100 · average cost R$10.00
Position 300 · average cost R$9.50
Position 800 · average cost R$8.25
Position 400 · average cost R$8.25 · result +R$1,000.00
Buy 100 at R$7.00 each
Amount invested in the order, fee included: R$700.00
You would hold 500 at an average cost of R$8.00
Brokerage and exchange fees are added to the buy cost and deducted from the sale value, as in the Brazilian tax agency example. Enter the total order fee as an amount of money.
This is not investment advice or an income tax calculation. Your data stays in your browser.