↑↓ to move ↵ to open Esc to close Browse all tools

Money guide

Cost Basis: FIFO, Specific ID and Average Cost

When you sell part of a position bought at different prices, the gain depends on which shares count as sold. The IRS allows three answers: the oldest shares first, the shares you name, or for mutual funds an average cost. Here are the rules from Publication 550, one sale worked all three ways, and how the choice moves gains between short and long term.

What cost basis is

Basis is generally the amount you paid for an asset. For stocks and bonds the IRS counts the purchase price plus the costs of buying, such as commissions and transfer fees. If you buy 100 shares at $40 and pay a $50 commission, your basis is $40.50 a share, not $40. Basis also moves after the purchase: stock splits and nontaxable stock dividends spread it across more shares, and nondividend distributions reduce it.

Your gain or loss is the sale price minus the basis of the shares sold. With one purchase that is simple. With several purchases at different prices, the question is which shares left the account.

Gain or loss
gain = proceeds − basis of the shares sold

The three methods

  • Specific identification. You choose the shares. Publication 550 says you make an adequate identification if you tell your broker which shares to sell at the time of the sale and receive a written confirmation within a reasonable time. You keep the burden of proving the basis of those shares.
  • First in, first out (FIFO). If you cannot adequately identify the shares, the basis of the shares you sell is the basis of the shares you bought first. This is the default when you name nothing.
  • Average basis. Total basis of all identical shares in the account divided by the number of shares. It is allowed for mutual fund shares and for shares in a dividend reinvestment plan under the stated conditions, when the shares sit with a custodian. For ordinary stock outside those cases you cannot use the average price per share.

One sale, three answers

Take three purchases of the same stock and a sale of 150 shares at $80 in October 2026, for proceeds of $12,000. Commissions are left out to keep the numbers clean.

LotSharesPriceCost
Lot A, March 2023100$40$4,000
Lot B, June 2024100$55$5,500
Lot C, February 2026100$70$7,000
Total300$55.00 avg$16,500

The same sale gives three different gains:

MethodBasis soldGainShort-termLong-term
FIFO$6,750$5,250$0$5,250
Average basis$8,250$3,750$0$3,750
Specific ID, highest cost first$9,750$2,250$1,000$1,250

FIFO sells all of lot A and half of lot B, so the basis is $6,750 and the gain $5,250, all long-term. Average basis uses $55.00 a share for every share sold, so the basis is $8,250. Picking the most expensive shares first gives the lowest gain, $2,250, but $1,000 of it is short-term because lot C was held less than a year.

Average basis in this example only works if these were mutual fund shares or qualifying plan shares. For a regular stock, the realistic choice is FIFO or specific identification.

The holding period still counts

If you hold investment property more than 1 year, the gain or loss is long-term; 1 year or less makes it short-term. Counting starts the day after you bought it, and the day you sell counts. Long-term gains are usually taxed at lower federal rates, which you can compare in the capital gains tax calculator.

With average basis, every share sold carries the same basis, but the holding period is not averaged. Publication 550 says the shares disposed of are considered to be those acquired first, so one sale can still be part long-term and part short-term.

That is the real trade-off with specific identification. The highest-cost lot is often the newest one, so the smaller gain may be taxed at short-term rates. Sometimes an older, cheaper lot with a larger long-term gain costs less in tax.

When the price falls

Say the stock drops to $60 and you sell the same 150 shares. Under FIFO the result is a gain of $2,250, because the old lots still sit below $60. Naming lot C first gives −$1,000 short-term from lot C and $250 long-term from the half of lot B, a net of −$750. Identification can turn a taxable gain into a loss on the same trade.

Losses carry their own rule. If you buy substantially identical stock within 30 days before or after a sale at a loss, it is a wash sale and you cannot deduct the loss at that time. The guide to the wash sale rule covers the details, and capital loss deduction explains how much of a net loss you can use each year.

How each method is set up

MethodWho can use itHow you choose it
Specific IDStocks, bonds, fund sharesName the shares at the sale and get written confirmation
FIFOAnyoneDefault when shares are not identified
Average basisFund shares and qualifying plan shares with a custodianWritten notice to the custodian, or for noncovered shares on your return

For covered securities, generally those acquired after 2010, the average basis election is made by written notice to the custodian, and it can be sent electronically. It applies to sales after the notice. You can revoke it, generally by the earlier of 1 year after the election or the first sale after it. For mutual fund shares, you can use a cost method only if you did not previously use average basis for a sale of shares in the same fund.

For covered securities your broker reports basis on Form 1099-B. If the basis shown is wrong, the Form 8949 instructions explain the adjustment. For older, noncovered shares you need your own records of every purchase, which is why the IRS asks you to keep a record of each purchase until all shares from it are gone.

The method shifts timing, not the total

All 300 shares cost $16,500 together. Whatever basis this sale uses, the rest stays with the remaining shares. After the FIFO sale the 150 shares left carry $9,750; after the highest-cost sale they carry $6,750. Selling everything eventually reports the same total gain. What changes is the year it lands in and how much of it is short-term.

To see what a lot earned per year before you choose which to sell, put its cost, its value and the years held into the CAGR calculator.

This page explains federal rules in general terms. Your own situation, state tax and special assets such as inherited or gifted shares can change the answer.

Frequently asked questions

What cost basis method does the IRS use if I do nothing?

If you cannot adequately identify which shares you sold, the IRS treats the shares you bought first as the ones sold. That is first in, first out. For mutual fund shares you can also elect average basis, but FIFO is the fallback for stock when no specific shares were named.

How do I use specific identification?

Tell your broker which shares to sell at the time of the sale, and get a written confirmation from the broker within a reasonable time. Publication 550 sets out both steps. Most brokers let you pick lots in the order screen; naming them after the trade settles is too late.

Can I use average cost for individual stocks?

Only in limited cases. Publication 550 allows average basis for identical shares left with a custodian that are mutual fund shares or shares held in a dividend reinvestment plan under the stated conditions. For other stock you cannot use the average price per share and must identify the shares or use FIFO.

Can I switch away from average basis?

For covered securities you can revoke the election by written notice to the custodian, generally by the earlier of 1 year after you made it or the first sale after it. For mutual fund shares, cost basis is available only if you have not already used average basis for a sale of shares in the same fund.

Does the method change the total tax I pay?

It changes when the gain shows up and whether it is short or long term. The total cost of all your shares is fixed, so a lower basis on this sale leaves a higher basis on the shares you keep. Timing and the holding period split can still make a real difference to the tax in a given year.

Sources

General information based on the sources above, not tax, legal or financial advice.