Understand FIFO, LIFO, and specific identification cost basis methods. Learn which method minimizes taxes when selling stocks and how to track your cost basis. FIFO vs LIFO Guide 2025: Cost Basis Methods Explained
AIV Logo AIV Assistant

Loading...

FIFO vs LIFO: Cost Basis Guide

Learn how different cost basis methods affect your capital gains taxes and which method is best for your situation.

What is Cost Basis?

Cost basis is the original price you paid for an investment, including commissions. When you sell, your capital gain or loss equals the sale price minus your cost basis.

The challenge: if you bought the same stock multiple times at different prices, which shares are you selling? The answer determines your taxable gain, and different methods give different results.

Example

You bought 100 shares at $50 and later 100 shares at $70. Now you sell 100 shares at $80. If you sold the $50 shares (FIFO), your gain is $30/share. If you sold the $70 shares (LIFO), your gain is only $10/share. Same sale, very different tax.

Cost Basis Methods Explained

FIFO (First In, First Out)

Oldest shares are sold first. This is the default method if you don't specify.

  • Default for most brokers
  • Often results in larger gains (sold low, prices rose)
  • Usually means long-term capital gains (lower tax rate)
  • Simplest to track

LIFO (Last In, First Out)

Newest shares are sold first. Must elect this method with your broker.

  • Often results in smaller gains in rising markets
  • May trigger short-term gains (higher tax rate)
  • Useful when recent purchases were higher-priced
  • Less common, not allowed in all jurisdictions

Specific Identification

You choose exactly which shares to sell. Maximum flexibility.

  • Most tax-efficient—pick optimal lots
  • Requires telling broker which lots to sell
  • Best for tax-loss harvesting
  • More record-keeping required

Worked Example

Let's say you made these purchases of XYZ stock:

Your Purchase History

Date Shares Price Total Cost
Jan 2023 50 $40 $2,000
Jun 2023 50 $60 $3,000
Dec 2024 50 $80 $4,000

Now you sell 50 shares at $100/share ($5,000 total). Here's how different methods affect your gain:

Capital Gain by Method (Selling 50 shares @ $100)

FIFO
$3,000
Sold Jan shares @ $40
Long-term gain
LIFO
$1,000
Sold Dec shares @ $80
Short-term gain
Specific ID
$2,000
Choose Jun shares @ $60
Long-term gain
Tax Consideration

LIFO shows the lowest gain ($1,000), but it's short-term, taxed as ordinary income (up to 37%). The FIFO gain ($3,000) is long-term, taxed at 0-20%. Depending on your tax bracket, FIFO might result in lower actual taxes despite the higher gain!

Choosing the Right Method

When to Use FIFO

  • You want long-term capital gains treatment (lower tax rates)
  • You bought shares when prices were lower than today
  • You prefer simplicity and default settings

When to Use LIFO

  • Recent purchases were at higher prices
  • You want to minimize immediate gain recognition
  • You're in a high tax bracket and short-term rates don't hurt as much

When to Use Specific Identification

  • You want maximum control over tax outcomes
  • You're doing tax-loss harvesting
  • You have positions with mixed gains and losses
  • You're willing to do the extra record-keeping

Frequently Asked Questions

What is the default cost basis method?

FIFO (First In, First Out) is the default method for most brokers and is required by the IRS if you don't specify another method. Your oldest shares are considered sold first. You can change this in your broker settings or by specifying lots at time of sale.

Can I use different methods for different stocks?

Yes, you can use different methods for different securities. However, once you choose a method for a specific holding and sell shares, you generally cannot change the method for that particular sale. You can use specific identification on a sale-by-sale basis for maximum flexibility.

Is LIFO allowed for stocks?

In the US, LIFO is allowed for stocks and securities. However, it's not available in all countries—UK and many other jurisdictions don't allow LIFO for investments. Check your local tax rules. Even in the US, LIFO must be specifically elected; it's not the default.

How do I track cost basis for DRIP shares?

Each DRIP purchase creates a new tax lot with its own cost basis (the dividend amount) and acquisition date. This can create many small lots over time. Using portfolio tracking software like AllInvestView that automatically tracks DRIP purchases and calculates cost basis for each lot is highly recommended.

Track Cost Basis Automatically

AllInvestView tracks every tax lot, handles stock splits and DRIPs, and shows you the tax impact of different cost basis methods before you sell.

Start Tracking Free