Quick Answer
FIFO (First In, First Out) sells your oldest shares first, LIFO (Last In, First Out) sells newest shares first, and specific identification lets you choose exactly which shares to sell. Most brokers default to FIFO, but specific identification can save you hundreds or thousands in taxes by strategically harvesting losses or managing gains.
Best Answer
Robert Kim, Tax Return Analyst
Individual investors with taxable brokerage accounts who want to minimize their tax bill
How cost basis methods work
Cost basis is what you originally paid for an investment, plus any fees. When you sell, your capital gain or loss is the sale price minus your cost basis. The three main methods determine WHICH shares' cost basis to use when you sell part of your holdings.
FIFO (First In, First Out) automatically sells your oldest shares first. LIFO (Last In, First Out) sells your newest shares first. Specific identification lets you choose exactly which shares to sell.
Most brokers default to FIFO, but this isn't always optimal for taxes.
Example: $10,000 Apple stock purchase over time
Let's say you bought Apple stock in three purchases:
In February 2025, Apple is trading at $220, and you want to sell 100 shares for $22,000.
With LIFO, you'd save $1,000 in taxes compared to FIFO ($1,400 - $400).
When to use each method
Use FIFO when:
Use LIFO when:
Use specific identification when:
How to implement specific identification
To use specific identification, you must:
1. Notify your broker BEFORE the settlement date (usually T+2 for stocks)
2. Specify the exact shares by purchase date and price
3. Keep detailed records of all transactions
4. Get written confirmation from your broker
Most major brokers (Fidelity, Schwab, Vanguard) offer online tools to select specific lots when selling.
Advanced strategy: Tax-loss harvesting
Specific identification shines for tax-loss harvesting. If you have both winners and losers in your portfolio, you can:
1. Sell losing positions to realize capital losses
2. Use specific ID to sell high-basis shares of winners
3. Offset gains with losses to minimize taxes
Example: You have $5,000 in capital losses from selling a bad stock. You want to sell some Apple shares but minimize taxes. Use specific identification to sell your highest-cost-basis Apple shares first, reducing your taxable gain.
What you should do
1. Check your broker's default method - most use FIFO
2. Switch to specific identification if you actively manage investments
3. Keep detailed purchase records with dates and prices
4. Consult a tax professional for complex situations involving multiple accounts
Use our return scanner to identify if you've been using the optimal cost basis method for your situation.
Key takeaway: Specific identification gives you the most tax control and can save hundreds or thousands annually, but requires advance planning and good record-keeping. LIFO often minimizes current taxes, while FIFO is the simplest default method.
*Sources: [IRS Publication 550](https://www.irs.gov/pub/irs-pdf/p550.pdf), [IRS Publication 544](https://www.irs.gov/pub/irs-pdf/p544.pdf)*
Key Takeaway: Specific identification offers maximum tax control and can save hundreds or thousands in taxes annually, but requires notifying your broker before selling and maintaining detailed records.
Comparison of cost basis methods for a sample stock sale
| Method | Shares Sold | Cost Basis | Capital Gain | Tax Owed (20% rate) |
|---|---|---|---|---|
| FIFO | Jan 2023 shares | $15,000 | $7,000 | $1,400 |
| LIFO | Dec 2024 shares | $20,000 | $2,000 | $400 |
| Specific ID | June 2024 shares | $18,000 | $4,000 | $800 |
More Perspectives
Robert Kim, Tax Return Analyst
Millennials and Gen Z investors just starting to build taxable investment accounts
The basics for new investors
When you're starting out, cost basis methods might seem complicated, but understanding them early can save you serious money as your portfolio grows.
The simple version: When you sell part of your stock holdings, the IRS needs to know which specific shares you sold to calculate your taxes. FIFO sells your oldest shares first, LIFO sells newest first, and specific identification lets you pick.
Why this matters for young investors
Most young investors use dollar-cost averaging - buying the same stock regularly over time at different prices. This creates the perfect scenario where cost basis method matters.
Example: You buy $500 of an S&P 500 index fund monthly. After two years, you have shares purchased at prices ranging from $350 to $450. When you need to sell $5,000 for an emergency, which shares should you sell?
Start with specific identification
Unlike older investors who might be set in their ways, you can start with the best method from day one. Set up specific identification with your broker (Fidelity, Schwab, etc.) right when you open your account.
Young investor advantage: Time horizon
You have decades before retirement, which means you can be strategic about:
Key takeaway: Starting with specific identification from day one sets you up for decades of tax optimization - a small effort now that compounds into major savings over time.
Key Takeaway: Young investors should start with specific identification immediately to maximize decades of tax optimization potential, rather than switching methods later with a complex portfolio.
Robert Kim, Tax Return Analyst
Investors in their 40s-60s actively building retirement savings across multiple account types
Cost basis strategy for retirement savers
If you're in your peak earning years, cost basis method choice becomes critical because you're likely in higher tax brackets and have substantial taxable investments alongside your 401(k) and IRA.
Key insight: Cost basis methods only apply to taxable accounts. Your 401(k), IRA, and Roth IRA don't have cost basis issues because contributions and growth are tracked differently.
Managing your three-bucket strategy
Most retirement savers have:
1. Tax-deferred accounts (401k, traditional IRA) - no cost basis issues
2. Tax-free accounts (Roth IRA, Roth 401k) - no cost basis issues
3. Taxable accounts - where cost basis methods matter
For your taxable accounts, specific identification becomes powerful for:
Pre-retirement tax planning example
At 55, you're planning to retire at 62. You have $200,000 in taxable investments with shares bought over 15 years. In your final working years, use specific identification to:
1. Harvest losses to build up capital loss carryforwards
2. Realize long-term gains in lower-income years (maybe you take unpaid leave)
3. Hold appreciated positions until retirement when you might be in a lower bracket
This strategy can save thousands in the transition from working to retirement.
Coordination with retirement account withdrawals
In retirement, you'll have required minimum distributions (RMDs) from traditional accounts starting at 73. Use specific identification in taxable accounts to:
Key takeaway: For retirement savers, specific identification in taxable accounts becomes a powerful tool to coordinate with retirement account distributions and optimize your overall tax picture across all three account types.
Key Takeaway: Retirement savers should use specific identification in taxable accounts to coordinate with RMDs and optimize their overall tax strategy across tax-deferred, tax-free, and taxable account withdrawals.
Sources
- IRS Publication 550 — Investment Income and Expenses
- IRS Publication 544 — Sales and Other Dispositions of Assets
Reviewed by Robert Kim, Tax Return Analyst on February 28, 2026
This content is for educational purposes only and is not a substitute for professional tax advice. Consult a qualified tax professional for advice specific to your situation.