The dropdown menu that quietly sets your tax bill
Sell a stock or fund you've owned for years, and your broker asks you to confirm the cost basis method before the trade settles. Most people click through it without reading it, because it looks like paperwork. It isn't. That setting decides which of your purchases the IRS considers sold first, and that choice can change your tax bill by thousands of dollars on the exact same sale.
This comes up constantly on Bogleheads, in threads with titles like "Which cost basis is best, average cost or FIFO" and "Which cost basis method do you suggest for a newbie." The confusion is understandable. Brokers bury the setting in account preferences, use inconsistent names for it, and rarely explain what changing it actually does to a future sale.
Here's what each method means, when it matters, and a worked example showing the same sale producing 3 different taxable gains depending on which one you use.
What a cost basis method actually decides
Every time you buy shares of the same stock or fund on different dates, you create a separate "lot." Each lot has its own purchase date and its own cost basis (what you paid, plus any reinvested dividends). When you sell only part of a larger position, some of your lots get sold and some don't. The cost basis method is the rule that decides which lots those are.
Since the sale price is the same regardless of which lots you sell, the only thing that changes is your cost basis, and therefore your taxable gain. Sell the lots with the highest cost basis, and you report the smallest gain. Sell the lots with the lowest cost basis, and you report the largest one.
The 3 methods
First-in, first-out (FIFO)
FIFO sells your oldest shares first. It's the default method most brokers apply to individual stocks and ETFs if you never select anything else.
Because older shares have usually had the most time to appreciate, FIFO tends to realize your largest gains first. It's simply what "oldest first" produces in an account that's grown over time. If you're sitting on a position you've held for a decade, a FIFO sale can trigger a bigger gain than you expected.
Specific identification
Specific identification lets you choose exactly which lots to sell, on a trade-by-trade basis. Want to sell your highest-cost shares to minimize this year's gain? You can. Want to sell your lowest-cost shares because you're intentionally realizing a gain (to use up a low tax bracket, for example)? You can do that too.
This is the method with the most control, and it's the one tax-focused investors default to. The tradeoff is that you have to actively pick lots at the time of each sale and keep records straight. Under IRS rules, you generally need to identify the specific shares to your broker by the trade's settlement date, which is typically 1 to 3 business days after the trade date depending on the security type. Miss that window and the sale locks in under whatever the account's default method is.
Average cost
Average cost blends every share you own of a given fund into a single average price per share, and sells at that blended basis regardless of when the shares were purchased. It's the traditional default for mutual funds, and it's why many people with an old mutual fund account have never thought about cost basis at all: the fund company handled it automatically.
Average cost is only available for mutual fund shares and dividend-reinvestment-plan (DRIP) stock, not for individual stocks or most ETFs bought as ordinary market purchases. It produces a gain somewhere between what FIFO and a tax-smart specific identification would produce, since it isn't optimizing for anything, just averaging.
One wrinkle worth knowing: once you've sold mutual fund shares under average cost, the basis for your remaining, previously-averaged shares generally stays locked at average cost even if you switch methods going forward. The IRS treats that election as effectively permanent for shares already covered by it. Only shares you buy after switching get the new method.
A worked example: same sale, 3 different tax bills
Jordan bought shares of the same index fund over several years:
| Purchase date | Shares | Price | Cost |
|---|---|---|---|
| January 2022 | 30 | $80 | $2,400 |
| June 2022 | 30 | $60 | $1,800 |
| January 2023 | 20 | $95 | $1,900 |
| June 2024 | 20 | $110 | $2,200 |
| Total | 100 | $8,300 |
That's an average cost of $83 per share. In late 2026, the fund trades at $130 per share, and Jordan sells 40 shares for $5,200 in proceeds. Here's what each method reports as the taxable gain:
FIFO: Sells the oldest 30 shares (January 2022, $2,400 basis) plus 10 shares from the next lot (June 2022, $600 basis). Total basis: $3,000. Gain: $2,200.
Average cost: 40 shares at the $83 blended average. Total basis: $3,320. Gain: $1,880.
Specific identification (choosing the highest-cost lots): Sells the 20 shares from June 2024 ($2,200 basis) plus the 20 shares from January 2023 ($1,900 basis). Total basis: $4,100. Gain: $1,100.
Same sale, same proceeds, same 100-share position. The taxable gain ranges from $1,100 to $2,200 depending entirely on which method was on file. All of these lots were held more than a year, so the gain is taxed at long-term capital gains rates either way, but the size of the gain itself is not fixed. It's a choice, whether or not you realized you were making one.
Which method should you actually use
If you're not actively managing tax lots, average cost or FIFO is fine for mutual funds, and FIFO is the likely default for everything else. Most people never sell a partial position anyway; they sell everything or nothing. The method only matters when you're selling part of a larger, multi-lot position.
If you're selling part of a position and you care about the tax bill, specific identification is almost always better. It's the only method that lets you choose. Selling the highest-cost lots first minimizes this year's gain. Selling the lowest-cost lots first (or lots that qualify for 0% capital gains treatment at your income level) can make sense in years you want to realize gains deliberately.
If you're doing tax-loss harvesting, this becomes essential rather than optional. Choosing the right lots to sell is the entire mechanism behind tax-loss harvesting, and the same lot-selection logic applies to harvesting losses in a taxable brokerage account and, with an extra layer of complexity, in crypto.
How to change your method
Most brokers let you set a default cost basis method for the account, and separately let you override it lot-by-lot at the time of each individual sale. Check your account settings; the option is usually under tax documents or account preferences, sometimes labeled "cost basis election" or "lot selection."
2 things to keep in mind. First, the change generally only applies going forward: switching from average cost to specific identification doesn't retroactively change the basis of shares you've already sold, and for mutual funds it may not change the basis of shares purchased before the switch either. Second, if your broker doesn't support specific identification for a given security (some don't, for older or less common holdings), you're stuck with whatever default they apply.
It compounds with where the asset sits
Cost basis method only affects taxable accounts. Inside a 401(k), IRA, or Roth IRA, there's no annual capital gains tax to manage, so none of this applies until money actually comes out. That's one more reason where you hold which asset matters as much as how you manage the lots within the accounts that are taxable.
Steady Wealth doesn't manage tax lots (your broker's cost basis records are the source of truth for that), but tracking your account balances over time in one place makes it easier to see which taxable positions have grown enough that lot selection is worth thinking about before you sell.
Ready to see your full financial picture?
Try Pro free for 30 days. No bank login required. No credit card.
Create your free dashboardFrequently asked questions
What is the default cost basis method if I don't choose one?
Most brokers default individual stocks and ETFs to FIFO (first-in, first-out) unless you select something else. Mutual funds have historically defaulted to average cost, though many brokers now default new mutual fund accounts to FIFO as well. Check your specific broker's settings; defaults vary and have changed over the past decade as cost-basis reporting rules evolved.
Can I switch cost basis methods after I've already bought shares?
Yes, generally. You can typically change your account's default method at any time for future sales. What you usually cannot do is retroactively change the basis of shares that were already sold under a different method, and for mutual fund shares already covered by an average cost election, that basis is often locked in for those specific shares even after you switch.
Does the cost basis method affect how much tax I actually owe, or just when I owe it?
Both, in different ways. It doesn't change the total tax you'll eventually pay across the life of the entire position (sell everything, and the total gain is the total gain no matter how you sliced the lots). What it changes is how much gain you realize, and therefore owe tax on, in any given year you sell only part of the position. That timing flexibility is the entire value of specific identification.
Is HIFO (highest-in, first-out) a real IRS cost basis method?
Not as a separately named IRS method. HIFO is a strategy, selling your highest-cost lots first, that you achieve by using specific identification and choosing those lots yourself. Some brokers offer "HIFO" as an automated preset within their specific identification tools, which makes it convenient, but it's built on the same underlying method.
Which method minimizes my taxes?
There's no single answer, because it depends on whether you want to minimize this year's gain or manage gains strategically across years. Specific identification, choosing the highest-cost lots, generally minimizes the taxable gain on any individual sale. But in some years, intentionally selling low-basis, highly appreciated lots (to use up a 0% capital gains bracket, for example) can be the better move. The value of specific identification isn't that it always minimizes tax; it's that it gives you the choice.