Skip to main content
Capital Gains: Short vs Long-Term

Cost Basis Methods: FIFO, LIFO, Average Cost, and Specific ID

Pomegra Learn

Which Cost Basis Method Should You Use to Minimize Capital Gains?

When you sell only a portion of your shares in a stock you've purchased multiple times at different prices, you face a critical tax-planning decision: which shares are you selling? The method you choose determines your capital gain or loss and can mean thousands of dollars in taxes. The IRS gives you four cost basis methods—FIFO, LIFO, average cost, and specific identification—each with distinct tax consequences. Choosing strategically is one of the highest-impact levers available to individual investors.

Quick definition: Cost basis method is the rule you use to determine which shares you're selling when you have multiple purchase lots at different prices. The method you select directly determines your tax liability on the sale.

Key takeaways

  • The IRS allows four cost basis methods: FIFO (first-in, first-out), LIFO (last-in, first-out), average cost (both weighted and unweighted), and specific identification
  • FIFO is the IRS default if you don't specify a method; it often leads to the largest capital gains in rising markets because you sell your oldest, cheapest shares first
  • Specific identification gives you the most control, allowing you to sell the exact shares you choose—often the highest-cost (most recent) lots—minimizing gains
  • Different brokers default to different methods, and some don't support all four; you must declare your choice in writing to establish it permanently
  • The method you choose is binding for that particular sale; you cannot change your mind after the transaction settles or on your tax return
  • Switching methods requires IRS approval, making your initial choice critical
  • In falling markets, FIFO can help you harvest losses strategically; in rising markets, specific identification or average cost typically saves more tax

Understanding Cost Basis Foundations

Cost basis is your original investment amount. When you buy 100 shares of a stock at $50/share, your cost basis is $5,000. If you later buy another 100 shares at $60/share, you now have two "lots" with different basis amounts. When you sell 80 shares, which 80 are you selling?

This question matters because your capital gain or loss is calculated as: Sale Price minus Cost Basis equals Gain/Loss. If you sell high-basis shares (your most expensive purchases), your gain is smaller. If you sell low-basis shares (your cheapest purchases), your gain is larger. In a year of gains elsewhere on your return, harvesting low-basis shares creates excess losses; in a year where you have gains, selling high-basis shares minimizes your tax bill.

The IRS recognizes that taxpayers should have some control here. The tax code and IRS rules (Revenue Ruling 2008-47 and publication guidance) allow you to specify which shares you are selling rather than defaulting to a rigid rule. However, most investors don't take advantage of this power, defaulting to their broker's preference and paying thousands more in taxes than necessary.

Consider a real scenario: You own 500 shares of a technology stock purchased over five years:

  • Year 1: 100 shares at $30 = $3,000 basis
  • Year 2: 150 shares at $40 = $6,000 basis
  • Year 3: 100 shares at $50 = $5,000 basis
  • Year 4: 50 shares at $60 = $3,000 basis
  • Year 5: 100 shares at $80 = $8,000 basis
  • Total: 500 shares, $25,000 total basis

The stock is now at $120/share. You decide to sell 150 shares for $18,000. Using FIFO, you sell your oldest lot (Year 1 at $30), gaining $13,500. Using specific identification, you could sell your Year 5 lot (at $80), gaining only $6,000. That $7,500 difference in gains could save $1,125 to $2,750 in taxes.

The Four Methods Explained

FIFO: First-In, First-Out

FIFO assumes you sell the oldest shares first—the ones you bought earliest. This is the IRS's default method if you don't specify anything. In rising markets, FIFO typically produces the largest capital gains because you're selling your cheapest purchases.

Mechanics: When you sell, your broker identifies the shares purchased earliest and assumes those are the ones being sold, regardless of which specific shares you might physically have intended to sell.

Tax consequence: In bullish markets where stock prices generally rise over time, FIFO leads to maximum gains and maximum tax liability. However, in bear markets or for volatile stocks that drop and recover, FIFO can sometimes be advantageous if you're harvesting losses early.

When to use FIFO: Use FIFO only if you have a clear year-over-year loss strategy (buying low, selling even lower on old positions) or if simplicity is paramount and your positions haven't appreciated significantly. Most investors should not default to FIFO.

Example:

  • Purchase 1: 100 shares at $20 (basis = $2,000)
  • Purchase 2: 100 shares at $40 (basis = $4,000)
  • Sell 100 shares at $60 = $6,000 proceeds

Using FIFO, you sell the oldest 100 shares at $20 basis. Gain = $6,000 - $2,000 = $4,000. Tax at 15% long-term rate = $600.

LIFO: Last-In, First-Out

LIFO assumes you sell the most recently purchased shares first—the ones you bought most recently. In rising markets, this can be tax-efficient because recent purchases typically have higher cost basis (you bought near the top). LIFO is particularly useful for stocks held in accounts for many years where you've added to the position over time.

Mechanics: Your broker identifies the most recent purchase lot and assumes those are the shares being sold.

Tax consequence: In rising markets, LIFO often produces smaller gains than FIFO because recent purchases have higher basis. However, LIFO is less flexible than specific identification—you must sell the most recent lot in full before moving to the next-most-recent lot.

When to use LIFO: LIFO works well if you've consistently added to a position at higher prices over time. It's particularly useful in retiring accounts or if you know you won't be regularly buying more of the stock. However, be aware that LIFO has special rules in some contexts (inventory accounting, for instance), and not all brokers support LIFO for securities.

Example (using the same purchases as above):

  • Purchase 1: 100 shares at $20 (basis = $2,000)
  • Purchase 2: 100 shares at $40 (basis = $4,000)
  • Sell 100 shares at $60 = $6,000 proceeds

Using LIFO, you sell the most recent 100 shares at $40 basis. Gain = $6,000 - $4,000 = $2,000. Tax at 15% long-term rate = $300. A $300 savings versus FIFO.

Average Cost Method

Average cost calculates your cost basis as the simple average (or weighted average) of all purchases. You divide your total cost basis by the total number of shares to arrive at an average per-share cost.

Mechanics: When you sell, you use this average cost for all shares sold, regardless of when you purchased them.

Tax consequence: Average cost provides a middle ground between FIFO and specific identification. In most rising markets, it produces tax liability between the two extremes. It's simpler than specific identification (no lot selection needed) but more strategic than FIFO.

Weighted vs. unweighted: Most modern investing uses weighted average cost (each share's contribution to the average weighted by the number of shares at that price). Unweighted average (simple arithmetic mean) is rarely used.

When to use average cost: Average cost is useful for investors who have accumulated a position over many years and don't want to manually identify lots but still want a moderate tax outcome. It's also the default for many mutual funds (where specific identification can be cumbersome).

Example:

  • 200 shares purchased (100 at $20, 100 at $40)
  • Total basis: $2,000 + $4,000 = $6,000
  • Average cost per share: $6,000 ÷ 200 = $30/share
  • Sell 100 shares at $60/share = $6,000 proceeds
  • Cost basis for 100 shares: 100 × $30 = $3,000
  • Gain = $6,000 - $3,000 = $3,000
  • Tax at 15% = $450

Specific Identification

Specific identification is the gold standard for tax planning. You explicitly tell your broker exactly which shares you want to sell (by lot, purchase date, and cost basis). Your broker must confirm in writing that they received and recorded your instruction. This method gives you maximum control over your tax outcome.

Mechanics: Before or at the time of sale, you provide written instructions identifying the specific shares by purchase date and purchase price. You must receive written confirmation from your broker. Your tax return must match your broker's records.

Tax consequence: Specific identification typically minimizes capital gains in rising markets because you can choose to sell your highest-cost-basis shares, producing the smallest gains. This is the most tax-efficient method for most scenarios.

When to use specific identification: Always use specific identification when you have multiple purchase lots and you want to optimize your tax liability. It's the best choice for high-income investors managing concentrated positions, for harvesting gains strategically, or for harvesting losses to offset other gains.

Example:

  • Purchase 1: 100 shares at $20
  • Purchase 2: 100 shares at $40
  • Sell 100 shares at $60/share = $6,000 proceeds

You specify you're selling the 100 shares from Purchase 2 (at $40 basis). Gain = $6,000 - $4,000 = $2,000. Tax at 15% = $300.

If you had specified Purchase 1 instead, gain would be $4,000 and tax would be $600—a difference of $300 on a single 100-share sale.

Visualizing the Cost Basis Decision Tree

Broker Defaults and Limitations

Not all brokers support all four methods. Your brokerage firm will have a default method if you don't specify one. Common defaults:

  • Fidelity: Defaults to FIFO, but supports specific identification and average cost
  • Charles Schwab: Defaults to FIFO; supports specific identification
  • Vanguard: For mutual funds, uses average cost by default; for individual stocks, allows specific identification
  • E*TRADE: Defaults to FIFO; allows specific identification

Some brokers charge fees for specific identification or require you to identify lots through their interface rather than written statement. This is worth investigating before you need it—don't discover a limitation on the day you want to sell.

When using mutual funds, specific identification becomes more complex. You can identify specific purchase dates or share classes, but not individual shares (as with stocks). Average cost is often the default for mutual funds because of this technical limitation.

Once you elect a method for a particular lot, you are bound to it. You cannot "undo" a FIFO sale and restate it as specific identification on your tax return. And switching methods in future years requires IRS approval via Form 3115 (Application for Change in Accounting Method).

Real-World Example: The $10,000 Stock

Imagine you own Magnificent Tech Corp (MTC), a stock that's appreciated over a decade:

  • 2015: Buy 100 shares at $20 = $2,000 basis
  • 2017: Buy 50 shares at $30 = $1,500 basis
  • 2019: Buy 75 shares at $45 = $3,375 basis
  • 2023: Buy 100 shares at $80 = $8,000 basis
  • Total: 325 shares, $14,875 total basis, current price $100/share

In March 2025, you need to raise $15,000. You sell 150 shares at $100/share = $15,000 proceeds.

FIFO approach: You sell your oldest 100 shares (2015 at $20) plus 50 of the 2017 shares (at $30).

  • Gain on 2015 shares: (100 × $100) - (100 × $20) = $10,000 - $2,000 = $8,000
  • Gain on 2017 shares: (50 × $100) - (50 × $30) = $5,000 - $1,500 = $3,500
  • Total gain: $11,500
  • Tax at 15%: $1,725

Specific Identification approach: You specify selling the 100 most recent shares (2023 at $80) plus 50 shares from 2019 (at $45).

  • Gain on 2023 shares: (100 × $100) - (100 × $80) = $10,000 - $8,000 = $2,000
  • Gain on 2019 shares: (50 × $100) - (50 × $45) = $5,000 - $2,250 = $2,750
  • Total gain: $4,750
  • Tax at 15%: $712.50

Tax savings: $1,012.50 on a single transaction. This illustrates why specific identification is powerful. Over a lifetime of investing, choosing the right method on every sale could save tens of thousands of dollars.

Common Mistakes

Assuming your broker will handle cost basis optimization. Brokers provide information and calculation tools, but they don't strategize your tax position. You must actively elect a method that serves your tax goals.

Forgetting to get written confirmation from your broker. The IRS requires that your cost basis election be documented and received by your broker in writing before or at the time of sale. A verbal request or an email without confirmation is not sufficient in a tax audit.

Switching methods without IRS approval. If you use FIFO one year and specific identification the next on the same stock, you may trigger IRS scrutiny. If you want to change methods permanently, file Form 3115 and get approval first.

Using average cost for individual stocks when specific identification is available. Many investors select average cost for simplicity without realizing that their broker supports specific identification at no extra cost. Leaving money on the table for convenience is a costly mistake.

Mixing methods by mutual fund share class. If you own the same mutual fund through multiple accounts or purchase methods (taxable, IRA, employer 401k), confirm your cost basis method for each to avoid inadvertently using different methods for what you intended as a unified position.

Ignoring cost basis when inheriting securities. If you inherit stock, your cost basis is stepped up to fair market value at the owner's death. You receive a fresh start with zero built-in gain (for the inherited portion). Don't sell inherited stock using FIFO and pay tax on gains that already received step-up relief.

FAQ

Can I use a different cost basis method for different sales of the same stock? Once you've established a method for a particular stock in your account, consistency is expected. However, specific identification allows you to choose different lots on different dates. FIFO and average cost must be applied consistently to all sales until you formally change your method via Form 3115.

What happens if my broker goes out of business or loses my records? You remain responsible for your cost basis. Your trade confirmations, brokerage statements, and Form 1099-B reports are your documentation. Keep these records forever. If records are lost, you can reconstruct basis using historical price databases and your trading confirmations.

Can I use specific identification for mutual fund purchases made through a dividend reinvestment plan (DRIP)? Yes, but it requires tracking individual purchase dates and amounts. Many investors in DRIPs default to average cost because reinvested dividends complicate lot tracking. Some brokers offer "average cost single category" to simplify this.

If I use specific identification but my broker defaults to FIFO, which applies? Your broker's trade execution applies the method you specified. However, if you specified method A but your broker processed it as method B, you must amend your tax return to reflect what actually happened, not what you intended. This is why written confirmation is critical.

Can I use average cost for one mutual fund and specific identification for another? Yes. Each security can use a different method. However, once established for a particular security, consistency is required until you change the method formally.

Does the cost basis method change if I gift or donate securities? For charitable donations, you avoid capital gains tax entirely (you donate the appreciated securities, not the sale proceeds). For gifts to family, your cost basis transfers to the recipient; the method you used doesn't matter to the recipient's future tax, but it does matter to your current tax liability.

Summary

Choosing the right cost basis method is one of the most direct ways to reduce your capital gains tax. FIFO is the IRS default but often the worst choice for tax optimization. Specific identification gives you the most control and typically minimizes gains in rising markets. LIFO and average cost offer middle-ground options. The method you choose is binding once elected, and switching requires IRS approval. Most investors leave substantial tax savings on the table by defaulting to their broker's preference instead of proactively electing specific identification. Tax rules and limits evolve, so confirm current regulations with the IRS or a qualified tax professional before your next large sale.

Next

Adjusted Cost Basis