Stock Average Calculator
Find your average cost per share across several buys and sells, your break-even price, and how many shares to buy at today's price to reach a target average.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Stock Average Calculator?
When you buy the same stock several times at different prices, the number that matters is your average cost per share: the total you paid, fees included, divided by the shares you hold. The Stock Average Calculator works it out from a list of trades, shows the running average after each one, and turns it into the figures you act on: cost basis, break-even sell price, market value and unrealized gain or loss at the current price.
The "what if" panel answers the averaging-down question directly. Type a target average and the calculator tells you how many shares to buy at today's price, and what they cost, to get there. Or type a number of shares and see where the average lands. The same maths works for averaging up when the price is above your cost.
Sells are supported too. Using the average cost method, a sale removes shares at your current average, so the average does not change, and the calculator books the realized gain or loss. Everything runs in your browser.
- Weighted average cost across any number of buys, with fees
- Sells under the average cost method with realized gain or loss
- Running average after every trade
- Shares needed to reach a target average at the current price
- Break-even price, market value and unrealized gain
- Share link that stores your trades, runs in your browser
How to use the Stock Average Calculator
- Enter each trade in date order: choose Buy or Sell, then the number of shares, the price per share and the fee for the whole trade.
- Add or delete rows as needed. The average is recalculated after every trade in the running-average table.
- Enter the current share price to see market value and unrealized gain or loss.
- To average down or up, type a target average to get the shares and cash needed, or type a number of shares to buy and see the new average.
- Add a sell fee if you want the break-even price to include it, then copy or share the result.
Worked examples
Two buys at different prices
Input
Buy 100 at $50, buy 50 at $40
Output
Average $46.6667; cost basis $7,000; 150 shares
($5,000 + $2,000) / 150. The simple average of the two prices, $45, understates the cost because more shares were bought at $50.
Shares needed to average down
Input
Same position, current price $30, target average $38
Output
Buy 162.5 shares for $4,875; new average $38.00
150 x (46.6667 - 38) / (38 - 30) = 162.5. The position more than doubles, which is the hidden cost of averaging down.
Buying a fixed number of shares
Input
Same position, buy 100 more at $30
Output
New average $40.00
($7,000 + $3,000) / 250 = $40. The stock has to climb back to $40 for you to break even, rather than $46.67.
A partial sale
Input
Buy 100 at $50, buy 100 at $30, sell 50 at $45 with a $10 fee
Output
Average stays $40; 150 shares left; realized gain $240
Under the average cost method the 50 shares leave at $40 each, so the gain is 50 x ($45 - $40) - $10.
Background and insight
The average cost is a weighted average, not the average of the prices. Buying 100 shares at $50 and 50 shares at $40 costs $7,000 for 150 shares, an average of $46.67, not $45, because more shares were bought at the higher price. Fees belong in the cost: a $5 commission on each of two buys adds $10 to the basis and raises the average slightly.
Averaging down solves one equation. If you hold S shares at an average A and buy n more at price P, the new average is (S x A + n x P) / (S + n). Setting that equal to a target T and solving gives n = S x (A - T) / (T - P). The target must lie between the current price and your average: buying at $30 can pull a $46.67 average toward $30 but never to $30 or below, and the closer the target gets to the price, the more shares it takes. Reaching $38 from 150 shares at $46.67 takes 162.5 shares costing $4,875.
For taxes, the cost basis rules in IRS Publication 550 and Treasury regulation 1.1012-1 apply. For individual stocks the default is first in, first out (FIFO), unless you tell your broker which specific lots you are selling; the average basis method is allowed for mutual fund shares and shares acquired through a dividend reinvestment plan. So the average shown here is right for judging your position and break-even, but the gain your broker reports on Form 1099-B can differ if it uses FIFO or specific lots.
Common use cases
Deciding whether to average down
See exactly how many shares and how much cash it takes to move your average to a level you care about.
Setting a break-even sell price
Know the price at which selling the whole position covers every purchase and fee.
Tracking a position built over time
Keep a running average for regular purchases of the same stock or ETF.
Checking a broker statement
Reconcile the average cost your broker shows with your own trade history.
Tips and limitations
- A lower average does not make a losing investment better; it only means the price has to recover less. Ask whether you would buy the stock today with fresh money.
- Averaging down increases your position size and concentration. Check what share of your portfolio the stock becomes.
- Include commissions and fees in each trade so the average and break-even are true.
- Stock splits change share counts and prices together. Enter trades split-adjusted (multiply shares and divide prices by the split ratio) so the average stays comparable.
- Reinvested dividends are purchases too; add them as buys if you want an exact basis.
- Your broker's tax basis may use FIFO or specific lots, so realized gains on Form 1099-B can differ from the average cost shown here.
Frequently asked questions
How do I calculate my average cost per share?
Add up what you paid for every purchase, including fees, and divide by the total number of shares. 100 shares at $50 plus 50 shares at $40 cost $7,000 for 150 shares, so the average is $46.67.
How many shares do I need to buy to average down?
Use n = shares held x (current average - target) / (target - current price). From 150 shares at $46.67, reaching $38 by buying at $30 takes 150 x 8.67 / 8 = 162.5 shares. The target must be between the price and your average.
Does selling shares change my average cost?
Not under the average cost method used here. A sale removes shares at the current average, so the remaining shares keep the same average and the difference between the sale price and the average is your realized gain or loss.
What is my break-even price?
It is your cost basis divided by the shares you hold, plus any selling fee spread across the shares. If you paid $7,000 for 150 shares, you break even selling at $46.67 before tax.
Why is my average not the average of the prices I paid?
Because it is weighted by the number of shares at each price. A simple average of prices treats a 10-share buy the same as a 1,000-share buy, which gives the wrong cost.
Is this the same cost basis my broker reports for taxes?
Not always. For individual stocks the IRS default is first in, first out unless you choose specific lots; average basis is allowed for mutual funds and dividend reinvestment shares. Your 1099-B can therefore show a different gain than this average.
Is there an in-depth guide to the Stock Average Calculator?
Yes. “Average Cost per Share: Averaging Down, Break-Even and Cost Basis” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
People also search for
- how to calculate average cost per share of stock
- how many shares do i need to buy to average down
- stock average down calculator with target price
- what is my break even price on a stock
- does selling shares change my average cost
- weighted average stock price with commissions
- average up stock calculator
- average cost basis vs fifo for stocks
Related Tools You May Like
Free, in-browser tools that pair well with this one.