Lot matching vs. FIFO: why it changes your capital gains
July 2026 · 7 min read
ethro is a free tool that generates this exact report from your IBKR statements — not just a guide.
Generate your reportsEvery sale of shares has to be matched against a specific earlier purchase — the lot it "closes." Which lot gets picked isn't a footnote. It decides your cost basis, your holding period, and therefore whether a gain is short-term or long-term. For US stocks held outside an Indian demat account, it also isn't fixed by law the way many assume.
FIFO vs. specific identification
FIFO (first-in, first-out) always matches a sale against the oldest unsold shares of that symbol. Specific identification (sometimes called lot matching) matches it against whichever lot was actually designated — the broker's own record of what you sold, which may or may not be the oldest one.
FIFO is IBKR's default. It is not, however, the only option — most brokers, IBKR included, let an account holder choose a different matching method instead. Most accounts never touch that setting, which is exactly why FIFO is what shows up almost everywhere in practice.
Is FIFO actually required for foreign shares?
Section 45(2A) of the Income-tax Act mandates FIFO — but only for securities held in dematerialised form through an Indian depository (NSDL/CDSL). A foreign brokerage account is not that. There is no equivalent section, and no published case law, specifically mandating FIFO for shares held abroad. That leaves genuine room for a specific-identification position to be a legitimate filing choice — not merely "the approximate answer" against a FIFO "correct answer." Which one you report is your choice to make, not a right-or-wrong pick.
How this shows up in ethro's two input modes
| Input | What it does | Captures non-FIFO matching? |
|---|---|---|
| Your actual lot matching | Reads IBKR's own allocation rows verbatim — whatever lot IBKR actually matched each sale against. | Yes, if the account used it — because it's not re-derived, just reported. |
| Rebuilt with FIFO | Reconstructs every lot from scratch via strict FIFO replay across all uploaded yearly statements. | No — always FIFO. Cross-checks its own FIFO math against IBKR's reported P/L per sale, and refuses to produce Capital Gains/Table A3 rather than guess if they disagree. |
On a default IBKR account, both give identical numbers — the actual-matching file is then just confirming the same FIFO matching the reconstruction arrives at independently. They only diverge once an account used non-default matching.
Where it actually bites: RSU sell-to-cover
The sharpest case is an RSU vest with an immediate sell-to-cover, when you already hold older shares of the same company from a prior vest, ESPP, or open-market purchase. The vested shares carry a cost basis equal to their vest-date price (already taxed as salary income), so selling them the same day should produce close to zero capital gain and a same-day holding period.
Strict FIFO doesn't know that. It matches the sale against whichever lot is oldest — not the one that just vested — which can manufacture a gain out of a transaction that was economically gain-neutral, and can turn a same-day sale into a long-term holding by attaching it to years-old shares instead. This changes both the Capital Gains figure and, because the surviving open lot is now a different one, which acquisition date appears on Schedule FA Table A3.
If that sell-to-cover was matched at IBKR against the actual vested lot — specific identification, not FIFO — the file reporting your actual matching captures it correctly. A FIFO reconstruction from yearly statements cannot; it has no visibility into what was actually matched, only into what would have happened under FIFO.
What this means practically
If you've never changed your broker's default lot-matching method and don't do RSU sell-to-cover alongside older holdings of the same stock, both input methods will agree — there's nothing to reconcile. If either applies to you, the two methods can genuinely produce different numbers, and both are legitimate — it comes down to whether you'd rather report what specifically happened at your broker, or apply the FIFO convention. That choice is yours to make.
Frequently asked questions
Is FIFO legally required for US stocks held at a foreign broker?
No. Section 45(2A) of the Income-tax Act mandates FIFO only for securities held in dematerialised form through an Indian depository (NSDL/CDSL). A foreign brokerage account like IBKR isn't a demat account under that section, so there is no statutory FIFO requirement for it — the broker's own lot matching is what actually happened, and that's a defensible position on its own.
How do I know which method my IBKR account actually used?
FIFO is IBKR's default matching method. Some brokers, IBKR included, let you choose a different one instead — if you never changed that setting for your account, you used FIFO.
Why does rebuilding from yearly statements always assume FIFO?
A yearly activity statement's Trades section shows one row per order with a single realized P/L figure — it never says which specific purchase a sale closed against. To reconstruct capital gains and Schedule FA holdings from it at all, the replay has to assume every trade was matched in strict FIFO order. It then checks its own FIFO-implied P/L against IBKR's reported P/L for every sale; if they don't match, the account wasn't actually FIFO, and it refuses rather than silently producing a wrong number.
My two input methods gave identical numbers — does that mean it doesn't matter?
It means your account used FIFO by default and nothing overrode it, which is the common case. Both methods will always agree in that situation, since the file reporting your actual matching is then just confirming the same FIFO matching a FIFO reconstruction arrives at independently. Divergence only shows up for accounts using non-default lot selection.