Cost basis math

Stock Average Price Calculator

Enter the shares and price of each purchase to get your true average cost per share, your break-even price with fees, and your gain or loss at today's price. Planning to average down? Switch to target mode to see how many shares at a new price bring your average to the level you want.

Free calculator

Calculate your average share price

Purchases

Charged once on each purchase you enter.

Today

Optional. Needed for gain or loss.

Average price per share
$85.00
40 shares across 2 purchases.
Total invested
$3,400.00
Purchases plus fees.
Break-even price
$85.00
Recovers every dollar, fees included.
Gain or loss
Add a current price
Purchase prices vs your average

Each bar is one purchase. The average weights each by its share count.

Total shares
40
Total fees
$0.00
Position value
Add a current price

Averaging down: how many shares to reach a target average

Averaging down means buying more of a stock below your current average so your cost per share falls. To find how many shares that takes, choose the average you want and the price you expect to pay:

New shares = shares held x (current average - target average) / (target average - new price)

If you hold 50 shares at a $120 average and can buy at $90, reaching a $105 average takes 50 more shares, which cost $4,500 before fees. The target has to sit between your current average and the new price: a purchase at $90 can never pull the average to $90 or below. The same formula works for averaging up when the new price is above your average.

Fees are kept out of the average price. They add to the cash the purchase needs and raise your break-even price, which the calculator shows separately. A lower average does not make a falling stock a better investment; it also puts more money into the same position.

How to use the Stock Average Price Calculator

  1. Enter each purchase: the number of shares and the price per share.
  2. Add the fee you paid per purchase, if any.
  3. Load a ticker or enter the current price to see your gain or loss, or use the target average section to plan how many shares to buy to average down.

How the calculation works

When you buy the same stock more than once, your cost per share is a weighted average: each purchase counts in proportion to the number of shares it added. Fees do not change what you paid per share, but they do raise the price you need to sell at to break even.

Formula

Average price = sum(shares x price) / total shares

Total invested = sum(shares x price) + fees

Break-even price = total invested / total shares

Shares to reach a target average = existing shares x (current average - target) / (target - new price)

Input definitions

Purchases
Each buy: the number of shares and the price per share. Rows left blank are ignored.
Fee per purchase
Optional commission, charged once on each purchase you enter.
Current price
Optional. Loading a ticker fills the latest available price; it is used only for gain or loss.

Worked example

You buy 10 shares at $100 and later 30 shares at $80, paying a $5 fee each time. Your purchases cost $3,400 for 40 shares, an average price of $85.

With $10 of fees you have invested $3,410, so your break-even price is $85.25. At a current price of $90 the position is worth $3,600, a gain of $190 or about 5.6%.

Averaging down to a target: you hold 50 shares at a $120 average and the stock now trades at $90. To bring your average to $105 you need 50 x (120 - 105) / (105 - 90) = 50 more shares, costing $4,500 before fees. A target at or below $90, or above $120, cannot be reached by buying at $90.

What the results mean

  • Average price is your true cost per share; it differs from the simple average of your prices whenever purchase sizes differ.
  • Averaging down lowers the average and break-even price but increases how much you have invested.

Assumptions and limitations

  • Only purchases are modeled. Partial sales, dividends and tax-lot methods are not.
  • Up to 20 purchases.
  • The target average is price-only, before fees, and rounds up to whole shares; fees raise the break-even price, not the average.
  • Taxes are not deducted from the gain or loss.

Stock Average Price Calculator FAQ

How do you calculate the average price of a stock?

Multiply each purchase's shares by its price, add those amounts together, and divide by the total number of shares. 10 shares at $100 and 30 shares at $80 cost $3,400 for 40 shares, an average of $85.

Why isn't my average price the simple average of my purchase prices?

Larger purchases count for more. The simple average of $100 and $80 is $90, but if you bought three times as many shares at $80, your true average cost is $85.

How are fees included?

The average price shows what you paid per share before fees. Fees are added to total invested and to the break-even price, which is the price at which selling would recover every dollar you put in.

How many shares do I need to buy to average down to a target price?

Multiply your current shares by the gap between your current average and the target, then divide by the gap between the target and the new purchase price. 50 shares at $120, buying at $90 to reach $105, needs 50 x 15 / 15 = 50 shares. The target must sit between the new price and your current average.

Does averaging down lower my break-even price?

Yes. Buying more shares below your current average lowers the average and the break-even price, but it also increases how much you have invested in the position.