← Back to calculator
Cost Basis

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:

EventEffect on basis
Commissions and transaction feesAdded to basis on purchase; subtracted from proceeds on sale
Reinvested dividends and capital gain distributionsEach reinvestment creates a new lot at that day's price and increases total basis
Stock splitsTotal basis unchanged; per-share basis divided across the new share count
Return of capital distributionsReduces basis (common with REITs, MLPs, and some funds)
Wash sale disallowed lossAdded to the basis of the replacement shares, and the holding period carries over
Inherited propertyReset to fair market value at date of death — see our inherited property guide
Gifted propertyCarryover of the donor's basis, with a special dual-basis rule if sold at a loss
Real estate improvementsCapital improvements increase basis; depreciation reduces it
The most commonly missed item: reinvested dividends. An investor who has held a dividend fund for fifteen years may have sixty separate reinvestment lots. Forgetting them means paying tax on money you already paid tax on when the dividend was distributed. This is one of the most frequent sources of overpayment on long-held fund positions.

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:

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:

LotPurchase dateSharesPriceLot costHolding period
AMar 12, 2019100$40$4,000Long-term
BJun 20, 2021100$75$7,500Long-term
CNov 5, 2023100$130$13,000Long-term
DFeb 14, 2026100$95$9,500Short-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.

Method 2 — LIFO

Newest first: all 100 shares of lot D, plus 50 shares of lot C.

Method 3 — Specific identification (HIFO)

Rachel selects her most expensive shares: all 100 of lot C, plus 50 shares of lot D.

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.)

Side-by-side result

MethodBasis usedReported gainCharacterRateTax owed
FIFO$7,750$10,250Long-term15%$1,537.50
Average cost$12,750$5,250Long-term15%$787.50
LIFO$16,000$2,000Short-term (net)24%$480.00
Specific ID (HIFO)$17,750$250Short-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.

The catch you must plan for: specific ID did not eliminate $1,477 of tax, it deferred most of it. After the FIFO sale Rachel's remaining 250 shares carry $26,250 of basis. After the HIFO sale they carry only $16,250. That $10,000 difference is embedded gain waiting for a future sale. Deferral is still valuable — you keep the money working for years, and you may be in a lower bracket later — but it is not the same as erasure.

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:

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.

Cryptocurrency is now stricter. Digital assets cannot use average cost. Beginning with the 2025 tax year the IRS requires basis tracking wallet by wallet rather than across your whole portfolio, with FIFO applying within each account unless you make an adequate specific identification at the time of the transaction. See our crypto capital gains guide.

How to choose your method

Your situationBest methodWhy
Selling part of an appreciated stock positionSpecific ID / HIFOMinimizes the reported gain; you keep control per trade
Taxable income under the 0% LTCG threshold this yearSpecific ID (lowest basis)Realize cheap long-term gains at 0% and permanently reset basis
Long-held mutual fund with years of reinvested dividendsAverage costDozens of tiny lots make per-lot tracking impractical for little benefit
Position that has declined since you began buyingFIFOOldest shares are the expensive ones; FIFO minimizes gain automatically
You want guaranteed long-term treatmentFIFO or Specific IDBoth let you sell only shares held over one year
Deliberately harvesting a loss to offset other gainsSpecific IDOnly method that lets you target the specific underwater lot
Holding inside an IRA or 401(k)IrrelevantNo 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

  1. 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.
  2. 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.
  3. 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.
  4. Forgetting reinvested dividends. Every reinvestment added basis. Omitting them means paying tax twice on the same money.
  5. 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.

Ready to run your own numbers? Once you know which lots you are selling and your resulting gain, our free capital gains calculator gives you the federal and state tax in seconds. This guide is educational and not tax advice — confirm lot selection with a CPA before executing large trades.
CC
CapitalCalc Editorial Team

Our editorial team combines expertise in tax law, financial planning, and software engineering. All content is fact-checked against primary IRS sources (Revenue Procedures, Publications, and Instructions) and reviewed by professionals with backgrounds in public accounting and fintech. We update our guides annually to reflect the latest tax code changes.

About Us → Editorial Policy →