Why FIFO Is Critical for Loss Harvesting
FIFO, or First In First Out, is the mandatory method for determining which shares are considered sold when you sell a partial quantity of a stock you hold in multiple lots. In India, the Income Tax Act requires FIFO for computing capital gains on listed equity shares. You cannot choose which lot to sell; the earliest purchase is always sold first.
This rule has profound implications for tax loss harvesting. When you have bought the same stock at different prices over time, each lot has a different cost basis and a different holding period. FIFO determines which lot's cost basis is used for the gain or loss calculation, and whether that gain or loss is short-term or long-term.
Many investors make the mistake of looking at their average cost and assuming that selling at a price below the average means they are booking a loss. But FIFO does not use average cost. It uses the actual cost of the earliest lot. If your first lot was bought at a low price and has appreciated, FIFO assigns that lot to the sale, and you may end up booking a gain instead of a loss.
Understanding FIFO before executing any harvest is essential. Without this check, you could sell shares expecting a loss and instead trigger a taxable gain, which is the opposite of what you intended.
How FIFO Works with Multiple Lots
When you buy a stock in multiple tranches, each purchase creates a separate lot with its own cost and date. FIFO means the first lot you bought is the first lot considered sold.
Example: You have accumulated shares of Wipro over three purchases: - Lot 1: 100 shares at Rs 450 on February 1, 2025 - Lot 2: 150 shares at Rs 520 on June 15, 2025 - Lot 3: 200 shares at Rs 480 on October 10, 2025
Total shares: 450. Current price: Rs 470.
If you sell 100 shares, FIFO assigns the sale to Lot 1 (bought at Rs 450). Your gain is Rs 470 - Rs 450 = Rs 20 per share. That is an LTCG of Rs 2,000 (since Lot 1 was held for over 12 months by February 2026). This is a gain, not a loss.
If you sell 250 shares, FIFO assigns the first 100 to Lot 1 (LTCG of Rs 2,000) and the next 150 to Lot 2 (bought at Rs 520, current Rs 470, STCL of Rs 50 x 150 = Rs 7,500 since it has been held for less than 12 months as of February 2026).
The net result of selling 250 shares is Rs 2,000 LTCG and Rs 7,500 STCL. The STCL can offset the LTCG and then your other gains. But the outcome is very different from simply assuming a loss on 250 shares.
FIFO Determines Short-Term vs Long-Term Classification
FIFO not only determines the cost basis but also the holding period, which determines whether a gain or loss is short-term or long-term. The 12-month threshold for listed equity means that the oldest lot (assigned by FIFO) may be long-term while later lots are still short-term.
This matters enormously for loss harvesting because:
- STCL can offset both STCG and LTCG
- LTCL can only offset LTCG
- STCG is taxed at 20%, LTCG at 12.5%
If your oldest lot is long-term and profitable, but your newest lot is short-term and at a loss, you cannot directly harvest the short-term loss without first selling through the older lots.
Consider this scenario: You hold 300 shares of a stock in two lots. Lot 1 has 200 shares bought 15 months ago at Rs 800 (long-term, currently at Rs 900, profit of Rs 100 per share). Lot 2 has 100 shares bought 3 months ago at Rs 1,000 (short-term, currently at Rs 900, loss of Rs 100 per share).
To access the STCL from Lot 2, you must sell all 300 shares. FIFO assigns the first 200 to Lot 1 (LTCG of Rs 20,000) and the remaining 100 to Lot 2 (STCL of Rs 10,000). The net effect is Rs 20,000 LTCG and Rs 10,000 STCL. The STCL offsets part of the LTCG, but you have also triggered Rs 20,000 of LTCG that you may not have wanted to realize.
This is why FIFO can make certain harvests unprofitable. Always calculate the lot-by-lot impact before executing.
Common FIFO Traps in Loss Harvesting
Trap 1: The hidden profitable lot. You see a stock down 10% from your latest purchase and assume selling will book a loss. But FIFO assigns the sale to an earlier lot that was purchased much lower. That lot shows a gain, not a loss.
Trap 2: Partial sell creating mixed outcomes. You want to sell just enough to book a specific loss amount. But FIFO may assign the first portion to a profitable lot and only the later portion to the loss-making lot. The combined result is smaller than expected.
Trap 3: The holding period switcheroo. You expect an STCL, but FIFO assigns the sale to a lot held for over 12 months. The loss becomes LTCL instead of STCL, which cannot offset your STCG. Your intended tax benefit evaporates.
Trap 4: SIP investments creating many small lots. If you invest through a Systematic Investment Plan (SIP) in a mutual fund or stock accumulation plan, you may have dozens of small lots at different prices. FIFO processes these in strict chronological order. The oldest SIP installments may be profitable long-term holdings, and you need to sell through many lots to reach the loss-making recent ones.
All of these traps can be avoided by reviewing your lot-level data before executing any harvest. Your broker's holdings statement or a tool like TaxHarvestLab shows the per-lot breakdown with FIFO-calculated gains and losses.
Strategies to Work Around FIFO Constraints
While you cannot override FIFO, you can work around its constraints with careful planning:
Strategy 1: Sell the entire position. If you want to harvest the loss from a specific lot but FIFO assigns earlier profitable lots first, the simplest solution is to sell all shares. This realizes the gain from early lots and the loss from later lots. If the net result is still a loss, or if the loss from later lots exceeds the gain from early lots, the harvest can still be worthwhile.
Strategy 2: Calculate the net impact. Before selling, calculate the cumulative gain or loss across all lots that would be sold. If selling 300 shares results in Rs 15,000 LTCG from the first 200 shares and Rs 25,000 STCL from the last 100 shares, the net is a Rs 10,000 STCL. This is still useful for offsetting gains.
Strategy 3: Consider the tax rates. Even if FIFO creates a mix of gains and losses, the tax rates differ. An STCL at 20% is more valuable than an LTCG at 12.5%. If selling through a profitable LT lot to reach a loss-making ST lot results in LTCG taxed at 12.5% and STCL saving at 20%, the net effect may still be positive.
Strategy 4: Plan future purchases to separate lots. If you want to maintain flexibility for future harvesting, avoid adding to existing positions right before you plan to harvest. New purchases at higher prices sit behind FIFO and cannot be accessed without selling through earlier lots.
FIFO Calculation Example for Harvest Decision
Let us work through a complete FIFO calculation to decide whether to harvest.
You hold 500 shares of Tata Motors acquired in four lots: - Lot 1: 100 shares at Rs 600, bought April 5, 2024 (long-term) - Lot 2: 150 shares at Rs 750, bought August 20, 2024 (long-term) - Lot 3: 100 shares at Rs 900, bought May 10, 2025 (short-term) - Lot 4: 150 shares at Rs 850, bought September 1, 2025 (short-term)
Current price: Rs 700. You have Rs 2,00,000 in STCG to offset. Should you sell?
If you sell all 500 shares at Rs 700: - Lot 1: (Rs 700 - Rs 600) x 100 = +Rs 10,000 LTCG - Lot 2: (Rs 700 - Rs 750) x 150 = -Rs 7,500 LTCL - Lot 3: (Rs 700 - Rs 900) x 100 = -Rs 20,000 STCL - Lot 4: (Rs 700 - Rs 850) x 150 = -Rs 22,500 STCL
Totals: LTCG Rs 10,000, LTCL Rs 7,500, STCL Rs 42,500.
Set-off: STCL Rs 42,500 offsets STCG from other trades (Rs 2,00,000 reduces to Rs 1,57,500). LTCL Rs 7,500 offsets the LTCG Rs 10,000, leaving Rs 2,500 LTCG. The Rs 2,500 LTCG is within the Rs 1,25,000 exemption.
Tax saved: Rs 42,500 x 20.8% = Rs 8,840. This is a clear win. Even though Lots 1 and 2 generated a gain and a loss at long-term rates, the short-term losses from Lots 3 and 4 provide significant savings at 20%.
Using Tools to Automate FIFO Calculations
Manual FIFO calculations become impractical when you have many stocks with multiple lots each. An active investor with 30 stocks and 3-4 lots per stock has over 100 lots to evaluate. Doing this in a spreadsheet is tedious and error-prone.
TaxHarvestLab automates the entire FIFO calculation process. It imports your holdings data directly from Zerodha or other brokers, identifies every lot with its purchase date and cost, applies FIFO automatically for any potential sale, and computes the exact gain or loss, classified as STCG, LTCG, STCL, or LTCL.
The tool then identifies the optimal harvesting strategy considering your realized gains, the FIFO impact of each potential sale, and the set-off rules. It shows you exactly which stocks to sell, how many shares to sell, and the expected tax saving after all FIFO effects.
For investors who want to verify the tool's calculations, the lot-level breakdown is fully transparent. You can see which lots FIFO assigns to each sale and confirm the cost basis used.
Whether you use a tool or do it manually, the core message is the same: never execute a tax loss harvest without first running the FIFO calculation. The lot that FIFO selects determines whether your sale generates a loss or a gain, whether it is short-term or long-term, and ultimately how much tax you save or owe.
See how this applies to your portfolio
Upload your Zerodha or Groww reports and get personalized recommendations in under 2 minutes.
Analyze My Portfolio FreeFrequently Asked Questions
Can I choose which lot to sell for tax loss harvesting in India?
No. India mandates the FIFO method for listed equity shares. The earliest purchased lot is always considered sold first. You cannot select a specific lot to sell.
What if FIFO assigns a profitable lot when I want to book a loss?
You may need to sell more shares to get past the profitable lot and reach the loss-making lot. Calculate the net effect across all lots to determine if the overall harvest is still beneficial.
Does FIFO apply to mutual fund units as well?
Yes. FIFO applies to equity mutual fund units just as it applies to stocks. If you have accumulated units through SIPs, the oldest units are considered redeemed first.
How does FIFO interact with the 12-month holding period?
FIFO determines which lot is sold, and that lot's purchase date determines the holding period. The oldest lot may be long-term (over 12 months) even if your most recent lot is short-term.