Tax Lot Calculator: Which Lots to Sell
Which shares count as sold, and how much does that change my gain?
What this tells you: When you bought the same investment several times at different prices, a sale can be matched to different purchases. The money you receive is the same, but the cost taken out, and so the gain, is not. This page runs one sale through five common ways of choosing the lots and shows the gain and the cost left on what you keep.
Go to the calculatorAlso called: FIFO vs LIFO calculator · highest cost first calculator · specific identification calculator · HIFO calculator · realized gain calculator Last updated
Result
Selling 150 units at 90 gives a gain from 3,000 (Highest cost first) to 7,000 (Lowest cost first), depending on which lots count as sold. First in, first out gives 4,500.
Method: Gain = units sold × sale price − the cost of the units taken out, where each method takes them from the lots in its own order and average cost uses the average of every lot.
This tool shows math, not advice.
Details
| Money from the sale | 13,500 |
|---|---|
| Gain, first in first out | 4,500 |
| Gain, last in first out | 5,500 |
| Gain, highest cost first | 3,000 |
| Gain, lowest cost first | 7,000 |
| Gain, average cost | 5,000 |
| Gap between the largest and smallest gain | 4,000 |
| Method | Cost of the units sold | Gain or loss | Cost of what is left | Average cost of what is left |
|---|---|---|---|---|
| First in, first out | 9,000 | 4,500 | 8,000 | 53.33 |
| Last in, first out | 8,000 | 5,500 | 9,000 | 60 |
| Highest cost first | 10,500 | 3,000 | 6,500 | 43.33 |
| Lowest cost first | 6,500 | 7,000 | 10,500 | 70 |
| Average cost | 8,500 | 5,000 | 8,500 | 56.67 |
How we got this
- Money from the sale = 150 × 90 = 13,500. It is the same under every method.
- First in, first out takes the oldest lots first. Their cost is 9,000, so the gain is 13,500 − 9,000 = 4,500.
- Average cost = 17,000 ÷ 300 = 56.67 a unit, the same for every unit sold and every unit kept.
- A method that takes out less cost now leaves more cost on the units you keep, so the gain you skip today shows up when you sell the rest.
About this answer
- Which method you may use depends on where you live, on the kind of asset and on your broker. Some places allow only one; some let you name the lots at the time of sale. Check the rules that apply to you.
- This page shows the gain only. Tax rates, holding periods and fees are not 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 your purchases one per line, oldest first: the quantity, then the price per unit.
- Type how many units you are selling and the sale price.
- Read the gain under each method and the cost left on the units you keep.
Example
Lots of 100 at 50, 100 at 80 and 100 at 40, selling 150 at 90, bring in 13,500. First in, first out takes 100 at 50 and 50 at 80, a cost of 9,000 and a gain of 4,500. Highest cost first takes 100 at 80 and 50 at 50, a cost of 10,500 and a gain of 3,000.
Type these numbers into the boxes
- Your purchases, oldest first
- 100, 50 100, 80 100, 40
- Units you are selling
- 150
- Sale price per unit
- 90 amount per unit
What you get: Selling 150 units at 90 gives a gain from 3,000 (Highest cost first) to 7,000 (Lowest cost first), depending on which lots count as sold. First in, first out gives 4,500.
What your answer means
A smaller gain now is not a saving on its own: it leaves more of the low-cost units behind, so the gain moves to a later sale. Which method you may use is set by the rules where you live and by your broker; this page shows the arithmetic only.
Words explained
- Capital gain
- the profit from selling something for more than it cost.
- Average price
- the total cost divided by the total quantity bought.
How we calculate · the conventions behind every answer, in one place.
Questions about tax lots
What is a tax lot?
A tax lot is one purchase of an investment, with its own quantity, price and date. If you bought the same share three times, you hold three lots. When you sell part of the holding, the lots you count as sold set the cost and so the gain.
What is the difference between FIFO and LIFO?
First in, first out sells the oldest lots first. Last in, first out sells the newest first. With lots of 100 at 50, 100 at 80 and 100 at 40, selling 150 at 90 gives a gain of 4,500 by first in, first out and 5,500 by last in, first out.
Why does highest cost first give the smallest gain?
It takes out the most expensive units first, so the cost of the units sold is as high as it can be. In the example it takes 100 at 80 and 50 at 50, a cost of 10,500 against 13,500 of sales, so the gain is 3,000.
Does a smaller gain now save money overall?
Not on its own. The cheaper units stay in your holding, so the gain you avoid now appears when you sell them. In the example, the cost left after highest cost first is 6,500, against 8,000 after first in, first out.
How is average cost different?
Average cost gives every unit the same cost: the total cost divided by the total units. In the example that is 17,000 ÷ 300 = 56.67, so 150 units cost 8,500 and the gain is 5,000, between the other methods.
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. “Tax Lot Calculator: Which Lots to Sell”. Updated 2026-11-30. https://investmentmathcalculator.com/tools/tax-lot/
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.