Stock average cost calculator
Combine share purchases into an average cost, break-even price and gain or loss.
A clear answer. Here’s how.
Average cost per share = (Σ shares × price + purchase fees) ÷ total shares. The break-even sale price adds expected selling fees to the cost before dividing by the shares. Gain or loss compares market value, less selling fees, with the total cost. Handles purchases only: sales, splits, dividends, currency conversion and tax-lot rules are outside its scope.
How this is checked
3 reference checks passed These 3 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Purchases (CSV) Shares,Price,Fees 100,10.00,5 50,16.00,5Current price per share 15Expected selling fees (total) 5
- Expected, and what Toolmoz gave
- Total shares expected 150, Toolmoz 150Total cost including fees expected 1810, Toolmoz 1810Average cost per share expected 12.066666666666666, Toolmoz 12.066666666666666Break-even sale price per share expected 12.1, Toolmoz 12.1Market value at current price expected 2250, Toolmoz 2250Gain or loss after selling fees expected 435, Toolmoz 435
- Where the expected answer comes from
- Cost = 100 × 10 + 5 + 50 × 16 + 5 = 1000 + 5 + 800 + 5 = 1810 for 150 shares, so 12.0667 each. Break-even = (1810 + 5 selling fees) ÷ 150 = 12.1. Value = 150 × 15 = 2250; gain = 2250 − 5 − 1810 = 435
- Allowed difference
- ±1e-9
Case 2
- Inputs
- Purchases (CSV) Shares,Price,Fees 10,100,0Current price per share 90Expected selling fees (total) 0
- Expected, and what Toolmoz gave
- Total shares expected 10, Toolmoz 10Average cost per share expected 100, Toolmoz 100Market value at current price expected 900, Toolmoz 900Gain or loss after selling fees expected -100, Toolmoz -100
- Where the expected answer comes from
- One lot of 10 at 100 costs 1000; at 90 it is worth 900, a loss of 100
- Allowed difference
- ±1e-9
Case 3
- Inputs
- Purchases (CSV) Shares,Price,Fees 10,100,0 10,50,0Current price per share 75Expected selling fees (total) 0
- Expected, and what Toolmoz gave
- Total shares expected 20, Toolmoz 20Total cost including fees expected 1500, Toolmoz 1500Average cost per share expected 75, Toolmoz 75Gain or loss after selling fees expected 0, Toolmoz 0
- Where the expected answer comes from
- Cost = 1000 + 500 = 1500 for 20 shares = 75 each; selling at 75 returns 1500, so the gain is 0
- Allowed difference
- ±1e-9
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Purchases (CSV)
Shares,Price,Fees 100,10.00,5 50,16.00,5
- Current price per share
- 15
- Expected selling fees (total)
- 5
Example result
- Purchases
- 2
- Total shares
- 150
- Total cost including fees
- 1,810
- Average cost per share
- 12.0666666667
- Break-even sale price per share
- 12.1
- Market value at current price
- 2,250
- Gain or loss after selling fees
- 435
- Return on cost
- 24.03%
Average cost = (Σ shares × price + purchase fees) ÷ total shares. Break-even adds your expected selling fees. Counts purchases only: it does not model sales, splits, dividends, currency changes or tax rules, and tax-lot methods (FIFO, average cost basis rules) vary by country.