What this calculator does
Find out what you paid per share, on average, after buying the same stock more than once. Enter how many shares you bought each time and the price you paid. You'll get your average cost per share, your total shares and your total cost.
The second mode answers a common question after a price drop. How many shares should I buy now to bring my average down to a set price? Enter what you own, your current average, today's price and the average you're aiming for. The calculator tells you how many shares to buy and what they'll cost. It also works the other way, for averaging up when the price has risen.
Where it's used
Why this math matters outside the classroom:
- Checking a brokerage account. An investor checks that 300 shares costing $10,525 in total really averages about $35.08 a share.
- Averaging down. Someone holding 200 shares at a $50 average buys 200 more at $30 to bring the average to $40.
- Planning an order size. A trader works out how many shares at today's price it would take to move an average up from $20 to $25.
- Algebra practice. Students solve (200 × 50 + 30x) ÷ (200 + x) = 40 for x, which gives 200 shares.
- Comparing averages. A class compares the plain average of three prices with the share-weighted average to see why they differ.
Grade level and standards: Grades 7–8; Common Core State Standards for Mathematics 8.EE.C.7.b, 7.EE.B.3. © Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.
How to use it
- Pick a mode: the average cost of purchases you've made, or the shares to buy to reach a target average.
- For the average, list the shares from each purchase and the matching prices, in the same order.
- For a target, enter the shares you own, your average cost, the price you can buy at now and your target average.
- Read the result, and check the table or the whole-share answer before you place an order.
What the inputs mean
- Shares bought each time
- One number per purchase, separated by commas. Fractional shares like 2.5 are fine. A row of 0 is allowed, as long as some purchase has shares.
- Price per share each time
- The price per share for each purchase, in the same order as the share counts. To include a trading fee, add the fee divided by the shares to that price.
- Your current average cost per share
- Your current average cost per share. Your brokerage account usually shows it as cost basis per share. You can also find it with the first mode.
- Price you can buy at now
- The price you expect to pay for the new shares. Your average can move toward this price but never reach or pass it.
- Target average cost per share
- The average you want to end up with. It must fall between your current average and the new price.
Formula and method
average cost = (s₁ × p₁ + s₂ × p₂ + …) ÷ (s₁ + s₂ + …) new average = (S × A + x × P) ÷ (S + x) shares to buy: x = S × (A − T) ÷ (T − P)
In the first line, s is the shares in each purchase and p is its price. The top adds up what you spent, and the bottom adds up the shares. This is a weighted average: a purchase of 150 shares counts three times as much as one of 50.
In the other lines, S is the shares you own, A is your current average and P is the price you can buy at now. T is your target average and x is the number of new shares. Set the new average equal to T, then solve for x. That gives the last line.
The last line only works when T sits between A and P. Each new share pulls your average toward P. You'd need endlessly many shares to reach P exactly, so a target at P or beyond it is impossible.
Worked example
You bought 100 shares at $42, then 50 shares at $36.50, then 150 shares at $30.
- Cost of each purchase: 100 × $42 = $4,200; 50 × $36.50 = $1,825; 150 × $30 = $4,500.
- Total shares: 100 + 50 + 150 = 300.
- Total cost: $4,200 + $1,825 + $4,500 = $10,525.
- Average cost: $10,525 ÷ 300 ≈ $35.08 a share.
Result: Your average cost is about $35.08 a share. That's below the plain average of the three prices, about $36.17, because your biggest purchase was at the lowest price.
Understanding the result
Your average cost tells you the price at which you'd break even if you sold everything, before fees and taxes. Above it you have a gain; below it you have a loss.
A lower average doesn't mean you've lost less money. If the price fell, buying more just puts more money at today's price. Whether that's wise depends on the company, not on the math.
The closer your target is to the new price, the more shares you need. Each step closer costs more than the one before.
Assumptions and limitations
- Every purchase is the same stock, and no shares have been sold.
- Fees and commissions aren't included unless you add them to the prices.
- Fractional shares are allowed. The whole-share answer rounds up, so it reaches or passes your target.
- Stock splits, dividends you reinvest and other events that change your share count aren't handled. Enter shares and prices adjusted for any split.
- The average cost here may differ from the cost basis your tax forms use. Tax rules about which shares you sold first, and about wash sales, can change it.
- The target mode assumes you buy all the new shares at one price. Prices move while you buy, so the result is a guide.
- This is arithmetic, not investment advice. It can't tell you whether buying more is a good idea.
Frequently asked questions
How many shares do I need to buy to average down?
Use x = S × (A − T) ÷ (T − P). Say you own 200 shares at a $50 average and the price is now $30. To get to a $40 average, you'd buy 200 × 10 ÷ 10 = 200 shares, costing $6,000.
Why can't I reach a target at or below the new price?
Every new share costs the new price, and your old shares cost more. So the mix always averages above the new price. Buying more brings you closer, but you never quite get there.
Why isn't my average cost the plain average of my prices?
A plain average treats every purchase the same, however many shares it bought. Your real average weights each price by its shares. In the example, the plain average is about $36.17, but the real average is about $35.08.
Should I include fees?
If you want your true break-even price, yes. Divide each purchase's fee by its shares and add that to the price. A $5 fee on 100 shares adds $0.05 a share.
How is this different from the dollar-cost averaging calculator?
That one models investing the same dollar amount on a schedule and compares the result to today's price. This one adds up any mix of purchases, then answers how many shares to buy to reach a target average.
How this calculator is checked
Method: Weighted mean of purchase prices by share count. Shares to buy from solving (S × A + x × P) ÷ (S + x) = T for x, which gives x = S(A − T) ÷ (T − P). The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-26. Found a problem? Tell us.
Embed this calculator
Put this Stock Average Calculator on your own website or blog for free. Paste this code where you want it to appear: