Stock Average Cost Calculator
Bought the same stock in several lots and sold part of it? Enter shares and prices in the order they happened (up to 20 trades), with one optional fee rate; the tool relieves cost on a FIFO basis and shows current holdings, remaining cost, average cost, and realized profit or loss per sell. It runs locally, never connects to a brokerage account, and uses the currency unit you enter.
Input
One rate applies to the whole list; 0 means no fees. 100 basis points = 1%. Buy fees add to cost, sell fees reduce proceeds; securities transaction tax is not included.
Trades
| Side | Shares | Price per share | Actions |
|---|---|---|---|
The 20-trade limit is reached; no more rows can be added.
Rules and limits
- At most 20 trades; shares are whole numbers from 1 to 999,999,999; price per share has up to 7 integer digits and 4 decimal digits, minimum 0.0001.
- Fee rate from 0 to 1000 basis points (0%–10%). Each fee is the trade amount times the rate, rounded half-up to 0.0001.
- Sells relieve the earliest buy lots first (FIFO); a lot that is fully relieved settles at exactly its remaining cost, leaving no rounding residue.
- Amounts are computed exactly in units of 0.0001 with no floating point; the average cost is rounded half-up to 0.0001.
- A sell larger than the shares held at that point fails the whole run and points at that sell row.
- Securities transaction tax, the health-insurance supplementary premium, and dividends are not included; results are estimates, not a brokerage statement or a tax document.
Enter trades, or load the example.
Example loaded. This is demo data, not your trade history.
Holdings summary and sell results
No shares held, so no average cost.
Sell details
No sells yet.
| Row | Shares | Proceeds | Cost relieved | Realized P&L |
|---|
Remaining lots
No remaining holdings.
| Lot | Shares | Cost basis |
|---|
Frequently asked questions
- How is sell cost relieved?
- FIFO: the earliest buy lots are relieved first, and a lot that is fully relieved settles at exactly its remaining cost.
- How are fees calculated?
- Each trade's fee is its amount times the rate, rounded half-up to 0.0001; buy fees add to cost, sell fees reduce proceeds. The rate is entered in basis points (100 bps = 1%). Securities transaction tax is not included.