Average Cost and Cost Basis Calculator
What do these lots average out to, and what is the position worth now?
What this tells you: One lot at a time, the page adds up quantity and cost, and reports the average cost per unit with the fees folded in. Type a current price and the same figures give the market value and the unrealized gain or loss, in money and as a share of the cost.
Go to the calculatorAlso called: average down calculator · average price calculator · share averaging calculator Read the guide Last updated
Result
3 lot(s) come to 40 units at a total cost of 3,600, an average cost of 90 a unit.
Method: Average cost = (lot costs + fees) ÷ total quantity, with the quantity multiplied by any split or bonus ratio; the gain is the price you type × quantity minus that cost, shown as a share of the cost.
This tool shows math, not advice.
Details
| Total quantity | 40 |
|---|---|
| Total cost, lots plus fees | 3,600 |
| Average cost per unit | 90 |
| Lot | Quantity | Price paid | Cost | Share of quantity |
|---|---|---|---|---|
| 1 | 10 | 100 | 1,000 | 25.0% |
| 2 | 10 | 80 | 800 | 25.0% |
| 3 | 20 | 90 | 1,800 | 50.0% |
How we got this
- Average cost = total cost ÷ total quantity = 3,600 ÷ 40 = 90 a unit.
About this answer
- The average cost is the break-even price: the price the position has to trade at for the value to equal the cost, fees included.
Did this calculator help?
Keep this calculator. Your numbers are in the address, so a bookmark brings them back exactly as you left them. Press Ctrl + D · ⌘ + D
What to do next
Calculators that usually come after this one.
-
Stock Profit and Loss Calculator
After charges, what do I actually make or lose on this trade?
-
Brokerage and Charges CalculatorIndia
What does this trade net after every charge, and where is the break-even?
-
Position Sizing Calculator
How many shares can I buy and still lose only a small amount if I am wrong?
Not quite what you need?
Type your question in plain words and get the calculators that answer it.
No exact match. Try other words, or browse every calculator. Browse all calculators
How to use it
- Type one lot per line: quantity, then the price per unit paid.
- Add the fees once if there are charges to fold in.
- Optionally type the current price for the value and the gain.
Example
Lots of 10 at 100, 10 at 80 and 20 at 90 come to 40 units at a total cost of 3,600, an average cost of 90 a unit; at a current price of 95 the position is worth 3,800, a gain of 200 or 5.56%.
Type these numbers into the boxes
- Your purchases, one per line
- 10, 100 10, 80 20, 90
- Fees
- 0
What you get: 3 lot(s) come to 40 units at a total cost of 3,600, an average cost of 90 a unit.
What your answer means
The average cost is the break-even price: below it the position shows a loss, above it a gain, fees included. Each buying price keeps its own line in the table, so a later lot at a lower price pulls the average down by exactly the arithmetic shown.
Words explained
- Average price
- the total cost divided by the total quantity, the figure a run of purchases averages out to.
- Capital gain
- the difference between what the position is worth now and what it cost; unrealized until sold.
How we calculate · the conventions behind every answer, in one place.
What this cost basis calculator does
Type one lot per line — quantity, price paid — and the page adds the position up: total quantity, total cost with the fees folded in, and the average cost per unit. A table lists each lot with its cost and its share of the quantity, so the average is visible lot by lot rather than only as a result.
A current price turns the same figures into the market value and the unrealized gain or loss, in money and as a share of the cost, with the average cost shown beside it as the break-even price. Leave the price blank and the page sticks to the cost side.
The arithmetic works for stocks or coins, one lot per line, with no asset named anywhere. Fees are typed once and added to the total cost, which is where they belong in an average.
Questions about the average cost calculator
How is the average cost worked out?
Add the cost of every lot and divide by the total units. With lots of 10 units at 100, 10 at 80 and 20 at 90, the total quantity is 40 and the total cost is 3,600. So the average is 3,600 ÷ 40 = 90 a unit.
Why is the average not just the mean of the prices?
Each lot is weighted by its number of units. The three prices are 100, 80 and 90, but the lot at 90 has 20 units, twice as many as each of the others. The weighted average takes this into account. Here it comes to 90 a unit.
How do I type the lots?
Type one lot per line, as the number of units, a comma, then the price per unit. The default example is three lines: 10, 100; 10, 80; and 20, 90. The page adds them up and shows the total quantity, the total cost and the average cost.
Are fees included in the cost basis?
Yes, if you type them. The fees box adds a cost to the total, which raises the average cost per unit. In the default case fees are 0, so the total cost is 3,600 from the lots alone. Cost basis is the total you paid to buy the holding.
Does this calculator work out tax on a sale?
No. It gives the average cost of what you hold. Tax rules for gains differ by place, and some use oldest-first matching of lots rather than the average. The page does not choose a method for tax. It shows the average from the lots and fees you type.
What if I sell only part of a holding?
Then which lots you sell changes the gain. With 100 units bought at 50, 100 at 80 and 100 at 40, selling 150 at 90 gives a gain of 4,500 if the oldest lots go first, 3,000 if the highest-cost lots go first, 7,000 if the lowest-cost lots go first, and 5,000 at the average cost. The which lots to sell calculator works out each of these from your own lots. Open the which lots to sell calculator.
Ask about this calculator
Something the page does not answer? Ask it here. A person reads every question, and the useful ones are answered on this page.
Cite this page
Copy this line into a reference list, a report or a spreadsheet note.
Investment Math Calculator. “Average Cost and Cost Basis Calculator”. Updated 2026-11-30. https://investmentmathcalculator.com/tools/cost-basis/
This tool shows math, not advice.
Disclaimer: For education only. These calculators show arithmetic and hypothetical scenarios. They are not investment, tax or legal advice and do not recommend any security or product. Consult a licensed adviser in your country before acting.