What this calculator does
When shares in the same company are bought over time at different prices, the average share price is not a simple average of the purchase prices: it has to be weighted by how many shares were bought at each price. This average share price calculator takes any number of purchase lots and works out the weighted average, the total shares held and the total amount invested.
The mistake people make is averaging the prices directly and ignoring quantity. Buying 100 shares at $10 and then 10 shares at $20 gives a weighted average of about $10.91, not the $15 a naive average of the two prices would suggest, because the larger, cheaper purchase carries more weight.
The formula
Multiply each purchase price by the number of shares bought at that price, add those figures together to get total cost, then divide total cost by the total number of shares held. Enter one price per purchase lot and the matching quantity in the same position in the second list.
| Term | Meaning |
|---|---|
| Weighted average price | Total amount spent divided by total shares held, which accounts for how many shares were bought at each price. |
| Lot | One purchase transaction: a price and the quantity of shares bought at that price. |
| Total shares | The sum of shares across every lot entered. |
The inputs explained
| Field | What to enter |
|---|---|
| Purchase prices (comma separated) | The price paid per share in each purchase, separated by commas, one entry per lot. |
| Shares bought at each price (comma separated) | The number of shares bought in each purchase, in the same order as the prices above. |
When to use it
Dollar-cost averaging into a stock
Buying a fixed dollar amount of the same stock on a schedule means the price and quantity differ every time. This tool rolls all those purchases into one weighted average price for tracking gains or losses.
Working out your cost basis
Tax reporting and profit calculations both need a cost basis per share. The weighted average price, multiplied back by shares sold, gives that basis when shares were bought at different times and prices.
Deciding whether to average down
Before buying more shares of a stock that has fallen, running the existing holding plus the proposed new purchase through this calculator shows exactly where the new average would land.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How does adding a lower-priced top-up purchase move the average?
A fixed original holding of 100 shares at $10, with a second purchase of 50 shares at a range of lower prices.
Questions
Does this account for brokerage fees or commissions?
No, the prices entered should be the actual per-share price paid. If a purchase included a flat brokerage fee, add that fee to the total cost of that lot and divide by the number of shares to get an effective price to enter instead.
What if I sold some shares in between purchases?
This calculator only handles purchase lots being combined into an average. If shares were also sold, most cost-basis methods (such as first-in-first-out) require removing specific lots before recalculating the average on what remains, which this tool does not do automatically.
Can I use this for cryptocurrency or other assets, not just shares?
Yes, the weighted average formula works the same for any asset bought in multiple lots at different prices and quantities, whether that is shares, cryptocurrency, or units of a fund.
Why is the average closer to the price of the larger purchase?
The weighted average gives each purchase influence in proportion to how many shares it involved. A purchase of 150 shares pulls the average toward its price much more than a purchase of 10 shares does, even if the smaller purchase was at a very different price.
To work out the present value of a fixed stream of payments such as dividends over a set term, see the PV of annuity calculator.