Investing Guide

FIFO vs LIFO for Stocks: Which Shares Are You Selling?

FIFO sells your oldest shares first and LIFO your newest. See how each cost basis method changes the taxable gain, with IRS rules and a worked example.

Globull Research DeskFact-checked by the editors Published Last reviewed 6 min readEditorial policy
FIFO vs LIFO for Stocks: Which Shares Are You Selling?
Investing Guide

Key takeaway

If you bought the same stock at different times and prices, each purchase is a separate tax lot with its own cost basis and purchase date. When you sell only part of the position, something has to determine which lot is being sold, because that sets the size of the gain or loss and whether it is short-term or long-term. FIFO, first in, first out, treats the oldest shares as sold first. LIFO, last in, first out, treats the newest shares as sold first. The shares themselves are identical. The difference is purely in the tax accounting.

In this article
  1. The method decides which purchase you are treated as selling
  2. A worked example
  3. What the IRS actually requires
  4. When FIFO tends to help
  5. When LIFO or specific lots tend to help
  6. How to check and change the setting
  7. Limits to keep in mind
  8. Sources
  9. Frequently asked questions

The method decides which purchase you are treated as selling

If you bought the same stock at different times and prices, each purchase is a separate tax lot with its own cost basis and purchase date. When you sell only part of the position, something has to determine which lot is being sold, because that sets the size of the gain or loss and whether it is short-term or long-term. FIFO, first in, first out, treats the oldest shares as sold first. LIFO, last in, first out, treats the newest shares as sold first. The shares themselves are identical. The difference is purely in the tax accounting.

The choice can change a tax bill by a meaningful amount in a single year, yet many investors never look at the setting. Brokers apply a default, and for stocks that default is normally FIFO. IRS Publication 550 explains the rule behind it: if you cannot adequately identify the shares you sold, you are treated as having sold the earliest ones you acquired. Other outcomes are available only if you identify specific shares properly, which is what LIFO and similar broker settings do for you.

A worked example

Suppose you bought 100 shares of a company at $20 in January 2024 and another 100 shares at $50 in March 2026. In December 2026 you sell 100 shares at $45. Under FIFO, you sold the January 2024 lot. The gain is $25 per share, or $2,500, and because those shares were held for more than one year it is a long-term capital gain. Under LIFO, you sold the March 2026 lot. The result is a loss of $5 per share, or $500, and because those shares were held for one year or less it is a short-term capital loss.

Same sale, same cash received, opposite tax results for the year. Neither answer makes tax disappear. With FIFO you are left holding the $50 shares, which have little or no gain. With LIFO you are left holding the $20 shares, which carry a large unrealized gain that will be taxed whenever they are eventually sold. Lot selection mostly changes when tax is paid and at which rate. Our capital gains tax calculator can estimate the federal tax for each version.

What the IRS actually requires

The tax code does not offer stock investors a menu labeled FIFO and LIFO. It offers two things: specific identification, and FIFO as the fallback when specific identification is not made. Under specific identification you tell your broker which shares to sell at the time of the sale and receive written confirmation within a reasonable time. A broker's LIFO setting is a standing instruction that performs specific identification automatically by always choosing the most recently bought lot. The same is true of settings such as highest cost first or tax-efficient lot selection. IRS Publication 551 covers how basis is determined for each lot.

Timing matters. The identification must be in place by the time the sale settles. You cannot review the year in April and decide retroactively which lots you would rather have sold. An average basis method also exists, but for federal purposes it is available for mutual fund shares and for shares acquired through certain dividend reinvestment plans, not for ordinary individual stock purchases. If you use a dividend reinvestment plan, each reinvestment creates another small lot, which is one reason lot records grow quickly.

When FIFO tends to help

FIFO sells the shares you have owned longest, so it is the method most likely to produce long-term treatment. For most taxpayers long-term gains are taxed at lower federal rates than short-term gains, which are taxed as ordinary income. If your oldest shares are also your highest-cost shares, for example because the stock has fallen since you first bought, FIFO will also produce the smallest gain or largest loss. FIFO is simple, it is what the IRS assumes, and it needs no action. For an investor who buys and holds and sells rarely, the default is often perfectly reasonable.

When LIFO or specific lots tend to help

In a stock that has risen steadily, the newest lots have the highest basis. Selling them first produces a smaller gain today. The catch is the holding period. If those newest shares were bought within the past year, the smaller gain is short-term and taxed at ordinary rates, which can cost more than a larger long-term gain. In the example above the LIFO result was a loss, which is the favorable case. Had the sale price been $60, LIFO would have produced a $1,000 short-term gain while FIFO produced a $4,000 long-term gain, and which is cheaper would depend on your tax bracket.

This is why choosing lots one sale at a time is usually better than any blanket rule. You can pick the lot that gives the result you want for that year: a long-term gain in a low-income year, a loss to offset gains elsewhere, or the highest-basis long-term lot to minimize tax. Realizing losses deliberately is the idea behind tax-loss harvesting. Remember that the wash sale rule can defer a loss if you buy the same stock within 30 days before or after the sale, whichever lot method you use.

How to check and change the setting

Brokers call this the cost basis method or lot relief method. It is usually found in account settings or on the tax center page. Most firms let you set a default for the account and override it on individual orders by selecting lots on the trade ticket. Look for a link such as specify lots when entering a sell order. After the trade, the confirmation should show which lots were sold. If it does not match your instruction, contact the firm before settlement. FINRA's primer on cost basis explains what brokers track and why keeping your own records still matters.

At tax time your broker reports sales on Form 1099-B. For covered securities, which for stocks generally means shares acquired in 2011 or later, the form includes the basis and holding period that the broker reported to the IRS using the method in effect. For older noncovered shares, basis may be missing and you must supply it. Shares transferred between brokers, received as gifts or affected by corporate actions such as a spinoff deserve an extra check.

Limits to keep in mind

Lot methods matter only in taxable accounts. Inside an IRA or 401(k), sales are not taxed individually, so the setting is irrelevant. Net capital losses can offset capital gains and then up to $3,000 of other income per year, or $1,500 if married filing separately, with the excess carried forward, so a large harvested loss may take years to use fully. State taxes may treat gains differently from the federal system. And tax should not drive the investment decision. Selling a stock you want to keep, or keeping one you want to sell, to obtain a slightly better lot result is rarely worthwhile.

This article describes US federal income tax rules for individual investors holding US-listed stocks in USD. It simplifies rules that include many special cases, and it is not tax advice. Check the current IRS publications or ask a qualified tax professional before making a sale where the lot choice involves a significant amount.

Sources

Frequently asked questions

Editorial standards and sources

Globull articles are general education for US investors. Every decode is checked against public filings, company releases and exchange data, and every track record uses the price on the teaser date. Prices can be delayed and facts change, so verify important decisions with the original filing or a qualified professional.

Tags

Investing GuidefifolifostockswhichUS stocks

Share this article

Post on XLinkedIn

Written and reviewed by the Globull Research Desk

We decode newsletter teasers, check every clue against public filings and track picks over 30, 90 and 365 days. We are not paid by the publishers we cover.

Continue on Globull

Educational content for US investors, not investment advice. Prices may be delayed. Read our disclaimer.

Back to all articles