Cost Basis Methods Explained: FIFO, LIFO, Specific ID & Average Cost
Two investors can sell the exact same number of shares, of the exact same stock, on the exact same day, for the exact same price — and owe wildly different amounts of tax. The variable is not the sale. It is which shares they decided to sell. That decision is called your cost basis method, and it is one of the few genuinely free tax levers most investors have. It costs nothing to pull, requires no change to your investment strategy, and in the worked example below it swings the tax bill from $1,537 down to $60 on an identical trade.
Most people never touch it, because brokerages bury the setting and quietly apply a default. This guide explains what cost basis actually is, how each of the four methods works, how they compare on the same set of purchases, and how to pick one deliberately.
What cost basis is and why it decides your tax bill
Cost basis is what you have invested in an asset for tax purposes. It is the starting point the IRS subtracts from your sale proceeds to work out your taxable gain:
Sale proceeds − adjusted cost basis = capital gain or loss
Every dollar you can legitimately add to basis is a dollar of gain you never pay tax on. At a 15% long-term rate, $10,000 of extra basis is $1,500 you keep. At a 24% ordinary rate on a short-term gain, it is $2,400. This is why basis errors are expensive in both directions: understate it and you overpay; overstate it and you have filed an inaccurate return.
The complication is that most investors do not buy a position all at once. You buy some shares in 2019, add more in 2021, reinvest dividends every quarter, and buy the dip in 2026. Each of those purchases is a separate tax lot with its own cost per share and its own acquisition date. When you sell part of the position, the IRS needs to know which lot you sold — because that determines both the size of the gain and whether it is short-term or long-term. The cost basis method is the rule that answers that question.
Why the holding period matters as much as the number
Lot selection controls two things at once. The first is the dollar amount of gain. The second, often more valuable, is the character of that gain. Shares held more than one year qualify for long-term capital gains rates of 0%, 15%, or 20%. Shares held one year or less are taxed as short-term gains at your ordinary income rate, which can reach 37%. A method that shaves $2,000 off your gain but converts the remainder from long-term to short-term can easily be the worse choice.
What adjusts your basis before you pick a method
Before comparing methods, get the underlying numbers right. Basis is rarely just the price on the trade ticket:
| Event | Effect on basis |
|---|---|
| Commissions and transaction fees | Added to basis on purchase; subtracted from proceeds on sale |
| Reinvested dividends and capital gain distributions | Each reinvestment creates a new lot at that day's price and increases total basis |
| Stock splits | Total basis unchanged; per-share basis divided across the new share count |
| Return of capital distributions | Reduces basis (common with REITs, MLPs, and some funds) |
| Wash sale disallowed loss | Added to the basis of the replacement shares, and the holding period carries over |
| Inherited property | Reset to fair market value at date of death — see our inherited property guide |
| Gifted property | Carryover of the donor's basis, with a special dual-basis rule if sold at a loss |
| Real estate improvements | Capital improvements increase basis; depreciation reduces it |
The four cost basis methods
1. FIFO (first-in, first-out)
FIFO sells your oldest shares first. It is the IRS default for stocks, bonds, and most ETFs: if you never make an election and never tell your broker otherwise, this is what happens. It is simple, it never requires you to make a decision, and it is the method regulators assume in the absence of evidence.
Its consequences follow directly from that rule. In a position that has appreciated over time, your oldest shares are usually your cheapest shares, so FIFO reports the largest possible gain. The offsetting benefit is that the oldest shares are also the ones most likely to have cleared the one-year mark, so FIFO reliably produces long-term treatment — which is why it is not always the loser it appears to be.
2. LIFO (last-in, first-out)
LIFO sells your newest shares first. In a rising market those are typically your highest-cost shares, so the reported gain is smaller than under FIFO. The risk is holding period: recently purchased lots are the ones most likely to still be short-term, and a short-term gain at 24% or 32% can cost more than a larger long-term gain at 15%.
A note on how LIFO actually exists: for securities, it is not a separate statutory method the way FIFO and average cost are. Brokers implement LIFO, HIFO, and similar options as standing instructions that apply specific identification automatically using a chosen sort order. That is permissible, because the broker records and confirms which specific lots were sold on each trade.
3. Specific identification (and its HIFO variant)
Specific identification means you name the exact lots you want to sell on a trade-by-trade basis. It is the most powerful method because it is the only one that lets you optimize for the situation in front of you rather than following a fixed rule.
Under specific ID you can:
- Sell your highest-cost lots to minimize a gain — the strategy brokers label HIFO (highest-in, first-out)
- Sell an underwater lot to deliberately harvest a loss that offsets other gains
- Sell only lots past the one-year mark to guarantee long-term treatment
- Sell low-basis lots on purpose in a year when your income is low enough for the 0% long-term bracket
The cost is administrative. To use specific ID you must identify the shares no later than the settlement date of the sale, and your broker must confirm that identification in writing — a trade confirmation listing the selected lots satisfies this. You cannot reconstruct a more favorable selection in April when preparing your return.
4. Average cost
Average cost pools every share you own of a holding and divides total basis by total shares to get one uniform per-share basis. It is the workhorse method for mutual funds, and it is the reason fund investors rarely think about tax lots at all.
Two restrictions matter. First, eligibility: average cost is available only for regulated investment company shares — mutual funds and ETFs — and for stock held in a qualifying dividend reinvestment plan. It cannot be used for an ordinary individual stock position, and it cannot be used for cryptocurrency. Second, consistency: once you elect average cost for a fund, it applies to all your shares in that fund. You may revoke the election for shares you still hold, but the change is prospective and does not revisit sales already reported.
Holding period is still tracked separately. Even under average cost, shares are generally treated as sold in the order acquired for determining whether the gain is short-term or long-term.
Worked example: one portfolio, four methods
Rachel has been building a position in a single stock, ticker NWSC, for seven years. Her four purchase lots as of September 2026:
| Lot | Purchase date | Shares | Price | Lot cost | Holding period |
|---|---|---|---|---|---|
| A | Mar 12, 2019 | 100 | $40 | $4,000 | Long-term |
| B | Jun 20, 2021 | 100 | $75 | $7,500 | Long-term |
| C | Nov 5, 2023 | 100 | $130 | $13,000 | Long-term |
| D | Feb 14, 2026 | 100 | $95 | $9,500 | Short-term |
Total position: 400 shares, $34,000 total cost, $85.00 average cost per share.
On September 15, 2026 Rachel sells 150 shares at $120, for $18,000 in proceeds. She is a single filer with $120,000 of ordinary taxable income, which puts her in the 24% ordinary bracket and the 15% long-term capital gains bracket. Note the two features that make this realistic and make the methods diverge: lot C was bought near a peak and is currently at a loss, and lot D is both cheap and short-term.
Method 1 — FIFO
Oldest first: all 100 shares of lot A, plus 50 shares of lot B.
- Basis: $4,000 + (50 × $75 = $3,750) = $7,750
- Gain: $18,000 − $7,750 = $10,250, entirely long-term
- Tax: $10,250 × 15% = $1,537.50
Method 2 — LIFO
Newest first: all 100 shares of lot D, plus 50 shares of lot C.
- Lot D: proceeds $12,000 − basis $9,500 = $2,500 short-term gain
- Lot C: proceeds $6,000 − basis $6,500 = $500 long-term loss
- Netting: the $500 long-term loss offsets the short-term gain, leaving a $2,000 net short-term gain
- Tax: $2,000 × 24% = $480
Method 3 — Specific identification (HIFO)
Rachel selects her most expensive shares: all 100 of lot C, plus 50 shares of lot D.
- Lot C: proceeds $12,000 − basis $13,000 = $1,000 long-term loss
- Lot D: proceeds $6,000 − basis $4,750 = $1,250 short-term gain
- Netting: $1,250 − $1,000 = $250 net short-term gain
- Tax: $250 × 24% = $60
Method 4 — Average cost
All 400 shares share a single $85.00 basis. (This method would only be available if NWSC were a fund or held in a qualifying DRIP — it is shown here for comparison.)
- Basis: 150 × $85.00 = $12,750
- Gain: $18,000 − $12,750 = $5,250
- Holding period still runs FIFO, so the shares map to lots A and B: entirely long-term
- Tax: $5,250 × 15% = $787.50
Side-by-side result
| Method | Basis used | Reported gain | Character | Rate | Tax owed |
|---|---|---|---|---|---|
| FIFO | $7,750 | $10,250 | Long-term | 15% | $1,537.50 |
| Average cost | $12,750 | $5,250 | Long-term | 15% | $787.50 |
| LIFO | $16,000 | $2,000 | Short-term (net) | 24% | $480.00 |
| Specific ID (HIFO) | $17,750 | $250 | Short-term (net) | 24% | $60.00 |
Same stock, same 150 shares, same $18,000 of proceeds, same day. The spread between the best and worst outcome is $1,477.50 — a 96% reduction in tax for the price of a few clicks in the order ticket. Notice also that LIFO beat average cost here despite being taxed at the higher 24% rate, because the gain it reported was so much smaller. Rate and amount both matter; neither alone tells you the answer.
Which method saves the most tax?
Specific identification wins in almost every current-year comparison, because it is the only method that lets you look at your actual lots and pick. Every other method is a fixed rule that will sometimes pick badly. But the ranking is not universal, and three situations flip it:
- A declining position. If prices have fallen since you started buying, your oldest shares may be your most expensive. FIFO then produces the smallest gain, or even a useful loss, automatically.
- Short-term versus long-term. Selling recent high-cost lots often means short-term treatment. A $4,000 long-term gain at 15% ($600) beats a $2,000 short-term gain at 32% ($640). Always compare after-tax dollars, not gain size.
- A 0% bracket year. If your taxable income falls under $49,450 single or $98,900 joint in 2026, long-term gains are taxed at 0% federally. In that year you should deliberately sell your lowest-basis long-term lots — the opposite of HIFO — to reset basis permanently at no cost. Our guide to reducing capital gains tax covers this gain-harvesting strategy in detail.
State tax can also change the calculus. In states with no preferential long-term rate — California being the sharpest example, taxing gains as ordinary income up to 13.3% — the federal short-term versus long-term distinction still matters, but the state layer is flat either way, which slightly favors whichever method minimizes raw gain.
IRS rules, deadlines, and broker defaults
Three procedural rules determine whether your chosen method actually holds up.
The settlement-date deadline
Specific identification must happen at or before settlement, and the broker must confirm it. In practice this means selecting lots inside the order ticket when you place the trade, or calling your broker the same day. There is no retroactive election.
Your broker's default is not necessarily the IRS default
The IRS fallback for stocks is FIFO, but brokers set their own account-level defaults — commonly FIFO for equities and average cost for mutual funds, though some default to HIFO or "tax-efficient loss harvester" logic. Whatever your broker reports on Form 1099-B is what the IRS receives. Find the cost basis setting in your account preferences and set it deliberately; you can usually configure a standing default and still override it per trade.
Covered versus noncovered shares
Brokers have been required to report basis to the IRS for covered securities — generally stock acquired after January 1, 2011, mutual fund and DRIP shares after January 1, 2012, and most bonds and options after January 1, 2014. For noncovered shares acquired before those dates, the 1099-B may show proceeds only, and reconstructing basis from old statements is your responsibility. Covered and noncovered lots are reported in separate sections of Form 8949 and cannot be averaged together.
How to choose your method
| Your situation | Best method | Why |
|---|---|---|
| Selling part of an appreciated stock position | Specific ID / HIFO | Minimizes the reported gain; you keep control per trade |
| Taxable income under the 0% LTCG threshold this year | Specific ID (lowest basis) | Realize cheap long-term gains at 0% and permanently reset basis |
| Long-held mutual fund with years of reinvested dividends | Average cost | Dozens of tiny lots make per-lot tracking impractical for little benefit |
| Position that has declined since you began buying | FIFO | Oldest shares are the expensive ones; FIFO minimizes gain automatically |
| You want guaranteed long-term treatment | FIFO or Specific ID | Both let you sell only shares held over one year |
| Deliberately harvesting a loss to offset other gains | Specific ID | Only method that lets you target the specific underwater lot |
| Holding inside an IRA or 401(k) | Irrelevant | No capital gains tax inside tax-advantaged accounts — do not spend effort here |
A reasonable default for most taxable brokerage accounts: set the account to specific identification or HIFO, keep average cost for legacy mutual funds where lot-level records are messy, and revisit the choice each December alongside your year-end tax planning.
Five costly mistakes
- Accepting the broker default without looking. Most investors sit on FIFO for years without knowing it. In a long bull market this is the most expensive setting available.
- Trying to choose lots at tax time. The identification must be made by settlement date. In April your only options are what the 1099-B already says.
- Optimizing gain size and ignoring holding period. Converting a long-term gain into a short-term one can more than cancel out a smaller gain.
- Forgetting reinvested dividends. Every reinvestment added basis. Omitting them means paying tax twice on the same money.
- Ignoring wash sales when harvesting losses. Repurchasing a substantially identical security within 30 days before or after a loss sale disallows the loss and shifts it into the basis of the replacement shares. See our 2026 tax changes guide for current reporting details.
Frequently asked questions
Which cost basis method saves the most tax?
Specific identification, in nearly all current-year comparisons, because it is the only method that lets you inspect your lots and choose. When prices have risen, selecting your highest-cost lots (HIFO) minimizes the gain; when you want a loss, you can target an underwater lot instead. FIFO is typically the most expensive in a long bull market because it sells your oldest and cheapest shares first, and average cost usually lands in the middle. The important caveat is that specific ID defers rather than erases: the low-basis shares you retain will produce a larger gain when eventually sold.
What is the default cost basis method if I do not choose one?
For individual stocks, bonds, and most ETFs the IRS default is FIFO. For mutual funds and shares held in a dividend reinvestment plan, many brokers set average cost as the account default. Your broker's standing default may differ from the IRS fallback, so check your account settings before you sell — whatever appears on your Form 1099-B is what the IRS sees.
Can I change my cost basis method after I sell?
Generally no. Specific identification requires you to identify the shares no later than the settlement date, with written confirmation from your broker. Average cost has one narrow exception: you may revoke an average cost election for shares you still hold, but the revocation applies prospectively and does not change sales already reported.
Is LIFO allowed for stocks?
LIFO is not a separate statutory method for securities the way FIFO and average cost are. Brokers offer LIFO, HIFO, and similar options as standing instructions that apply specific identification automatically with a chosen sort order — newest lots first for LIFO, highest cost first for HIFO. That is fully permissible as long as your broker records and confirms which lots were sold on each trade.
Can I use average cost for individual stocks or cryptocurrency?
No. Average cost is limited to mutual fund and ETF shares and to stock held in a qualifying dividend reinvestment plan. Cryptocurrency is treated as property and cannot use average cost; from the 2025 tax year the IRS requires wallet-by-wallet tracking, with FIFO applying unless you make an adequate specific identification at the time of the transaction.
Does cost basis method matter for real estate?
Not in the same way — you sell a specific property, so there are no lots to choose between. What matters instead is adjusting basis correctly for capital improvements, depreciation, and closing costs. Our real estate capital gains guide and home sale exclusion guide walk through those adjustments.