The best cost basis method for taxes, for most people selling in a taxable year, is specific identification used to sell your highest-cost shares first — a strategy often labeled HIFO. It gives you the smallest taxable gain (or the largest deductible loss) on the shares you sell right now. But “best” depends on your bracket, your holding periods, and what you’re trying to accomplish, and the wrong pick can cost you thousands.
The Six Methods and What Each Does to Your Gain
When you own several lots of the same security bought at different prices, the IRS lets you decide (within limits) which lot you’re selling. That choice sets your cost basis, and your basis sets your gain.
- FIFO (First-In, First-Out). Oldest shares go first. In a market that has risen, those are usually your cheapest shares, so FIFO produces the largest gain.
- LIFO (Last-In, First-Out). Newest shares go first. In a rising market this typically produces a smaller gain than FIFO, but the shares may not have been held long enough for long-term rates.
- HIFO (Highest-In, First-Out). The most expensive shares go first, regardless of when you bought them. Maximizes basis, minimizes the current gain.
- LOFO (Lowest-In, First-Out). The cheapest shares go first. Produces the biggest gain. Useful only when you want to accelerate gains into a low-income year.
- Average Cost. Every share carries the same basis: total cost divided by total shares. Commonly used for mutual funds because reinvested dividends create dozens of small lots.
- Specific Identification. You pick the exact lot at the time of sale. Most control, most flexibility, most paperwork.
Every one of these changes both the gain reported on your Form 1099-B and the basis of the shares still sitting in your account.
Which Method Wins in Which Situation
There is no single best method. The right choice depends on what you’re trying to do this tax year.
You’re in a High Tax Bracket and Want a Smaller Bill
Use specific identification and pick your highest-cost lots — the HIFO approach. Maximizing basis minimizes the taxable gain, which directly lowers what you owe. If any of your high-cost lots have been held more than a year, sell those first so the remaining gain qualifies for long-term rates.
You’re Harvesting Losses
Specific identification wins again, this time to sell the lots showing the deepest losses. Realized losses offset your capital gains dollar for dollar, and up to $3,000 of net losses ($1,500 if married filing separately) can be deducted against ordinary income each year, with the rest carrying forward.1Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses HIFO tends to produce those losses automatically.
Your Income Is Unusually Low This Year
Flip the logic. If your taxable income falls under the 0% long-term capital gains threshold, gains are free. FIFO (or LOFO, or specifically picking your lowest-basis long-held lots) lets you clear appreciated shares while paying nothing. For the 2026 tax year, single filers with taxable income up to $49,450 and married joint filers up to $98,900 pay 0% on long-term gains. The shares must have been held more than a year to qualify.
You Own Mutual Funds and Want Simplicity
Average cost is the standard choice, and for good reason. Reinvested dividends create a steady drip of new lots, and tracking each one to optimize a sale rarely justifies the effort. Brokers may use average cost as their default for mutual fund accounts.2Internal Revenue Service. Instructions for Form 1099-B (2026) Once you’ve used average cost for a particular fund, switching methods generally has to happen before the next sale; you can’t retroactively recalculate lots you’ve already sold.
You Never Told the Broker Anything
Then the default runs. For stocks and ETFs, federal regulations treat unidentified sales as FIFO.3GovInfo. 26 CFR 1.1012-1 Basis of Property For mutual funds, the broker’s default (often average cost) applies. Whatever the broker uses goes onto your 1099-B and to the IRS. If FIFO produced a bigger gain than you needed to realize, you overpaid.
Holding Period Is Half the Answer
Basis is only one lever. The other is how long you held the shares, because the tax rate on the gain depends on that.
Shares held one year or less produce short-term capital gains, taxed as ordinary income at rates from 10% to 37% for the 2026 tax year. Shares held more than a year get long-term rates of 0%, 15%, or 20%. A method that sells a lot held for 11 months can convert what would have been a 15% gain into a 37% gain on the same dollar amount.
This is where specific identification pulls ahead of the automated methods. LIFO might minimize the reported gain but hand you short-term treatment. FIFO might grab a long-term rate but on a huge gain. Specific identification lets you check both boxes: high-basis and long-term.
The 3.8% Net Investment Income Tax
Above the capital gains rate sits a second layer. A 3.8% Net Investment Income Tax applies to the lesser of your net investment income or the amount your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).4Office of the Law Revision Counsel. 26 USC 1411 – Imposition of Tax Those thresholds don’t index for inflation, so more filers cross them each year. A large FIFO gain can push you over the line and add 3.8% to the tax on that income.5Internal Revenue Service. Topic No. 559, Net Investment Income Tax Choosing a high-basis method keeps the gain — and possibly your MAGI — lower.
The Wash Sale Rule Can Undo a Loss Harvest
If you sell a security at a loss and buy a substantially identical one within 30 days before or after the sale, the wash sale rule disallows the loss.6Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities The disallowed amount doesn’t vanish; it gets added to the basis of your replacement shares.7Internal Revenue Service. 2026 Instructions for Form 1099-B
This matters when you’re using HIFO or specific identification to harvest losses. Selling your highest-cost lot at a loss and buying the same security a week later means the loss you were counting on is deferred, not claimed. The broker reports the disallowed amount in Box 1g of your 1099-B. If loss harvesting is the reason you picked your method, plan around the 30-day window on both sides of the sale.
Inherited and Gifted Shares Don’t Use These Methods
The six methods above assume you bought the shares. Inherited and gifted shares get their basis from the tax code, not from your choice.
Inherited shares generally take a “stepped-up” basis equal to the fair market value on the date of the original owner’s death, not what they paid for them.8Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent The estate’s executor may elect a valuation date six months after death instead. Selling shortly after inheriting often produces little or no gain.
Gifted shares carry over the donor’s original basis for computing a gain. If the fair market value at the time of the gift was lower than the donor’s basis and you sell at a loss, that lower fair market value becomes your basis for computing the loss.9Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust Sell at a price between those two figures and there is no gain or loss at all.10Internal Revenue Service. Frequently Asked Questions on Gift Taxes Once you start adding your own purchases to the same holding, then your chosen method controls which lot goes first among the shares you bought.
Telling Your Broker (and Making It Stick)
Picking a method only helps if the broker actually uses it. The default runs unless you change it.
Most brokerages let you set a standing method through account settings or tax preferences. A standing instruction applies to every future sale in that account until you change it. Written instructions through secure messaging or mail also work.
For specific identification on a single trade, tell the broker at the time of the sale exactly which lot you want to sell (for example, “sell 100 shares purchased March 15, 2023, at $45.00”). The broker must send written confirmation of that specification within a reasonable time, and electronic confirmations count.11eCFR. 26 CFR 1.1012-1 – Basis of Property
The IRS treats your lot identification as adequate only when you specified the shares at the time of the sale and the broker confirmed the specification in writing.11eCFR. 26 CFR 1.1012-1 – Basis of Property Keep those confirmations. In an audit they’re your proof.
If the broker executes a trade using the wrong method, you generally have until the settlement date to correct it. Since May 28, 2024, most U.S. securities settle one business day after the trade date.12U.S. Securities and Exchange Commission. SEC Statement on Implementation of T+1 Settlement Check your trade confirmations fast.
Fixing It If You Got It Wrong
Discovered a mistake after filing? Two paths, and which one you take depends on what kind of mistake it was.
For a one-time correction — a wrong basis on a specific sale, a broker error, a miscalculation — file an amended return on Form 1040-X. You generally have three years from the original filing date or two years from the date you paid the tax, whichever is later.13Internal Revenue Service. File an Amended Return If the 1099-B itself was wrong, contact the broker first. Brokers must file a corrected 1099-B within 30 days of discovering the error.2Internal Revenue Service. Instructions for Form 1099-B (2026)
For a broader change to how you calculate basis across your portfolio — switching from one overall accounting method to another — the IRS may require Form 3115 (Application for Change in Accounting Method) instead of an amended return. Many of these changes qualify for automatic consent, meaning no user fee and no advance approval, provided you meet the eligibility rules.14Internal Revenue Service. Instructions for Form 3115 A one-time error goes on 1040-X; an ongoing method change goes on 3115.