Finance / Investing
Stock Average Calculator
Calculate average cost from buys and sells with fees, then solve how many shares at a new price reach a target average.
Stock Average Calculator: Uses average-cost accounting. Buy fees increase the position basis. Sells remove a proportional share of that basis; sell fees reduce proceeds and realised profit. A sale leaves the average cost of the remaining position unchanged. The target-average solver allows fractional shares. This is bookkeeping arithmetic, not investment advice or a tax-lot election. Runs 100% locally in your browser with zero server file uploads.
- Category
- Business & admin tools
- Runs
- In your browser
- Cost
- Free · no sign-up
- Availability
- Ready to use
Runs entirely in your browser
These are arithmetic tools, not investment advice. Enter every figure yourself; no market data is fetched.
Use buy or sell in the first column; the fee column is optional. Average-cost accounting includes buy fees in the position basis. A sale removes proportional basis; sale fees reduce realised proceeds. Remaining average cost stays the same after a sale. This is bookkeeping arithmetic, not a tax-lot rule.
| Trade | Side | Shares | Price | Fee | Remaining shares | Remaining basis | Average cost | Cumulative realised profit |
|---|---|---|---|---|---|---|---|---|
| 1 | Buy | 100 | $10.00 | $0.00 | 100 | $1,000.00 | $10.00 | $0.00 |
| 2 | Buy | 50 | $7.00 | $0.00 | 150 | $1,350.00 | $9.00 | $0.00 |
Currency changes formatting only. It does not convert amounts.
Average-cost method
The method is defined here for a single remaining position. New basis = old basis + purchase quantity × price + buy fee. Sale basis removed = old basis × sold quantity / old quantity. No tax-lot selection is performed.
Weighted average and target
NIST Dataplot Reference Manual, weighted mean: sum of weight × value divided by sum of weights. Here the weights are share quantities. Official source: https://www.itl.nist.gov/div898/software/dataplot/refman2/ch2/weigmean.pdf
Average cost = remaining basis / remaining shares. New quantity = (current basis + new fee − target average × current shares) / (target average − new price). Worked example: 100 shares at 10 plus 50 at 7 gives 1350 / 150 = 9. For equal cash purchases, compare the dollar-cost averaging calculator.
How to use it
- Paste chronological buy and sell rows with shares, price and an optional fee.
- Read the remaining shares, average cost, cost basis and realised profit or loss.
- Enter a new purchase price, target average and fee to solve for additional shares; export the trade table if needed.
Privacy & limitations
All figures are entered by you and stay in your browser. No market data, tickers or prices are fetched. These are arithmetic tools, not investment advice.
Related tools
Frequently asked questions
How are sells handled?
A sale removes sold shares multiplied by the average cost immediately before the sale. Sale proceeds less fees and removed basis give realised profit or loss. Selling more shares than held is rejected.
How do I average up or down?
Choose a target strictly between the current average and the new purchase price. The result solves the weighted-average equation, including a fee for the new purchase.
Is this a tax calculator?
No. Average cost is the stated bookkeeping method. Tax basis and allowable disposal methods depend on applicable rules and are outside this tool.
Free tool · runs in your browser · no account required