The best tax lot relief method is the one that fits the particular sale, which is why no single method wins. A tax lot relief method decides which shares a sale comes from, and so the gain or loss, and whether it is long-term or short-term. If the seller names no lot, the Treasury regulation charges the sale to the earliest lot, first in, first out. Highest cost first, losses first and tax-optimized orders are all ways of naming the lot in advance, and each can be the right answer on one sale and the wrong one on the next, most often when a loss lot sits near a recent purchase elsewhere in the household. Botminds' Model Portfolio Rebalancing chooses the lot for every sale a model change needs, checks it against the household's wash-sale window, and writes the reason beside it.
The worked example uses one account at the solution's fictional sample firm, Quillfield Private Wealth; the figures are sample data. The rules are quoted from the Treasury regulations and IRS Publication 550. None of it is tax advice to any client.
One sale of 286 shares, five ways to choose the lots: what the client reports
What is the best tax lot relief method?
The best method is the one chosen for this sale, with this household's other lots and purchases in view, and named before settlement. A method chosen once for every sale is a policy, and policies are blind to the circumstances that make a sale expensive. In the chart above, highest cost first realizes the least gain this year, which is what it is for, and still costs the client $3,696 of loss the IRS will not allow. First in, first out realizes the most gain this year and loses nothing.
That is not a general case for first in, first out. On most sales with no recent purchases nearby, a highest-cost order realizes less gain and defers tax, which is real value. The point is that the method has to be decided per sale, with the wash-sale window, the holding period and the client's gain budget in view, and that the result has to be identified to the custodian in time to count.
The default: first in, first out, by regulation
If a seller does not identify the lot, the Treasury regulation decides: "the stock sold or transferred is charged against the earliest lot the taxpayer purchased or acquired to determine the basis and holding period of the stock" (26 CFR 1.1012-1(c)(1)). IRS Publication 550 puts the same rule in plain words: "In other words, the oldest shares you own are considered sold first" (IRS Publication 550).
First in, first out is therefore not one option among equals. It is what happens when nothing else is done. For a long-held, appreciated position it usually realizes the largest gain available, because the oldest lots tend to have the lowest cost; in a portfolio that has been bought into steadily, it also tends to produce long-term rather than short-term results. That second effect is why FIFO is sometimes the right answer by accident.
What is specific identification, and when must the lot be named?
Specific identification means telling the custodian which lot to sell, and having it confirmed in writing; done in time, it overrides the default. For stock left with a broker, the regulation requires that "At the time of the sale or transfer, the taxpayer specifies to such broker or other agent having custody of the stock the particular stock to be sold or transferred", and that "Within a reasonable time thereafter, confirmation of such specification is set forth in a written document from such broker or other agent" (26 CFR 1.1012-1(c)(3)).
"At the time of the sale" has a precise meaning. Paragraph (c)(8) treats the identification as made at the time of sale "if the identification is made no later than the earlier of the settlement date or the time for settlement required by Rule 15c6-1". Rule 15c6-1 now requires most trades to settle by the first business day after the trade date (17 CFR 240.15c6-1; what one-day settlement does to a model change's cash). For a model change traded on a Tuesday, the lot has to be named by Wednesday.
The three clocks that decide a lot's tax result
T+1
latest moment to name the lot: the earlier of settlement and Rule 15c6-1 settlement time
30+30days
the wash sale window either side of a loss sale, 61 days in all
>1year
held more than one year: long-term; one year or less: short-term
HIFO, losses first and tax-optimized orders are standing orders
Highest-in, first-out, lowest-in, first-out, losses first and the broker's "tax-optimized" choices are not separate methods in the tax law; they are standing orders for specific identification. The regulation allows exactly that: "A standing order or instruction for the specific identification of stock is treated as an adequate identification made at the time of sale" (26 CFR 1.1012-1(c)(8)).
That matters for two reasons. First, a standing order is only as good as the rule it encodes. "Highest cost first" picks the 2025 lot in the sample account every time, including on the day it is a wash sale. Second, where the firm's rebalancer and the custodian's standing order disagree, the one that reaches the custodian before settlement wins. A rebalancer that proposes a lot the custodian never receives has produced a tax plan, not a trade.
Tax lot relief methods, and what the tax law says about each
| Method | What it sells first | Its status in the tax law | Where it goes wrong |
|---|---|---|---|
| First in, first out | The earliest lot | The default when no lot is identified, 1.1012-1(c)(1) | Realizes the largest gains on long-held positions |
| Specific identification | The lot the seller names | Allowed if named by settlement and confirmed in writing, 1.1012-1(c)(3), (c)(8) | Too late if the name reaches the custodian after settlement |
| Highest cost first (HIFO) | The highest-cost lot | A standing order for specific identification | Ignores holding period and wash-sale windows |
| Losses first, then long-term | Loss lots, then long-term lots by cost | A standing order for specific identification | Sells the loss lot even when a household purchase makes it a wash sale |
| Average cost | An average of all lots | Only for mutual fund and certain dividend reinvestment shares, 1.1012-1(e) | Not available for an individual stock |
Can you use average cost for individual stocks?
No. Publication 550 is direct: "Except for certain mutual fund shares, discussed later, you cannot use the average price per share to figure gain or loss on the sale of the shares." Average basis is available for shares in a mutual fund or other regulated investment company, and for certain shares bought through a dividend reinvestment plan, held with a custodian.
For those shares the custodian's default applies unless the client elects otherwise: the basis "is determined in accordance with the broker's default method, unless the taxpayer notifies the broker that the taxpayer elects another permitted method" (26 CFR 1.1012-1(e)(2)). A model that holds mutual funds can therefore have lots relieved one way in one account and another way in the next, depending on what each custodian defaults to and what each client elected. The rebalancer has to know which, account by account.
One sale, five methods, worked to the dollar
The sample sale is ordinary. The committee cut Arclight from 3.5% to 1.5% of the model, so the Bergströms' $1.88 million joint account had to sell about $37,600 of it, 286 shares at $131.60. The account held two lots; Ingrid's IRA at another custodian held a third, bought on 6 October.
The arithmetic behind the chart: one sale of 286 shares
Shares to sell
CalculationModel weight falls 2.0 points on a $1.88M account; $37,600 ÷ $131.60
Result286 shares
FIFO: the oldest lot
Calculation286 × ($131.60 − $96.10)
Result+$10,153 long-term
Highest cost first: the 2025 lot, then the oldest
Calculation200 × ($131.60 − $162.40) + 86 × ($131.60 − $96.10)
Result−$6,160 + $3,053 = −$3,107
Wash sale on the 2025 lot
Calculation120 IRA shares bought 6 Oct match 120 of the 200 sold; 120 × $30.80
Result$3,696 disallowed
Highest cost first, as reported
Calculation−$6,160 + $3,696 + $3,053
Result+$589
Tax-aware identification
CalculationSell 286 of the 2023 lot; hold the 2025 lot until 6 Nov
Result+$10,153; $6,160 loss kept for later
Read the fifth row against the sixth. Highest cost first reports a gain of $589 this year; tax-aware identification reports $10,153. On this year's return, highest cost first looks better by about $9,600 of gain. But it gives up $3,696 of loss that, because the replacement shares are in an IRA, may never come back, and it leaves 214 low-cost shares from 2023 in the account, carrying their gain into a later year. Tax-aware identification realizes the gain now and keeps the 2025 lot, and its $6,160 loss, available from 6 November.
Which of those a client prefers depends on facts the rebalancer should know: the client's gain budget for the year, other gains and losses, and whether the firm's policy treats a spouse's IRA purchase as a permanent loss. What a model change costs the client in tax works the same decision across a whole model. The method is not the decision; the lot is.
Where wash sales break "highest cost first"
Highest cost first fails precisely when its logic is strongest. The highest-cost lot is often the most recent purchase, or a lot bought near a recent purchase, because prices that fell after a buy are what make a lot a loss. The recent purchase is also what puts the sale inside a wash-sale window. A standing order that cannot see the window sells into it.
The matching rule makes the damage partial and therefore easy to miss. The regulation matches the shares bought in the window, earliest purchase first, against an equal number of the shares sold (26 CFR 1.1091-1(c)). In the sample, 120 of the 200 shares sold at a loss are matched; the other 80 shares' loss stands. A report that shows a $3,107 net loss for the sale is wrong by $3,696, and the client's preparer only finds out if someone tells them, because a purchase in another account is not on the 1099-B.
Two ways to pick the lot for the same sale
A standing order (losses first, highest cost): The lots in the selling account.
Tax-aware identification, per sale: Every lot in the household, purchases 30 days back and scheduled buys 30 days forward.
A standing order (losses first, highest cost): Sells the 2025 lot: $3,696 of its loss disallowed.
Tax-aware identification, per sale: Sells 286 of the 2023 lot; holds the 2025 lot until 6 November.
A standing order (losses first, highest cost): Not considered unless the order says so.
Tax-aware identification, per sale: Avoided outside the account’s gain budget; above it, a portfolio manager decides.
A standing order (losses first, highest cost): The standing order, if one is on file.
Tax-aware identification, per sale: The named lot, before settlement, on the order file.
A standing order (losses first, highest cost): The trade.
Tax-aware identification, per sale: The trade and the reason for each lot sold or kept.
Holding period: the line at one year
The holding period decides the rate, and it can change in a day. "If you hold investment property more than 1 year, any capital gain or loss is a long-term capital gain or loss," Publication 550 says, and the count begins on the day after purchase (IRS Publication 550). The publication's own example: bought 31 January 2024 and sold 29 January 2025 is short-term; sold 6 February 2025 it is long-term.
For a rebalancer the line produces two practical rules. A gain lot a few days short of a year is often worth leaving for the next run; and a wash sale moves the line, because the replacement shares take on the holding period of the shares sold. Lot choice is how a rebalancer keeps short-term gains out of a client's year; the sample firm treats them as allowed only inside an account's gain budget, and above it only with a portfolio manager's approval.
How Model Portfolio Rebalancing chooses and explains each lot
In Botminds' Model Portfolio Rebalancing the Tax agent picks lots for every sale a model change needs. It starts from the firm's lot order, checks each proposed lot against the household's purchases in the window, the account's gain budget and the holding period, and changes the lot where the order would cost the client. Every lot sold or kept carries its reason, and the named lots travel on the order file so the identification reaches the custodian before settlement.
Tax lot selection in Model Portfolio Rebalancing: each lot, its decision and why

The lot order itself is a setting the firm writes, not a choice buried in code. In the sample firm it reads "losses first, then long-term, highest cost", with losses harvested only above $1,000 and 10%, tax logic skipped for IRAs and tax-exempt trusts, and wash sales avoided across the household. The Tax agent departs from the order only to avoid a cost the order cannot see, and says so on the lot.
The firm's lot order and tax rules, as settings

Two things stay with people. The Tax agent never gives tax advice to a client, and it never realizes a short-term gain above an account's budget without a portfolio manager. How to test an engine that makes these choices sets out the test cases a lot picker should pass before anyone relies on it.
Questions people ask
Is FIFO the default tax lot method?
Yes, for stock, when the seller does not adequately identify the lot: 26 CFR 1.1012-1(c)(1) charges the sale to the earliest lot. For mutual fund shares eligible for average basis, the custodian's default method applies unless the client elects another permitted method.
What happens if you don't identify the lot in time?
The default applies. An identification counts only if made no later than settlement, which Rule 15c6-1 now sets at the first business day after the trade for most securities, and is confirmed in writing by the custodian within a reasonable time.
Can you change the tax lot after the trade?
Not after the identification deadline. The regulation looks at what was specified by settlement, not at what the client would prefer when the return is prepared. A standing order on file counts as identification at the time of sale.
Is HIFO always the best tax lot method?
No. Highest cost first usually realizes the least gain on a sale, but it ignores holding periods and wash-sale windows. In the worked example it reports a $589 gain while giving up $3,696 of loss to an IRA purchase made fourteen days earlier.
What is a tax lot optimizer?
Software that picks lots for each sale against a goal, such as least tax this year, within constraints such as short-term gain limits and wash-sale windows. In tax-law terms its output is specific identification, so it only counts if the chosen lots reach the custodian before settlement.
Do lot relief methods matter in an IRA?
Not for the IRA's own sales: an individual retirement account is generally exempt from tax, so which lot it sells changes nothing on the client's return. What matters is the IRA's purchases, because a purchase there can make a loss sale in a taxable account a wash sale.