Skip to content
Investment Math
Investment Math

Currency and number style

Only changes how amounts look. There is no currency conversion.

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 calculator

Also called: FIFO vs LIFO calculator · highest cost first calculator · specific identification calculator · HIFO calculator · realized gain calculator Last updated

One purchase per line, in the order you bought them: the quantity, then the price per unit you paid.

3 rows read Saved on this device as you type.

How many units this sale takes out.

The price you sell each unit at.

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 sale13,500
Gain, first in first out4,500
Gain, last in first out5,500
Gain, highest cost first3,000
Gain, lowest cost first7,000
Gain, average cost5,000
Gap between the largest and smallest gain4,000
The same sale under each way of choosing the lots
MethodCost of the units soldGain or lossCost of what is leftAverage cost of what is left
First in, first out9,0004,5008,00053.33
Last in, first out8,0005,5009,00060
Highest cost first10,5003,0006,50043.33
Lowest cost first6,5007,00010,50070
Average cost8,5005,0008,50056.67

How we got this

  1. Money from the sale = 150 × 90 = 13,500. It is the same under every method.
  2. First in, first out takes the oldest lots first. Their cost is 9,000, so the gain is 13,500 − 9,000 = 4,500.
  3. Average cost = 17,000 ÷ 300 = 56.67 a unit, the same for every unit sold and every unit kept.
  4. 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.

Not quite what you need?

Type your question in plain words and get the calculators that answer it.

    How to use it

    1. Type your purchases one per line, oldest first: the quantity, then the price per unit.
    2. Type how many units you are selling and the sale price.
    3. 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.

    Put this example into the calculator

    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.

    Your question goes to the site owner by email and is not stored on this site. If you add an email it is used only to reply.

    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.