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
- 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).
- Add rows with the + button; leave a row blank to ignore it. Fractional shares are allowed.
- Optionally enter the current share price to see the market value and the gain or loss.
- Optionally enter the selling fee you expect to pay; it is included in the break-even price.
- 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 of shares at price with fees :
The average price before fees drops the terms. With shares, total cost and a selling fee , the break-even price is , and at a market price the unrealized gain is .
To reach a target average by buying more shares at price , solve :
which has a positive solution only when lies between the current average and .
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 for 200 shares, so
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
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
- IRS Publication 550, Investment Income and Expenses — Basis of investment property and average basis
- Investor.gov (SEC) — Average cost basis
- BOFiP BOI-RPPM-PVBMI-20-10-20-40 — Weighted average acquisition price rule (French tax administration, in French)
Last updated: