Average Stock Price Calculator
Average cost = (sum of quantity × price + fees) ÷ total shares. 10 shares at 50 and 10 at 40 average 45.00. To pull that down to 42 with the stock at 35 you need (900 − 42 × 20) ÷ (42 − 35) = 8.57, so 9 more shares, leaving an average of 41.90 (weighted average cost, fees included when entered).
How to use
- List your purchases, one per line: quantity, price and, if you want fees counted, the fee for that trade. Separate the numbers with a space or @, for example 10 @ 50.5 1.
- Leave the unit on shares, or switch it to lots of 100 shares if you buy in lots.
- In Average mode the big number is your average cost per share including fees, with total shares and total cost below it.
- In Target mode enter the average you want, today's price and the fee for the new trade. You get the number of shares to buy, the amount that costs, and the average you end up with.
How it works
Average cost = (Σ quantity × price + Σ fees) ÷ Σ quantity. Each purchase is weighted by how many shares it was, so a big buy at a high price moves the average more than a small buy at a low price.
Target mode solves (C + x × p + F) ÷ (Q + x) = A for x, where C is the total cost with fees, Q the shares held, p today's price, F the fee on the new trade and A the target. x = (C + F − A × Q) ÷ (A − p).
The target can only be reached if it lies between today's price and your current average. Buying below your average pulls it down towards the price, but never below the price itself. The calculator rounds the number of shares up, so the result is at or just past the target.
Prices are used as entered, in one currency. Taxes, currency conversion, dividends and splits are not included, and your broker's tax cost basis can follow different rules (such as first-in first-out).
Targets for the same position
10 shares bought at 50 and 10 at 40 (average 45.00), with the price now at 35. Plain numbers in any one currency.
| Target average | Shares to buy | Cost of those shares | Average after |
|---|---|---|---|
| 44 | 3 | 105 | 43.70 |
| 43 | 5 | 175 | 43.00 |
| 42 | 9 | 315 | 41.90 |
| 40 | 20 | 700 | 40.00 |
FAQ
How do I calculate the average price of a stock I bought several times?
Add up what you paid for each buy (shares × price, plus fees) and divide by the total number of shares. 10 shares at 50 and 10 shares at 40 cost 900 for 20 shares, an average of 45.
How many shares do I need to buy to lower my average to a target?
Use x = (cost − target × shares) ÷ (target − price). With 20 shares costing 900, a price of 35 and a target of 42: 8.57 shares, which rounds up to 9.
Why can't I reach some targets?
Buying at today's price only moves your average towards that price. A target below today's price is out of reach, and so is one on the other side of your current average. To lower the average past today's price you would need the price itself to fall.
Are fees included?
Yes, if you enter them. The big number is the average including fees, which is the break-even price per share. The average without fees is shown beside it when fees are present.
Is the average the same as my tax cost basis?
Not necessarily. This is the simple weighted average of your buys. Many brokers report cost basis by specific lot or first-in first-out, so check your broker's statement for tax purposes. This tool is not tax advice.