Capital Gains Tax Cost Basis Methods: FIFO, Specific ID, and Average Cost Explained
Understand the three cost basis methods — FIFO, specific identification, and average cost — and how each one changes the tax you owe on stock and mutual fund sales. Includes real examples and IRS rules.

Your Cost Basis Method Can Change Your Tax by Thousands
Most investors pick a cost basis method without thinking about it. Their brokerage defaults to FIFO, they never change it, and they end up paying more tax than necessary on every sale. The difference between methods is not theoretical — on a single stock sale, choosing the right method can save you hundreds or even thousands of dollars.
Cost basis is the number the IRS uses to calculate your gain. It represents what you paid for the shares, adjusted for commissions, splits, and other factors. When you sell, your gain equals your sale proceeds minus your cost basis. The higher your basis, the lower your gain, and the lower your tax.
The IRS allows three methods for determining which shares you sold and what their basis is: FIFO (first in, first out), specific identification, and average cost. Each method produces a different gain — sometimes dramatically different — and the rules about when you can use each one are strict. This guide explains all three methods, compares them with real examples, and helps you choose the one that minimizes your tax.
For the fundamentals of how cost basis factors into your overall tax calculation, our guide on h[how to calculate capital gains tax walks through the full formula from start to finish.
FIFO: The Default Method That Usually Costs You More
FIFO stands for "first in, first out." When you sell shares using FIFO, the IRS assumes you sold the oldest shares first — the ones you acquired earliest. Most brokerages use FIFO as their default method unless you specifically choose another approach.
The problem with FIFO is that your oldest shares usually have the lowest purchase price. Over time, stock prices tend to rise, so shares you bought five years ago likely cost much less than shares you bought last month. Selling the cheapest shares first produces the largest possible gain, which means the largest possible tax bill.
Here is a simple example. You made three purchases of the same stock:
- January 2022: 100 shares at $20/share ($2,000 total)
- June 2023: 100 shares at $50/share ($5,000 total)
- March 2025: 100 shares at $80/share ($8,000 total)
Now you sell 100 shares at $100/share ($10,000 proceeds). Under FIFO, you sell the January 2022 lot first. Your gain is $10,000 - $2,000 = $8,000. At the 15% long-term rate, your tax is $1,200.
Under specific identification, you could sell the March 2025 lot instead. Your gain would be $10,000 - $8,000 = $2,000. At the 15% rate, your tax is just $300.
That is a $900 difference on a single 100-share sale. Scale that up to a 1,000-share position and the savings can reach thousands of dollars.

When FIFO Actually Works in Your Favor
FIFO is not always the worst choice. If your oldest shares have the highest basis — which happens when you bought at a peak and later bought more at a lower price — FIFO actually minimizes your gain. This is uncommon for long-term investors in appreciating stocks, but it happens during volatile periods.
FIFO also tends to produce long-term gains rather than short-term gains, since the oldest shares are most likely to have crossed the one-year holding period. If your newer lots would produce short-term gains, FIFO's preference for older lots might save you by qualifying the gain for the lower long-term rate. Our short-term vs long-term rate comparison shows why this distinction matters so much.
Specific Identification: The Method That Gives You Full Control
Specific identification lets you choose exactly which shares you are selling. You tell your broker, "I want to sell the 100 shares I bought on March 15, 2025, at $80/share." Your broker executes the sale using that specific lot, and your gain is calculated using that lot's basis.
This method gives you maximum flexibility. You can choose the lot that produces the smallest gain (the highest basis), the lot that qualifies for long-term treatment (held more than one year), or even the lot that produces a loss if you want to harvest tax losses.
How to Use Specific Identification
The IRS requires you to identify the specific shares at the time of the sale — not later when you are preparing your tax return. Here is what you need to do:
- 1Tell your broker which lots to sell before the trade executes. Most online brokerages have a lot selection screen when you place a sell order. Look for options like "specific shares" or "specific lot" in the order entry interface.
- 1Receive confirmation from your broker. After the trade, your brokerage should send a confirmation that identifies which shares were sold. Keep this confirmation with your tax records. Without it, the IRS may treat the sale as FIFO.
- 1Match the confirmation to your 1099-B. Your Form 1099-B should reflect the specific lots you chose. If it does not, contact your brokerage to correct it before filing your return.
The Tax Savings Potential
Specific identification can save you money in several ways:
- Minimize gains: Sell the shares with the highest basis to produce the smallest taxable gain.
- Maximize losses: Sell losing lots to harvest tax losses, following the principles in our tax-loss harvesting guide.
- Control holding periods: Sell lots that qualify for the long-term rate and keep short-term lots until they cross the one-year threshold.
- Strategic partial sales: When you sell only part of a position, choose the lots that give you the best tax outcome on the portion you sell.
The main drawback is the record-keeping. You need to track the basis and holding period of every individual purchase lot, and you must make your selection at the time of sale. But the tax savings are well worth the effort for anyone with significant gains.
Average Cost: The Simple Method Reserved for Mutual Funds
Average cost takes all your purchases of a mutual fund, adds up the total cost, divides by the total number of shares, and produces a single per-share basis. When you sell, your gain is calculated using this blended average.
The calculation is straightforward. If you bought a mutual fund in three transactions:
- 200 shares at $25 ($5,000)
- 300 shares at $35 ($10,500)
- 500 shares at $40 ($20,000)
Your total cost is $35,500 for 1,000 shares. Average cost per share: $35,500 ÷ 1,000 = $35.50. If you sell 300 shares at $50 ($15,000), your basis on those shares is 300 × $35.50 = $10,650. Your gain: $15,000 - $10,650 = $4,350.

The Critical Rule: Once You Choose Average Cost, You Are Locked In
The IRS requires you to use the same average cost method for a given mutual fund for all future sales. If you start with average cost on your Vanguard S&P 500 fund, you cannot switch to FIFO or specific identification for that fund later. This irrevocability is the biggest downside of average cost.
There is one exception: if you sell all your shares in the fund and then buy back in, you can choose a new method for the new position. But this is rarely practical, and it could trigger wash sale issues if you repurchase quickly.
Average Cost vs FIFO vs Specific ID for Mutual Funds
For mutual funds, all three methods are available — unlike individual stocks, where average cost is not an option. Here is how they compare:
- FIFO sells the oldest shares first, typically producing the largest gain since older mutual fund shares often have lower per-share cost.
- Specific identification lets you pick the lots with the highest basis, minimizing your gain.
- Average cost produces a moderate gain — somewhere between FIFO and specific identification in most cases.
For more on how these methods apply specifically to mutual fund and ETF taxation, see our mutual fund and ETF capital gains tax guide.
IRS Rules on Cost Basis Reporting
Since 2011, the IRS has required brokerages to report cost basis for "covered securities" on Form 1099-B. Covered securities generally include:
- Stocks acquired after January 1, 2011 — your brokerage must report both proceeds and basis
- Mutual funds and ETFs acquired after January 1, 2012 — same requirement
- Options and other securities acquired after January 1, 2014 — basis must be reported
For shares acquired before these dates — called "noncovered securities" — your brokerage reports proceeds only, and you must calculate and report the basis yourself on Form 8949.
Your Brokerage's Default Method Matters
When you open a brokerage account, the firm assigns a default cost basis method. Most brokerages default to FIFO for stocks and average cost for mutual funds. You can change this at any time (for future sales), but the change does not retroactively affect past sales.
Check your brokerage settings before you sell. On platforms like Fidelity, Schwab, and Vanguard, you can find cost basis method preferences under account settings or tax preferences. Change it before your next sale if you want to use specific identification.
Which Method Should You Choose?
For Individual Stocks and ETFs
Specific identification is almost always the best choice for stocks and ETFs. It gives you full control over which shares you sell, lets you minimize gains, maximize losses, and manage holding periods. The extra record-keeping is minimal compared to the tax savings.
If you do not want the complexity of specific identification, FIFO is your only other option for stocks. It is simpler but usually produces larger gains.
For Mutual Funds
The choice is harder for mutual funds because of the irrevocability rule. If you choose average cost and later wish you had used specific identification, you cannot switch. Specific identification gives you more flexibility and typically lower gains, but it requires tracking individual purchase lots.
If you hold a mutual fund with significant gains and many purchase lots, specific identification is worth the effort. If the fund has modest gains or you only make one purchase, average cost is simpler and the tax difference is small.
For a broader look at how cost basis factors into your overall capital gains calculation, our capital gains tax rates complete breakdown explains how the resulting gain flows into the rate brackets.
How Cost Basis Affects Your Form 8949 Reporting
Every sale you report on Form 8949 requires a cost basis number. The method you chose determines what that number is, and it must match what your brokerage reported on your 1099-B (for covered securities) or what you calculated yourself (for noncovered securities).
If your 1099-B shows a basis that does not match your records — for example, because your brokerage used FIFO while you intended specific identification — you may need to enter an adjustment code on Form 8949. Code "B" indicates basis reported to the IRS that you are adjusting. This is a common situation when you switch methods mid-year.
For the full reporting walkthrough, see our guide on how to report capital gains on your tax return — it covers every line of Form 8949 and explains the adjustment codes.
Wash Sales and Cost Basis: The Interaction That Trips People Up
The wash sale rule adds a wrinkle to cost basis calculations. When you sell shares at a loss and buy substantially identical shares within 30 days before or after the sale, the loss is disallowed. That disallowed loss gets added to the basis of your replacement shares.
This basis adjustment matters because it reduces your gain on the replacement shares when you eventually sell them. The wash sale does not permanently deny the loss — it just postpones it by increasing your basis. But you need to track this adjustment carefully, or you will report the wrong gain on your future sale.
The Bottom Line on Cost Basis Methods
Your cost basis method is not just a administrative detail — it is a tax planning tool. FIFO produces the largest gains in most situations. Specific identification gives you control and typically the smallest gains. Average cost simplifies mutual fund reporting but locks you in permanently.
Before your next stock or fund sale, check your brokerage settings. Switch to specific identification if it is not already your default. Track your purchase lots with their dates and prices. And when you sell, choose the lots that minimize your taxable gain while respecting the holding period rules. For more on how these decisions fit into your overall tax strategy, explore our capital gains tax deferral strategies and our full collection of capital gains tax guides.
Fact-Checked & Reviewed
This article was written by David Chen (JD, LLM in Taxation (New York University)) and reviewed for accuracy by Sarah Mitchell (CPA, MST (Master of Science in Taxation)). Published by Wasim Akram, Founder & Lead Researcher at TaxGainsCalc. All tax rates, thresholds, and rules referenced are based on IRS publications and current tax law as of the date published. Tax laws change frequently — always consult a qualified tax professional for advice specific to your situation.
Tax Attorney & Legal Editor
David Chen is a tax attorney with a Juris Doctor and a Master of Laws in Taxation from New York University School of Law. With over 10 years of legal practice, he specializes in 1031 exchanges, capital gains tax law, and IRS dispute resolution. David...
Certified Public Accountant (CPA)
Sarah Mitchell is a Certified Public Accountant with over 15 years of experience in individual and business taxation. She holds a Master of Science in Taxation from Golden Gate University and specializes in capital gains tax planning, investment tax ...

Founder & Lead Researcher, TaxGainsCalc
Wasim Akram is an independent web publisher and digital entrepreneur based in India. Since 2018, he has been building custom CMS platforms, WordPress plugins, niche websites, and AI-powered digital products with over 8 years of real-world experience....
Disclaimer: This article is for informational purposes only and does not constitute tax, legal, or financial advice. Tax laws and regulations change frequently, and the information presented here may not reflect the most current updates. You should consult with a qualified CPA, tax attorney, or financial advisor before making any tax-related decisions. TaxGainsCalc is not responsible for any actions taken based on the information provided in this article.


