FIFO vs Average Cost Calculator

Compare the cost basis a partial sale produces under first-in-first-out, weighted average and highest-cost-first.

Last reviewed

·

Free · No sign-up · Runs in your browser

Sell part of a holding accumulated across several purchases and the reported gain depends entirely on which units you are treated as having sold. The proceeds are fixed; the cost basis is not.

This calculates all three common answers on the same disposal - first-in-first-out, weighted average, and highest-cost-first - so the spread between them is visible. On a position built through a wide price range that spread can be large, which is exactly why the rules governing method choice exist.

Your numbers

Results update as you type. Nothing is sent anywhere.

One per line: quantity, price. Chronological order matters for FIFO.

Result

Spread between methods

$1,169

Proceeds
$12,680
Cost basis - FIFO
$8,610
Gain - FIFO
$4,070
Cost basis - weighted average
$8,716
Gain - weighted average
$3,964
Cost basis - highest cost first
$9,779
Gain - highest cost first
$2,901
Average price paid
43,582
Units remaining
0.3

This tool is for informational and educational purposes only. It is not financial or investment advice, and past performance does not guarantee future results.

This is record-keeping arithmetic, not tax advice. It calculates no tax, applies no rate and takes no view on which method you are permitted or required to use.

Jurisdictions differ. Some mandate first-in-first-out, some permit specific identification, some require a weighted average across a pooled holding, and rules for crypto often differ from rules for shares.

Methods are usually not interchangeable year to year, and choosing one can be binding. Take these figures to a qualified tax professional or your local tax authority guidance.

Lots consumed under FIFO

LotPurchase priceUnits usedCost basis
141,2000.15$6,180
248,6000.05$2,430

How to use the fifo vs average cost calculator

  1. Add one line per purchase in chronological order: quantity, then price.
  2. Enter the quantity sold and the price you sold at.
  3. Compare the three cost basis figures and the gains they produce.
  4. Confirm which method applies to you before relying on any of them.

What people use this for

  • Seeing how much the reported gain varies by method on a specific disposal.
  • Preparing a comparison for a tax professional.
  • Understanding why method choice is regulated rather than free.
  • Checking which lots a FIFO disposal actually consumes.

Worked examples

Every figure below is produced by running this calculator against the example inputs, so the numbers always match the tool.

A partial sale from a position built over time

Five purchases at a wide range of prices, selling 0.20 units at $63,400.

Gain - FIFO
$4,070
Gain - weighted average
$3,964
Gain - highest cost first
$2,901

A sale where the methods diverge sharply

Early purchases far below later ones.

Spread between methods
$1,745
Cost basis - FIFO
$630
Cost basis - highest cost first
$2,375

The three methods and what they do

First-in-first-out treats the oldest units as sold first, which on an appreciating asset produces the lowest cost basis and the largest reported gain. Weighted average pools everything into a single figure. Highest-cost-first, where specific identification is permitted, produces the smallest reported gain on the same sale.

Nothing about the economics changes between them. Only the reported figure does, along with the basis remaining in the units still held.

Method choice is not free

Jurisdictions differ substantially. Some mandate first-in-first-out. Some require a pooled average across a holding. Some permit specific identification only where the units can be identified with adequate records at the time of the sale.

Choices are also frequently binding once made, and switching between years may not be permitted. That is why this tool shows the comparison rather than recommending an approach.

The basis that remains matters too

A method that minimises the gain on this sale leaves a lower basis in the remaining units, which increases the gain on the next one. Deferral is not elimination.

That is the part most often missed when methods are compared on a single transaction, and it is the reason the decision belongs with a professional who can see the whole position.

Methodology and assumptions

What this calculator does, and what it deliberately does not do.

  • FIFO consumes the earliest purchases first, in the order you entered them.
  • Weighted average pools every purchase into a single per-unit basis and applies it to the quantity sold.
  • Highest-cost-first consumes the most expensive lots first, which is one form of specific identification.
  • No tax rate is applied and no jurisdiction is assumed. This is arithmetic, not tax advice.
  • Results are arithmetic on the numbers you enter. Nothing here predicts prices or connects to an exchange, broker or market data feed.
  • Nothing you type is transmitted or stored - the calculation runs entirely inside your browser.

This tool is for informational and educational purposes only and does not constitute financial or investment advice. Past performance does not guarantee future results.

Nothing on this website is a recommendation to buy, sell or hold any security, currency, derivative or digital asset. No price is predicted and no return is promised or implied.

Trading and investing carry the risk of substantial loss, including the loss of your entire capital. Leveraged products can produce losses that exceed your deposit. Tax treatment depends on your jurisdiction and your circumstances.

Frequently asked questions

Which method should I use?

Whichever your jurisdiction requires or permits, decided with a qualified professional. This tool shows what each produces; it does not recommend one.

Does the order of my purchases matter?

For FIFO, entirely - enter them chronologically. For the weighted average, not at all.

Is highest-cost-first allowed?

It depends on whether your jurisdiction permits specific identification and on whether you have adequate records. In many places it is not available.

Is this tax advice?

No. It calculates cost basis under three methods, for informational purposes. Take the figures to a tax professional or your local tax authority guidance.