Every time you sell shares from a position held across multiple purchase events, the IRS allows the investor to designate exactly which shares — and therefore which cost basis — are being sold. That designation determines how much gain or loss gets recognized. Two investors who sell the same number of shares on the same day, in the same ticker, may report very different tax outcomes depending on the lot selection method their broker or software applies.
This is not a paperwork technicality. Lot selection is a first-class tax decision. Here is how each of the four major methods works, and why the choice matters over a long investment horizon.
What is a tax lot?
What is a tax lot, and why does it matter which lot is sold when selling part of a position?
A tax lot is a record of shares purchased at a specific price on a specific date; when selling part of a position held across multiple purchase events, the IRS allows investors to designate which lot they are selling, and that designation determines the cost basis used to compute the taxable gain or loss under IRC §1012.
Each lot carries two attributes that jointly determine the tax result of a sale:
- Cost basis — the acquisition price per share, adjusted for splits, return-of-capital distributions, and corporate actions.
- Acquisition date — determines whether a gain or loss is short-term (held under one year) or long-term (held over one year), which typically determines the applicable tax rate.
To make the choice concrete: an investor who acquires shares at around $100 in January and then adds more at approximately $130 in July holds two lots. If the current price is roughly $120, one lot carries an unrealized gain of approximately $20 per share and the other an unrealized loss of around $10 per share. Which lot gets sold when the investor wants to exit some shares is entirely the question lot selection answers.
FIFO: first in, first out
How does FIFO lot selection work, and when does it tend to produce the highest tax cost among the four methods?
FIFO (first in, first out) automatically sells the oldest lots first; in a market that has risen over time, these oldest lots typically carry the lowest cost basis — potentially producing the largest capital gain, and therefore the highest immediate tax cost, per share sold.
FIFO is the IRS default method when no specific lot designation is made at the time of sale. It is administratively simple: there is no per-sale decision required, and the broker applies it automatically without instruction.
In a portfolio that has appreciated over many years, FIFO tends to accelerate gain recognition by surfacing the cheapest lots earliest. Long-tenured positions can accumulate significant embedded gains in early lots, and FIFO forces those gains into recognition before newer, higher-basis lots.
FIFO is not always the costliest outcome. When the oldest lots are long-term, any gains they generate are taxed at the lower long-term capital gains rate. And for investors who value predictability over optimization, FIFO is a defensible, simple default.
LIFO: last in, first out
How does LIFO lot selection differ from FIFO, and what is its main limitation for taxable securities?
LIFO (last in, first out) sells the most recently purchased lots first; because recent purchases often have a higher cost basis, LIFO can reduce the recognized dollar gain per share — but it typically surfaces short-term lots, and short-term gains are generally taxed at ordinary income rates rather than the potentially lower long-term capital gains rate.
In a rising market, the newest lots carry the highest basis, which means the smallest gain (or potentially a loss) on sale. This can look attractive. But if those lots are short-term, any remaining gain is taxed at a higher rate — which can offset or reverse the apparent benefit from the higher basis.
LIFO is available at some US brokerages but is less commonly supported than FIFO, HIFO, or specific-ID. Investors who want the flexibility that LIFO appears to offer often find that specific-ID gives more precise control without the holding-period rate tradeoff.
HIFO: highest cost in, first out
How does HIFO lot selection minimize the recognized taxable gain across a position?
HIFO (highest in, first out) automatically selects whichever lots carry the highest cost basis — regardless of when they were acquired — which tends to minimize the recognized dollar gain per share sold across any portfolio of multiple lots.
Unlike LIFO, HIFO is not constrained to only the newest shares. It scans across all available lots and pulls from the most expensive ones first, regardless of acquisition date. This makes it generally more effective than either FIFO or LIFO at deferring gain recognition.
For investors who want a systematic approach without per-sale designation, HIFO is often a stronger choice than FIFO. Many brokerages that support lot-level accounting offer HIFO as an electable account-level default.
The practical limitation of pure HIFO is that it treats lots with similar per-share cost basis as equivalent — even when their holding-period status differs. A short-term lot and a long-term lot with the same basis look identical under HIFO. In a tax-loss harvesting context, a short-term loss may produce more immediate tax benefit than an equivalent long-term loss, because short-term losses offset income taxed at potentially higher ordinary rates. Specific-ID addresses this gap.
Specific-ID: designating exactly which lots to sell
What makes specific-ID lot selection more powerful than automatic methods like HIFO, and what does effective use require?
Specific-ID allows the investor or their portfolio software to designate exactly which lots are sold before each transaction executes — enabling targeted harvesting of the most tax-valuable lots, intentional deferral of near-long-term gains, or any combination matched to the investor's tax position in a given year.
Specific-ID is the most flexible method because it is not constrained by a fixed mechanical rule. At each sale, the designating party can choose lots based on any combination of objectives:
- maximizing the realized loss for immediate tax benefit
- preferring short-term losses to offset income at potentially higher ordinary rates
- deferring gain recognition on lots approaching the one-year long-term threshold
- intentionally realizing long-term gains when an existing harvested-loss bank can fully absorb them
The IRS requires that the specific lot be designated before the trade settles, and the broker must confirm the designation in writing (Treas. Reg. §1.1012-1(c)). Before modern portfolio software, this created a genuine bookkeeping burden for accounts with many lots across a single ticker. Today, tax-aware portfolio systems handle specific-ID designation automatically on every transaction.
How HarvestEngine handles lot selection
How does HarvestEngine's lot-selection strategy differ from a plain HIFO approach, and why does it weight short-term lots more heavily?
HarvestEngine's highest-tax-savings lot selection strategy scores each lot by multiplying its unrealized loss by the applicable tax rate — preferring short-term lots because short-term losses may generate more after-tax benefit per dollar of loss realized than an equivalent long-term loss.
A plain HIFO pass ranks every lot by cost basis per share. HarvestEngine's default strategy goes further: it computes a score of loss × effective_tax_rate(term) for each lot, where short-term lots receive a higher effective rate than long-term lots. Two lots with the same dollar loss rank differently depending on whether they are short-term or long-term — a distinction HIFO ignores.
The engine also applies a long-term protection filter: lots within a configurable number of days of crossing the one-year threshold are generally not harvested unless the unrealized loss is large enough to justify resetting the holding period on the replacement. This avoids inadvertently converting a near-long-term position into a fresh short-term lot.
For investors who prefer a different approach, HarvestEngine also supports a largest-loss-first method (pure dollar-loss ranking, comparable to HIFO on unrealized losses) and a shortest-term-first method (prioritizes lots with the most time value remaining before long-term treatment). Both are available as configurable alternatives to the default.
Read this next with tax alpha explained, TLH 101, the wash-sale rule demystified, the art of annual TLH pacing, the Form 8949 filing walkthrough, and cost basis when you transfer between brokers.