Skip to content

Average Cost Calculator for Shares

Weighted average cost per share across several purchases, break-even price and unrealized gain.

Your details

Purchases

One row per buy order. Fees are the total commission and taxes paid on that order.

Shows the market value and the unrealized gain or loss of the position.

$

Commission you expect to pay when you sell the whole position; it raises the break-even price.

$

Averaging down or up: how many shares to buy at the current price to reach this average (fees of the new order ignored).

$

Results update as you type

Average cost per share (fees included)

$20.8250

Average purchase price (before fees)
$20.7500
Total shares
200
Total cost (cost basis)
$4,165.00
Total buying fees
$15.00
Break-even selling price
$20.8250
Market value
$4,600.00
Unrealized gain / loss
$435.00
Unrealized return
10.44%

Step-by-step solution
  1. Cost: 100 × 20 + 50 × 26 + 50 × 17 + 15 = $4,165.00
  2. Shares: 200
  3. Average cost: $4,165.00 ÷ 200 = $20.8250

This calculator gives estimates for information only. It is not financial, tax or legal advice. Check figures with a qualified professional before making decisions.

If you have bought the same stock or fund more than once — on a dip, through a monthly plan or after a dividend reinvestment — each lot was paid at a different price. The figure that matters for your decisions is the weighted average cost per share: the total you have spent, commissions included, divided by the total number of shares you hold.

This average cost calculator takes any number of purchases, each with its quantity, price and fees, and returns that average, the average price before fees, the total cost basis and the break-even price you need to sell at to get your money back. Enter today’s price and it also shows the market value of the position and the unrealized gain or loss, in money and in percent.

Thinking about buying more to bring the average down (or up)? Type a target average cost and the calculator tells you how many shares to buy at the current price, and how much cash that takes. The table below the result shows how the average moved after each purchase.

How to use this calculator

  1. Enter one row per purchase: number of shares, price per share and, if you know it, the total fees for that order (commission, stamp duty, financial transaction tax).
  2. Add rows with the + button; leave a row blank to ignore it. Fractional shares are allowed.
  3. Optionally enter the current share price to see the market value and the gain or loss.
  4. Optionally enter the selling fee you expect to pay; it is included in the break-even price.
  5. To average down or up, enter a target average cost. The calculator returns the number of shares to buy at the current price.

The formula

For purchases i=1…ki = 1 \dots k of nin_i shares at price pip_i with fees fif_i:

Cˉ=∑i(ni pi+fi)∑ini\bar{C} = \frac{\sum_i (n_i \, p_i + f_i)}{\sum_i n_i}

The average price before fees drops the fif_i terms. With N=∑niN = \sum n_i shares, total cost TT and a selling fee ss, the break-even price is (T+s)/N(T + s)/N, and at a market price PP the unrealized gain is N P−s−TN \, P - s - T.

To reach a target average AA by buying xx more shares at price PP, solve (T+xP)/(N+x)=A(T + xP)/(N + x) = A:

x=A N−TP−Ax = \frac{A\,N - T}{P - A}

which has a positive solution only when AA lies between the current average and PP.

Worked example

You bought 100 shares at 20, then 50 at 26, then 50 at 17, paying a fee of 5 on each order. The total cost is 2000+1300+850+15=4,165.002000 + 1300 + 850 + 15 = 4,165.00 for 200 shares, so

Cˉ=4,165.00/200=20.8250\bar{C} = 4,165.00 / 200 = 20.8250

Without fees the average price is 20.75. At a current price of 23, the position is worth 4,600.00, an unrealized gain of 435.00 (10.44%).

Averaging down. You hold 300 shares with an average cost of 40 and the price has fallen to 25. To bring the average down to 35 you need

x=35×300−1200025−35=−1500−10x = \frac{35 \times 300 - 12000}{25 - 35} = \frac{-1500}{-10}

that is 150 shares, costing 3,750.00. The new position of 450 shares then cost 15,750 in total, exactly 35 per share.

Average cost, cost basis and the French PRU

In the United States the cost basis of shares is generally the purchase price plus costs of purchase such as commissions, and IRS Publication 550 allows an average basis method for mutual fund shares. In France the same idea is called the prix de revient unitaire (PRU) or prix d’achat moyen pondéré (PAMP): brokers display it for every line of a securities account or PEA, and it includes brokerage fees and, where applicable, the financial transaction tax.

Brokers do not always agree on details — some leave fees out, some adjust the figure after dividends or rights issues — so the PRU on your statement can differ slightly from a manual calculation. The method here is the plain weighted average, fees included, which is what the tax rules use in most cases.

Does selling change the average cost?

No. Under the average cost method, selling part of a position removes shares at the current average, so the average cost of the remaining shares stays the same; only new purchases move it. The gain on a partial sale is (sale price − average cost) × shares sold, minus the selling fee. Some tax systems use other matching rules, such as first-in first-out or specific lot identification, which give a different taxable gain — check the rules that apply to your account.

Frequently asked questions

How do I calculate the average price of a stock I bought several times?

Multiply each purchase’s shares by its price, add the fees, sum everything and divide by the total number of shares. The calculator does this for any number of purchases.

Should fees be included in the average cost?

For your true break-even and for tax purposes, yes: commissions and purchase taxes are part of what the shares cost you. The calculator shows both the average with fees and the average price before fees.

What is averaging down?

Buying more of a stock after its price has fallen, which lowers your average cost per share. It reduces the price needed to break even but also increases your exposure to that one stock.

Why can my target average not be reached?

Buying at the current price can only pull the average towards that price. A target below the current price, or on the wrong side of your present average, is out of reach however many shares you buy.

Do dividends change the average cost?

Cash dividends do not change it. Reinvested dividends are new purchases: add them as a row with the shares received and the reinvestment price.

Sources

Last updated:

More Finance calculators

People also use