Average cost calculator

Enter the quantity and price of each purchase: the calculator gives the average cost per share including fees, your gain or loss at the current price and how many shares to buy to reach a target average.

Calculate

#QuantityPriceFeesRemove purchase
1
2

Average cost: $45.00

Total shares
30
Total cost
$1,350.00
Average cost without fees
$44.67
Value at current price
$1,350.00
Gain or loss
$0.00 (0.00%)

The calculation runs in your browser: the values are kept in the page link, which you can save or share.

How to calculate the average cost per share

It is the average of the purchase prices weighted by quantity: the total cost (quantity times price for each purchase, plus fees) divided by the total number of shares.

  • Average cost = (q₁ × p₁ + q₂ × p₂ + … + fees) ÷ (q₁ + q₂ + …)
  • Partial sales do not change the average cost of the remaining shares

Example

You buy 10 shares at $50 and then 20 at $42, with $5 in fees each time: the total cost is 500 + 840 + 10 = $1,350 for 30 shares. The average cost is $45 ($44.67 without fees).

How many shares to buy to average down

If the stock trades below your average cost, buying more lowers it. The shares to buy at the current price to reach a target average are: shares held × (average cost − target) ÷ (target − current price). With 30 shares at a $45 average and the stock at $40, reaching $43 takes 30 × 2 ÷ 3 = 20 shares.

The target must lie between the current price and your average cost. Averaging down does not recover a loss already made: it increases your investment in the same stock.

What it is for

The average cost tells you whether a position is in profit or at a loss. For taxes, rules vary by country: some use the average cost, others first-in, first-out or the specific lots sold.