Pomegra Wiki

FIFO vs LIFO Cost Basis in Investing

When you sell shares of stock or a mutual fund, your cost basis—the price you originally paid—determines your taxable capital gain. If you bought multiple lots at different prices, you must choose which lot you are selling. FIFO (first-in, first-out) sells your oldest shares first. LIFO (last-in, first-out) sells the most recent ones. Each method produces different tax outcomes; choosing strategically can reduce your long-term capital gains tax or defer it to a favorable year.

The Mechanics: Multiple Purchases, One Sale

Imagine you bought Apple shares over several years:

  • January 2019: 100 shares @ $150 = $15,000 cost
  • June 2021: 100 shares @ $130 = $13,000 cost
  • March 2023: 100 shares @ $180 = $18,000 cost
  • Total cost basis: $46,000 for 300 shares

In March 2024, Apple trades at $200. You decide to sell 100 shares and raise $20,000. Your taxable gain depends on which lot you sell.

FIFO: Sell the 2019 shares (cost $150 per share)

  • Sale proceeds: $20,000 ($200 × 100)
  • Cost basis: $15,000
  • Taxable gain: $5,000

LIFO: Sell the 2023 shares (cost $180 per share)

  • Sale proceeds: $20,000 ($200 × 100)
  • Cost basis: $18,000
  • Taxable gain: $2,000

If your long-term capital gains tax rate is 15 percent, FIFO costs you $750 in tax; LIFO costs you $300. The difference is $450 in a single year—and this gap widens with larger positions and longer holding periods.

FIFO: The Default Method

FIFO (first-in, first-out) is the default method used by nearly all stock brokers and mutual fund companies if you do not specify otherwise. It reflects a simple logic: you sell the oldest shares first, as if your portfolio operates like a queue.

When FIFO favors you:

  • Shares you bought earliest have the lowest cost basis (especially if you bought decades ago or before a major bull run)
  • Your current gain is modest
  • You expect significant price declines next year and want to harvest losses

When FIFO works against you:

  • You bought early in a bull market at low prices; selling those shares triggers large gains
  • More recent purchases were at higher prices; selling them would trigger smaller gains
  • You are in a high tax bracket and want to defer gains

Example: You bought Tesla in 2013 at $30 and again in 2022 at $250. Under FIFO, selling 100 shares in 2024 (when Tesla is at $300) means selling the 2013 shares: $27,000 gain on a $3,000 original investment. Switching to a different method could save thousands in taxes.

LIFO: Strategic Deferral

LIFO (last-in, first-out) sells the most recent purchases first. In rising markets, recent purchases usually have higher cost bases, so selling them produces smaller gains.

When LIFO favors you:

  • You bought recently at higher prices
  • You bought long ago at very low prices
  • You want to minimize this year’s taxable gain

When LIFO works against you:

  • Your oldest shares have the lowest gains (or are losses)
  • You want to realize losses to offset other gains
  • You plan to hold the security longer and want to defer gains to a future year when you might be in a lower tax bracket

LIFO election complexity: The IRS allows LIFO for tax-loss harvesting and strategic gain management, but few brokers offer it as a default option. You must affirmatively elect LIFO on your Schedule D (the IRS form reporting capital gains). Once you elect LIFO for a particular security, you must use it consistently for future sales of that security unless you get IRS permission to change.

Identified Lot (Specific ID): Maximum Control

The most tax-efficient method is “specific identification” or “identified lot.” Instead of using a formula (FIFO or LIFO), you tell your broker exactly which shares to sell. This requires documenting the specific lot at the time of sale.

Example: You have three positions in the same stock acquired at different times and prices. When you sell, you tell your broker: “Sell the 50 shares I bought on June 15, 2021 at $130.” Your broker confirms in writing, and that is your cost basis for that sale.

Advantages:

  • Complete control over which gains to realize and which to defer
  • Allows you to cherry-pick the lot with the lowest gain (or highest loss)
  • Enables sophisticated multi-year tax planning

Disadvantages:

  • Requires meticulous record-keeping
  • Broker must confirm lot ID at time of sale; missing documentation can result in reversion to FIFO
  • More paperwork for the IRS (Schedule D) and your accountant

The Wash Sale Rule: A Critical Constraint

Choosing between FIFO, LIFO, and specific ID becomes complicated when losses are involved. The wash-sale rule states: if you sell a security at a loss, you cannot buy the same security (or a substantially identical one) within 30 days before or after the sale. If you do, the loss is disallowed, and the cost basis is added to the cost of the new purchase.

Example: You sell 100 Apple shares at a $3,000 loss on December 10. On December 20, you buy 100 Apple shares again. The wash-sale rule disallows the December 10 loss, and your cost basis for the new shares is adjusted upward by $3,000. This rule applies regardless of your cost-basis method.

This is why tax-loss harvesting requires discipline: realize the loss, avoid buying the same security or a “substantially identical” fund (e.g., buying Apple when you sold it, or buying an Apple-heavy ETF) for at least 30 days.

Mutual Funds and ETFs: Special Considerations

For mutual funds, your cost basis is usually calculated based on shares purchased, not dollars invested. If you reinvest dividends, you automatically purchase additional shares at the distribution date’s price. This complicates cost-basis tracking.

For ETFs, cost basis is per share, similar to stocks. However, some ETFs are so new or so thinly traded that identifying the exact lot you are selling may be difficult.

Most custodians now offer cost-basis tracking software that automatically calculates FIFO, LIFO, or identified-lot basis for you. Use it—it saves audit risk.

Tax-Planning Scenarios

Scenario 1: Bull market, diversification goal You have a concentrated position in one stock (say, 50,000 shares at an average cost of $50, now trading at $150). You want to reduce it to 25,000 shares for diversification. Using FIFO will trigger enormous gains. Using identified lot, you sell the highest-cost lots (those nearest to $150) to minimize gain. You might realize a $1.5 million gain instead of $2.5 million.

Scenario 2: Multi-year loss carryover You have $10,000 in capital losses carried forward from last year. This year, you have $15,000 in gains. Using LIFO or identified lot, you engineer sales to realize exactly $10,000 in gains this year, deferring $5,000 to next year when you might be in a lower tax bracket.

Scenario 3: Inheritance and step-up basis You inherited a share with a very low cost basis (i.e., the decedent bought it at $10, and it was worth $100 at death). When you inherited it, your cost basis was “stepped up” to $100. If you sell immediately at $105, your gain is only $5, not $95. This is the benefit of inherited securities, and it does not depend on your cost-basis method—it is automatic.

How to Elect and Document

To use LIFO or identified lot:

  1. Contact your broker and ask whether they support LIFO or identified-lot cost basis for your account. Most do, but it may be a checkbox in account settings or a written request.

  2. For LIFO: Elect it in writing, and ensure it is documented. The election typically applies to all future sales of a given security unless you change it.

  3. For identified lot: At the time of sale, specify which lot(s) to sell. Your broker should confirm in writing (on the trade confirmation or a separate document).

  4. Document with your accountant: When filing Schedule D, your reported cost basis must match your broker’s records and your own documentation.

  5. Keep records for at least 7 years: The IRS can audit back-dated transactions, so retain confirmations, statements, and cost-basis worksheets.

See also

Wider context

  • Dividend — Income that compounds cost basis if reinvested
  • FIFO — Inventory accounting method (broader application beyond securities)
  • LIFO — Last-in first-out (broader application beyond securities)
  • Tax bracket — Marginal rate determining tax on gains