Stock Average Calculator
Enter each purchase as shares and price per share, and get your average cost per share.
https://flxcode.com/stock-average-calculator/
One purchase per line: shares, then price, like 10 50. You can paste two columns from a spreadsheet.
Fees and commission for all purchases together. They are added to the cost.
Example Average cost per share
Average cost per share
Read 2 pairs.
No fees entered. If you paid fees or commission, type the total and it is added to the cost.
This is arithmetic on the numbers you typed. Cost basis rules differ by country and account.
| Purchases | 2 |
|---|---|
| Total shares | 30 |
| Total cost | 1,620 |
| Average cost per share | 54 |
The steps, with your numbers
Total shares: 10 + 20 = 30
Cost of the shares: 10 × 50 + 20 × 56 = 1,620
Average cost per share: 1,620 / 30 = 54
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it. What this tool keeps and sends.
Problem or idea? Email us
Quick start
- Put one purchase on each line: the number of shares, then the price per share. Two columns from a spreadsheet work.
- If you paid fees or commission, type the total in the fees box.
- Read the average cost per share, the total shares and the total cost.
The formula
average cost per share = (Σ shares × price + fees) / Σ shares
Each purchase counts in proportion to its shares. This is a weighted average of the prices you paid.
Worked examples
| Purchases (shares, price) | Fees | Total shares | Total cost | Average per share |
|---|---|---|---|---|
| 10 at 50, 20 at 56 | none | 30 | 1,620 | 54 |
| 10 at 50, 20 at 56 | 15 | 30 | 1,635 | 54.5 |
| 4 at 120.5, 6 at 98.25, 10 at 105 | none | 20 | 2,121.5 | 106.075 |
| 2.5 at 80, 1.5 at 92 | none | 4 | 338 | 84.5 |
The first row: 10 × 50 = 500 and 20 × 56 = 1,120, together 1,620 for 30 shares.
What this tool does not do
It adds up purchases and divides. It does not handle sales, it does not know your taxes and it gives no view on whether to buy or sell. Cost basis rules differ by country and account, so use your broker's statement for tax figures.
Numbers this uses
- Fees is one total, added to the cost. Type 0 or leave it empty for none.
- Shares is any amount above 0, fractions allowed. Negative shares are refused.
- Rounding is 6 significant digits on screen. Nothing is rounded to cents before dividing.
Common mistakes
- Averaging the prices without weighting them by the shares.
- Leaving out the fees when you want the cost you actually paid.
- Typing the total paid for a purchase where the price per share belongs.
In Excel and Google Sheets
Type the purchases in A1:B2: shares in column A, price per share in column B (10 at 50, 20 at 56). The formulas below work the same in both programs: every function name was checked against Google's function list.
| Task | Formula | Result |
|---|---|---|
| Total shares | =SUM(A1:A2) | 30 |
| Total cost | =SUMPRODUCT(A1:A2,B1:B2) | 1,620 |
| Average cost per share | =SUMPRODUCT(A1:A2,B1:B2)/SUM(A1:A2) | 54 |
Plain AVERAGE of the price column is wrong when the lots differ in size. Add fees to the total cost before you divide.
You can also paste the column into the box above, or open an .xlsx or .csv file with the Open button, and use Download .xlsx to get these formulas filled in with your own numbers.
For plain lists, see the average calculator, and for any value-and-weight pairs the weighted average calculator. Nothing you type or paste is uploaded. We count events without cookies (details).
FAQ
How do I calculate the average cost per share?
Multiply the shares of each purchase by its price and add the results. Then divide by the total number of shares. For 10 shares at 50 and 20 shares at 56 the cost is 1,620 for 30 shares, so the average is 54 per share.
Why is that not just the average of the two prices?
Because you bought more shares at one price. The plain average of 50 and 56 is 53, but 20 of the 30 shares cost 56, so the average cost per share is pulled up to 54. This is a weighted average, with the shares as the weights.
Where do I put the fees?
Type the total fees for all purchases in the fees box. They are added to the total cost before dividing. With 15 in fees the example goes from 54 to 54.5 per share.
Can I enter fractional shares?
Yes. 2.5 shares at 80 and 1.5 shares at 92 give 4 shares and an average of 84.5.
Can I enter a sale?
No. This tool only adds up purchases. A negative number of shares is refused and the line is named. What counts as the cost of what you still hold after a sale is set by your country and your account, so check with your broker or tax adviser.
Is this the same as the average of any list of numbers?
It is the same arithmetic as a weighted average. If you have values with weights that are not shares and prices, the average calculator has a weighted mode for grades, GPA and shop prices.
More from FLXCode
- Average CalculatorAverage (mean) of pasted numbers, or a weighted average for grades and prices, with the steps.
- Weighted Average CalculatorPaste values and weights, get the weighted average with every step and the SUMPRODUCT formula.
- Percentage Change CalculatorPercent increase or decrease from an old value to a new one, plus reverse and percentage points.
- Mean, Median, Mode CalculatorMean, median, mode and range of a list of numbers, with the working shown.