Transparent method
The formula
Worked example
Example inputs
How to interpret the result
Average purchase price and total cost basis look similar but answer subtly different questions once trading fees and multiple purchase lots enter the picture, and using the wrong one of the two against an entered average price can produce a profit or loss figure that doesn't match what a brokerage statement or tax form actually reports.
Before you rely on it
What to check
Confirm the entered average price reflects the correct total cost basis, fees included, across all purchase lots, rather than a simple average of quoted share prices alone.
The common error
Where people go wrong with stock average cost calculator
Calculating profit or loss against a simple average of purchase prices that excludes trading fees or misses a purchase lot. The resulting figure can diverge from the actual cost basis a brokerage statement or tax form would show.
Sensitivity evidence
How shares changes the net profit or loss
| Shares | Net profit or loss | Return on cost |
|---|---|---|
| 80 | $1,180 | 36.8% |
| 90 | $1,330 | 36.8% |
| 100worked example | $1,480 | 36.9% |
| 110 | $1,630 | 37.0% |
| 120 | $1,780 | 37.0% |
Every input, tested
Which input moves the net profit or loss most
| Input | Tested from | To | Net profit or loss at each end | Swing |
|---|---|---|---|---|
| Sale price | $50 | $61 | $980 to $2,080 | $1,100 (74%) |
| Average buy price | $36 | $44 | $1,880 to $1,080 | $800 (54%) |
| Shares | 90 | 110 | $1,330 to $1,630 | $300 (20%) |
| Trading fees | $9.00 | $11 | $1,482 to $1,478 | $4.00 (0.3%) |
Two variables at once
Net profit or loss by shares and average buy price
| Shares \ Average buy price | $32 | $40 | $48 |
|---|---|---|---|
| 80 | $1,820 | $1,180 | $540 |
| 90 | $2,050 | $1,330 | $610 |
| 100 | $2,280 | $1,480 | $680 |
| 110 | $2,510 | $1,630 | $750 |
| 120 | $2,740 | $1,780 | $820 |
Step by step
The worked example, input by input
| Input | Value used |
|---|---|
| Shares | 100 |
| Average buy price | $40 |
| Sale price | $55 |
| Trading fees | $10 |
| Net profit or loss | $1,480 |
| Return on cost | 36.9% |
Where the inputs come from
Use this when you bought the same stock at different prices. Enter the number of shares held, the blended average price you paid, and the price at which you would sell, plus total fees. To find the blended price, add the total dollars spent and divide by total shares, not the average of the prices. Brokerage cost-basis reports do this automatically.
When the result stops applying
The tax basis is not always the blended average: brokers default to specific methods such as first-in, first-out for shares, and average cost applies mainly to mutual funds. The lot you sell determines the taxable gain. The result also ignores dividends, splits and reinvested shares, each of which changes basis.
What to compare it with
Use the stock profit calculator for a complete profit figure and the stock split calculator if a split changed your share count. The position size calculator helps decide how much to add. Look at the cost-basis method in your brokerage settings before selling, since changing it later is usually not possible.
People also ask
Frequently asked questions
How do I calculate my average cost per share?
Divide the total dollars spent on all purchases, including fees, by the total shares owned. Averaging the prices instead gives the wrong answer when the share counts differ.
Does averaging down make sense?
It can lower your break-even, but it also increases exposure to a stock that has fallen. It makes sense only if you would buy the stock at the lower price anyway.
Which lots does my broker sell first?
Most default to first-in, first-out, but you can usually pick specific lots or another method, which affects your tax bill.