← Back to blog

Cost Basis Methods for Stocks: FIFO, Average Cost and More

November 13, 2026
Cost Basis Methods for Stocks: FIFO, Average Cost and More

For stocks, your cost basis method is the rule that decides which shares count as sold, and therefore how big your taxable gain or loss is. If you do nothing, your broker applies a default, which is normally first-in, first-out (FIFO). If you tell the broker which lots to sell before the trade settles, you can usually shape the result. Average cost is allowed only for certain mutual fund shares and dividend reinvestment plans. At Oracle Investments we score over 260 stocks on fundamentals, and we see the sell decision as two questions: whether to sell, and which shares to sell. This guide covers the second one.

Oracleinvestments
Put Your Portfolio in Context
Oracle Investments scores over 260 stocks on financial fundamentals and offers real-time portfolio tracking and instant comparisons.
Visit

TL;DR

  • Cost basis is generally what you paid for the shares plus purchase costs such as commissions and fees. Your method decides which purchase price is matched to a sale.
  • FIFO is the fallback: with no adequate identification, the oldest shares are treated as sold first. Specific identification lets you pick lots, but only if you identify them in time.
  • Average cost is not available for ordinary stock sales, only for certain mutual fund shares and certain dividend reinvestment plans.
  • Decide before you place the sell order and keep lot-level records. Your broker reports basis on Form 1099-B for covered shares.

Table of Contents

What cost basis is and how you calculate it

The IRS says the basis of stock you own is generally the purchase price plus the costs of purchase, such as commissions and recording or transfer fees. FINRA adds that for stocks and bonds the figure also includes reinvested dividends or reinvested capital gains distributions, and that your brokerage usually sends the details on a confirmation statement after you buy.

The arithmetic for one purchase is simple:

  1. Multiply the price per share by the number of shares.
  2. Add commissions and fees.
  3. Divide by the number of shares if you want the basis per share.

Your gain or loss is the sale proceeds minus the basis of the shares sold. The complication starts when you buy the same stock several times at different prices. Each purchase is a separate tax lot with its own date and price, and the method you use decides which lot is matched to the sale.

When you did not buy the shares

Not every position starts with a purchase. IRS Publication 551 explains that if you get stock other than by purchase, your basis is usually set by fair market value or by the previous owner's adjusted basis. The SEC notes that for inherited securities, the basis is the value at the date of the owner's death. Investopedia describes the gift rule: you generally take the original holder's basis, with a lower figure used in some cases when the shares are trading below that price at the time of the gift.

Splits and reinvested dividends

A stock split changes your basis per share, not your total basis. In a 2-for-1 split, you divide the old per-share basis by two, or divide your original investment by the new share count, as Investopedia explains. Reinvested dividends create new small lots each time they buy shares, which is why a long-held dividend stock can have dozens of lots. If you use a company plan, our guide to dividend reinvestment plans and their tax rules covers how those lots form.

The main cost basis methods for stocks

There are four names you will see on brokerage screens. They are not equally available for stocks.

MethodWhich shares are treated as soldAvailable for stocks?
FIFO (first in, first out)Oldest shares firstYes, the default when you give no instruction
LIFO (last in, first out)Newest shares firstYes, if you tell your broker to use it
Specific identification (including HIFO)The exact lots you nameYes, if identified in time
Average costEvery share carries the same average basisOnly certain mutual fund shares and certain dividend reinvestment plans

FIFO: the default

The IRS states that if you cannot adequately identify the shares you sold and you bought them at different times and prices, the sold shares' basis is that of the shares you acquired first, then the next acquired, and so on. H&R Block confirms FIFO is the default in a brokerage account when you did not choose another method.

FIFO is easy and needs no action. The cost is that your oldest shares often have the lowest basis, so selling them first can produce the largest gain, a point H&R Block also raises. On the other hand, those oldest shares are the most likely to be long-term holdings.

LIFO: newest shares first

LIFO treats your most recent purchases as sold first. The same H&R Block page says you must tell your broker to use it. If your newest shares have been held for a year or less, selling them first can mean short-term treatment, which Investopedia notes is often taxed at a higher rate than gains on assets held longer. So LIFO can lower a gain when recent purchases cost more, yet raise the tax rate on what remains.

One point of confusion: LIFO is allowed under U.S. accounting rules (GAAP) but not under IFRS. That concerns company inventory accounting. For your personal brokerage account, it simply means LIFO is something you ask your broker to apply.

Specific identification and HIFO

Specific identification means you choose which lots to sell. HIFO (highest in, first out) is a common version: the broker sells the lots with the highest basis first, which usually produces the smallest gain or the largest loss on that sale. Other versions target the lowest basis, or long-term lots only.

Three approaches to selecting stock lots

It is the most flexible approach. You can sell high-basis lots to reduce a gain, or low-basis lots to realize a gain in a year when your tax bracket is low. The cost is paperwork. Investopedia says specific identification requires meticulous record-keeping.

The timing rule matters most. Under 26 CFR 1.1012-1, an adequate identification is made at the time of sale if it happens no later than the earlier of the settlement date or the time for settlement under SEC Rule 15c6-1. A standing order or instruction for specific identification is treated as an adequate identification at the time of sale. That is why most investors set a standing instruction with the broker rather than rely on remembering each time.

Average cost: mostly not for stocks

Average cost divides your total cost by total shares, so every share carries the same basis. It is popular for mutual funds because it is simple. For individual stocks, the IRS is clear: except for certain mutual fund shares and certain dividend reinvestment plans, you cannot use the average basis per share to figure gain or loss on a stock sale.

So the question "average cost or FIFO?" has a practical answer. If you hold individual stocks, your real choices are FIFO, LIFO and specific identification. If you hold a mutual fund, your broker or fund company may offer average cost as an option for eligible shares.

A worked example: same sale, three results

This is an illustration with made-up numbers, not a prediction. Suppose you buy 10 shares of a stock at $10, another 10 at $20, and another 10 at $30. Later you sell 10 shares at $40, with no commissions to keep it clean.

MethodBasis matched to the saleTaxable gain
FIFO$10 lot ($100)$300
LIFO$30 lot ($300)$100
Specific ID or HIFO (the $30 lot)$300$100
Specific ID (the $20 lot)$200$200
Average cost (if eligible, $20 average)$200$200

The same trade produces a $100 gain or a $300 gain depending only on which shares are matched to it. In a market that has risen for years, that gap is typical, because older lots have lower basis. Whether the lower gain is better for you depends on the holding periods involved. If the $30 lot was bought four months ago, its gain is short-term, while the $10 lot may be long-term. A smaller gain taxed at a higher rate can be worse than a larger gain taxed at a lower one, so check each lot's purchase date before you choose.

If you are selling at a loss, the same logic applies in reverse, and you will want to avoid disallowed losses. Our guides to tax loss harvesting and the wash sale rule explain the 30-day window that can erase a harvested loss when you rebuy the same stock.

A worked example: same sale, three results

How to choose a method

There is no single best method. A workable way to decide is to ask four questions in order.

  1. Are the shares in a taxable account? In an IRA or 401(k), sales do not create taxable gains in the same way, so the method rarely matters. This guide concerns taxable brokerage accounts.
  2. Do you have more than one lot? With a single purchase, every method gives the same answer.
  3. What is each lot's holding period? Lots held more than a year and lots held a year or less are treated differently. Sorting your lots by date and basis shows your options at a glance.
  4. Do you want to realize a gain or a loss? To trim a gain, favor higher-basis lots. To realize gains in a low-income year, favor lower-basis lots.

Then put the choice in writing. A standing instruction with your broker covers future sales, and you can still name specific lots on a trade if you need to. The IRS rule treats a standing instruction as adequate identification, and confirming it with your broker removes doubt about which method was applied.

A note on switching: per the same regulation, a method of determining stock basis, including identification and the average basis method, is not a method of accounting. A change in method therefore does not need the formal accounting-method change procedure. It does not let you rewrite a trade after it settles, though. The identification has to be made in time.

For tax decisions with real money at stake, such as a large concentrated position, a business owner's equity or an inherited estate, talk to a CPA or enrolled agent before the sale.

Records and reporting: covered and noncovered shares

Your broker reports much of this for you, but only for some shares. The IRS says stock acquired after 2010 (and mutual fund shares or shares bought through a dividend reinvestment plan acquired after 2011) is a covered security, and the broker must provide basis information on Form 1099-B. For each covered sale, the broker reports:

  • the date of acquisition (box 1b)
  • whether the gain or loss is short-term or long-term (box 2)
  • cost or other basis (box 1e)
  • any loss disallowed because of a wash sale (box 1g), or accrued market discount (box 1f)

Shares bought earlier, or transferred in from elsewhere without basis information, may be noncovered, and then the burden of proving basis falls on you. Keep trade confirmations, year-end statements and a simple spreadsheet or portfolio record listing each lot: date, shares, price, fees.

High trading volume multiplies the number of lots quickly. If you run automated strategies, the same lot logic applies, and a guide to tax reporting for trading bots shows why acquisition dates, basis and holding periods need to be tracked on every fill.

Where the cost basis method fits in your selling decision

Choosing a method answers "which shares?" It does not answer "should I sell at all?" Selling a stock just because its lots have a convenient basis is how investors end up with a tidy tax bill on a position they should have kept. Start with the business: is it still profitable, reasonably valued and financially healthy? Our practical guide on when to sell stocks walks through that decision, and our piece on portfolio turnover shows how frequent trading adds costs that never appear on a quote screen.

If you are still deciding which stock deserves the money in the first place, the stock comparison checklist gives you a repeatable way to compare companies before you buy.

Our perspective

Most investors we hear from treat the sell button as the end of the process. We think it is the middle. A sale has a business reason and a tax consequence, and both deserve a rule written down before the emotion arrives.

That is how we built Oracle Investments. Our ratings are rule-based and grounded in reported company fundamentals, and we show the inputs, so you can see why a company scores the way it does. We chose that over opaque, model-driven guesses because a decision you can explain is a decision you can stick with.

The same discipline applies to cost basis. Pick your method before the order, keep your lot records clean, and judge the company by its profitability, valuation and financial health rather than by the last price you saw. Buffett, Munger and Lynch are all quoted for patience and a clear process, and we have built their thinking into the app so that you meet it while you analyze, not after.

Matt

Put a process around your portfolio

Cost basis only helps when you know what you own and why you own it. Oracle Investments scores over 260 stocks on profitability, valuation and financial health, lets you compare companies side by side, and offers real-time portfolio tracking, with no spreadsheet setup. The Premium Annual plan is purchased through the Apple App Store.

Oracleinvestments

See how the scores work and start with Oracle Investments Premium Annual.

FAQ

Is FIFO or average cost better?

For individual stocks the choice usually does not exist, because average cost is limited to certain mutual fund shares and certain dividend reinvestment plans under IRS guidance. For mutual funds, average cost is simpler to track, while FIFO sells your oldest shares first and often yields a larger gain in a rising market. Compare the two on your own lots before you sell.

Can I use LIFO for stocks?

Yes, but you must tell your broker to use it, because FIFO is the default. LIFO sells your newest shares first, so check their holding period. Shares held a year or less can produce short-term gains.

Can I change my cost basis method after I sell?

Generally the identification has to be made by the earlier of the settlement date or the time for settlement under Treasury regulations. A standing instruction in place before the sale counts. Once the trade has settled, you should not expect to switch methods for it.

What does HIFO mean?

HIFO stands for highest in, first out. It is a form of specific identification in which the lots with the highest cost basis are sold first, which tends to minimize the gain on that sale. It works only if your broker supports it and you set it up before the sale.

How do I find my cost basis if my broker did not report it?

Start with trade confirmations and account statements, which FINRA says usually show your purchase details. For gifts, inheritances or splits, use the rules in IRS Publication 551. For complicated situations, a CPA or enrolled agent can help you reconstruct it.

Sources