How to use the calculator
- For the first purchase, enter how many shares you bought in Quantity. It must be greater than 0.
- Enter what you paid for one share in Purchase price. 0 is allowed, for shares you received at no cost.
- Select Add purchase to add another row, and fill in its quantity and price the same way.
- Select Remove on any row you no longer need. The button is switched off when only one row is left, because an average needs at least one purchase.
- Select Calculate to see the total shares, the total cost and the average purchase price.
- Select Reset example to go back to the values shown when the page opened.
Every input is a plain text box, so buttons and rows can be reached with the keyboard alone. Adding or removing a row clears the error messages, because the row numbers they refer to would otherwise point at the wrong purchase; the previous result stays on screen until you calculate again.
The values shown when the page opens are a hypothetical example chosen to show how the calculation works. They are not a stock recommendation or a real market price. This calculator holds no price, fee or tax figures of its own.
What average purchase price means
The average purchase price is the total amount you paid divided by the total number of shares you hold. When you buy the same stock several times at different prices, it answers the question “what did one share cost me on average?”
It is weighted by quantity, not a plain average of the prices. Buying 10 shares at 50 and 20 shares at 40 does not give an average of 45, because twice as many shares were bought at the lower price. The larger purchase pulls the average towards its own price.
The result describes what you paid, not what the shares are worth now. Comparing it with a current price is something you do yourself; this calculator never looks a price up.
Weighted-average formula
These are the formulas this calculator uses. Following them in order lets you check the result by hand.
Total shares = Σ qi
Total cost = Σ ( qi × pi )
Average purchase price = total cost ÷ total shares
- qi: the quantity of purchase i (greater than 0, decimals allowed)
- pi: the purchase price per share of purchase i (0 or more)
- Share of quantity = qi ÷ total shares, the weight that purchase carries
Because every quantity must be greater than 0 and at least one purchase is required, the total shares can never be 0, so the division is always defined. Intermediate values are never rounded; only the numbers on screen are tidied up for display, which is why adding the costs by hand can differ from the total by a very small amount.
Worked example
These are the same values the calculator shows when the page opens. They are a hypothetical example, not a stock recommendation or a real market price.
- Purchase 1: 10 shares at 50 → cost 10 × 50 = 500
- Purchase 2: 20 shares at 40 → cost 20 × 40 = 800
- Total shares = 10 + 20 = 30
- Total cost = 500 + 800 = 1,300
- Average purchase price = 1,300 ÷ 30 = about 43.33
Notice that the answer is not 45, the plain average of 50 and 40. The second purchase carries two thirds of the total quantity, so its weight is about 66.7% against 33.3% for the first, and the average lands much closer to 40 than to 50.
Multiple purchases
Add one row per purchase and the calculator keeps them in the order you entered them. Up to 50 purchases can be calculated at once, which is the limit the calculation engine enforces.
- Quantity must be greater than 0. A quantity of 0 would add nothing to the total and makes the weighting meaningless, so it is refused.
- A purchase price of 0 is allowed. It adds 0 to the total cost while still adding shares, which pulls the average down — useful for shares received at no cost.
- Fractional quantities are accepted, so partial shares can be entered as they are.
- Negative values, empty boxes and letters are refused, and the calculator tells you which purchase and which box is wrong.
- Selling shares is not modelled here. This page only averages purchases.
The breakdown table shows the cost of each purchase and its share of the total quantity, so you can see exactly which purchase moved the average and by how much. On a narrow screen the table scrolls sideways on its own without pushing the page out of shape, and it can be scrolled with the keyboard.
Assumptions and limitations
- The result is a quantity-weighted average purchase price, not a plain average of the prices.
- Live stock prices are never looked up. Nothing on this page is fetched from a market data source.
- Brokerage fees are not automatically included.
- Taxes are not automatically included.
- Exchange rates are not automatically included. No currency conversion happens anywhere on this page.
- Market data is not automatically included.
- No fee or tax input is offered, because the calculation engine has none. Nothing beyond quantity and price is asked for or added.
- Because of that, the figure can differ from the average price your broker shows, since brokers usually fold commissions and taxes into their own number.
- Corporate actions such as splits, mergers or dividends are not adjusted for.
- Results are informational estimates based only on the values you enter.
- They are not investment, legal or tax advice, and no specific stock is recommended.
- Intermediate values are not rounded; only the numbers on screen are rounded for display.
- Your inputs are calculated only in this browser and are never sent to or stored on a server.
Frequently asked questions
How do you calculate an average purchase price?
Multiply the quantity of each purchase by its price to get that purchase's cost, add all the costs together, then divide by the total number of shares. For example, 10 shares at 50 costs 500 and 20 shares at 40 costs 800, so 1,300 divided by 30 shares gives an average purchase price of about 43.33.
Why is the answer not the plain average of the prices?
Because the average is weighted by quantity. Buying 10 shares at 50 and 20 shares at 40 puts twice as many shares at the lower price, so the average lands near 43.33 rather than 45. The breakdown table shows each purchase's share of the total quantity so you can see the weighting.
How many purchases can I add?
Up to 50 in one calculation, which is the limit the calculation engine enforces. Use Add purchase to append a row and Remove to delete one. The remove button is switched off when only one row is left, because an average needs at least one purchase.
Can I enter fractional quantities?
Yes. Quantities accept decimals, so partial shares can be entered exactly as they are. The only rule is that a quantity must be greater than 0, since a quantity of 0 would add nothing to the total and make the weighting meaningless.
Can the purchase price be 0?
Yes. A price of 0 adds no cost while still adding shares, which pulls the average down. That is the right behaviour for shares you received at no cost. Negative prices are refused, and so are empty boxes and letters.
Does this calculator include brokerage fees and taxes?
No. It holds no fee rate or tax rate, never guesses one, and offers no box to enter them because the calculation engine does not model them. If you want fees included, add them into the price you enter yourself. Exchange rates are not applied either.
Does it look up the current stock price?
No. Nothing is fetched from a market data source, so the calculator has no idea what the stock is worth today. It only tells you what you paid on average. Comparing that with the current price is something you do yourself.
Why does my broker show a different average price?
Brokers usually fold commissions, taxes and sometimes exchange rates into their own average, and they may adjust for corporate actions such as splits. This page uses only the quantities and prices you type in, so the two numbers can legitimately differ.
Are my inputs stored?
No. The calculation runs entirely in your browser, and your inputs are never sent to or stored on a server.
Related calculators
Once you know what your shares cost on average, the next question is usually how the position has done. The ROI Calculator takes the total cost you found here as the investment cost and compares it with whatever you got back.
If you also want the result expressed per year, the Investment Return Calculator adds a period and any extra money you put in. To look forward instead of back, the Compound Interest Calculator takes a principal, an expected annual return and a period. It is a hypothetical simulation and guarantees no return.