Abstract editorial illustration representing tax lot selection and cost-basis accounting methods — FIFO, LIFO, HIFO, and specific-ID. Flat vector composition: layered blue rectangular cards representing portfolio lot records are stacked by acquisition age, with a gold selection arrow precisely designating one card from the stack. Abstract navy grid lines and ledger marks fill the background, evoking a deliberate, tax-intelligent designation system. Electric blue, navy, and gold palette on an off-white background.
When selling from a position held across multiple purchase events, the method used to designate which lot is sold determines the cost basis recognized — and therefore the size and character of any capital gain or loss. FIFO, LIFO, HIFO, and specific-ID each apply a different rule to that designation.

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.

TAX LOT — TWO ATTRIBUTES THAT JOINTLY DETERMINE THE TAX OUTCOME OF EVERY SALE ACQUISITION DATE Determines holding period under 1 yr → short-term · over 1 yr → long-term COST BASIS / SHARE Purchase price per share adjusted for splits and corporate actions Same position — two lots — same current market price — two different tax outcomes GAIN LOT A Acquired earlier · lower cost basis Current price exceeds cost basis → selling may realize a capital gain LOSS LOT B Acquired later · higher cost basis Current price is below cost basis → selling may realize a harvestable loss
Each tax lot carries two attributes: the acquisition date (which governs short-term vs. long-term holding period treatment) and the cost basis per share. Two lots in the same position may carry different embedded gains or losses at any given market price — and lot selection determines which set of tax attributes applies when shares are sold.

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.

Three-panel editorial infographic comparing the three automatic tax lot selection methods applied to the same portfolio position. FIFO panel on the left: a stack of blue lot cards with a gold selection arrow pointing to the bottom card, representing the oldest lot sold first and a potentially larger recognized gain. LIFO panel in the center: the same stack, gold arrow at the top card, representing the newest lot sold first — typically short-term in character. HIFO panel on the right: the highest-cost lot highlighted with a gold arrow regardless of acquisition order, representing minimum recognized gain per share sold.
Three automatic lot selection methods — each applying a different rule to the same portfolio of lots. FIFO sells the oldest lot first, potentially recognizing the largest gain in a rising market. LIFO sells the newest lot first, often surfacing short-term positions. HIFO sells the highest-cost lot regardless of acquisition date, generally minimizing the recognized gain per share. Each method may produce a different tax outcome depending on the lot structure of the account.

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
Select a method to see which lot is designated for sale from these five illustrative lots — the gold-highlighted row shows the lot each approach would choose. Illustrative lot attributes only; actual lot selection depends on the specific holdings and cost-basis records in the account.

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.

Abstract editorial illustration of a tax-rate-weighted lot scoring system. Two blue portfolio lot record cards are positioned side by side. The left card carries a prominent gold star or crown marker indicating higher priority score — representing a short-term loss lot that may produce more after-tax benefit per dollar of loss realized. The right card has a smaller, secondary marker indicating lower score. A gold scoring dial or balance tilts toward the higher-priority card, conveying the algorithmic, deliberate nature of a tax-rate-weighted lot selection approach. Electric blue, navy, and gold palette on an off-white background.
HarvestEngine's lot selection scores each candidate lot by unrealized loss multiplied by the applicable tax rate — preferring short-term loss lots where the same dollar of loss may generate more after-tax benefit due to the higher ordinary income rate that typically applies. Two lots with equal dollar losses rank differently if one is short-term and the other is long-term.

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.

See lot selection in your portfolio, free