Skip to content
Business

FIFO Inventory Calculator

Calculate Cost of Goods Sold (COGS) and ending inventory value using the First-In First-Out (FIFO) inventory accounting method.

Units sold

Batch 1 (oldest inventory)

$

Batch 2

$

Batch 3 (newest inventory)

$

Cost of Goods Sold (COGS)

$290.00

130 units at avg $2.23/unit

Ending inventory value

$350.00

100 units remaining

Total goods available

$640.00

230 total units

Cost allocation

  • COGS$290.0045.3%
  • Ending inventory$350.0054.7%

How FIFO COGS is calculated

Three steps from your inventory batches and units sold to COGS and ending inventory value.

  1. Total goods available for sale

    Total Cost=i=1n(Qtyi×Costi)\mathrm{Total\ Cost} = \sum_{i=1}^{n}(\mathrm{Qty}_i \times \mathrm{Cost}_i)

    Add cost across all batches: $640.00 across 230 units.

  2. Consume oldest batches first (FIFO)

    Sell 130 units starting from Batch 1 (oldest). COGS draws on each batch in order until fulfilled.

  3. Ending inventory = total cost − COGS

    Ending Inventory=Total CostCOGS\mathrm{Ending\ Inventory} = \mathrm{Total\ Cost} - \mathrm{COGS}

    $640.00 − $290.00 = $350.00 remaining in stock.

Report tool

What is FIFO inventory accounting?

First-In, First-Out (FIFO) is an inventory cost-flow assumption that assigns the cost of the oldest purchased units to Cost of Goods Sold (COGS) first, while the most recently acquired units remain in ending inventory. It is one of the two most widely accepted methods under both U.S. GAAP and IFRS (the other being weighted-average cost; LIFO is permitted only under U.S. GAAP).

Enter your inventory batches (oldest to newest) and the number of units sold. The calculator consumes each batch in order, computes COGS from the cheapest historical costs, and values ending inventory at the most recent prices. All math runs in your browser. To find the dollar value of stock on hand at period end without specifying individual batches, use the ending inventory calculator. For efficiency metrics such as inventory turnover and days sales of inventory, check the days inventory outstanding calculator.

FIFO formulas

FIFO does not use a single equation; it works by tracking unit layers. The governing identity is:

COGS=i=1k(Qty consumedi×Costi)\mathrm{COGS} = \sum_{i=1}^{k}(\mathrm{Qty\ consumed}_i \times \mathrm{Cost}_i)

Where batches are ordered from oldest (i = 1) to newest, and k is the last batch touched to fulfill units sold. Then:

Ending Inventory=Total Cost AvailableCOGS\mathrm{Ending\ Inventory} = \mathrm{Total\ Cost\ Available} - \mathrm{COGS}

Total cost available is the sum of beginning inventory cost plus all purchase costs for the period:

Total Cost=i=1n(Qtyi×UnitCosti)\mathrm{Total\ Cost} = \sum_{i=1}^{n}(\mathrm{Qty}_i \times \mathrm{UnitCost}_i)

Worked example

A retailer carries two inventory batches and sells 120 units:

BatchUnitsUnit costUnits sold (FIFO)COGS contribution
Batch 1 (oldest)100$2.00100$200.00
Batch 2 (newest)50$3.0020$60.00
Total150120$260.00 COGS

Ending inventory: 30 units remaining from Batch 2 at $3.00 each = $90.00. Total cost available was $350.00, and $350.00 − $260.00 = $90.00 confirms the result.

FIFO vs. other inventory methods

The method chosen affects reported gross profit, taxable income, and balance-sheet inventory value, particularly when purchase prices change over time.

MethodCOGS in rising-price marketEnding inventory in rising-price market
FIFOLower (oldest, cheaper costs)Higher (recent prices)
LIFO (U.S. GAAP only)Higher (newest, pricier costs)Lower (older prices)
Weighted averageBetween FIFO and LIFOBetween FIFO and LIFO

Because FIFO reports higher gross profit during inflationary periods, it also produces a higher tax liability for many businesses. LIFO is banned under IFRS. Weighted-average cost smooths price fluctuations and is common in industries with interchangeable commodity stock.

When to use FIFO

  • Perishable goods — food, pharmaceuticals, and cosmetics naturally sell oldest stock first; FIFO mirrors physical flow.
  • IFRS-reporting businesses — LIFO is not permitted, making FIFO or weighted-average the only options.
  • Rising-price environments — FIFO maximises reported gross profit and balance-sheet inventory value, which can improve loan covenants and creditworthiness.
  • Investor-facing reporting — ending inventory at current market prices is easier for analysts to interpret.

Frequently asked questions

Does FIFO always minimize COGS?
Only when prices are rising. If purchase costs are falling, FIFO assigns higher historical costs to COGS, producing lower gross profit than LIFO or weighted-average cost.
Can I use more than three inventory batches?
This calculator supports up to three purchase batches, which covers most common FIFO problems. For more batches, apply the same FIFO logic: consume the oldest batch fully before moving to the next, accumulating unit cost at each step.
Why does this tool cap units sold at total available?
You cannot sell more units than you have in stock. If the number sold exceeds total available, the calculator alerts you and caps COGS at the full inventory cost, keeping ending inventory at zero.
Is FIFO the same as the periodic and perpetual inventory systems?
FIFO is a cost-flow assumption, not an inventory system. Under a periodic system you calculate COGS at period end using a physical count; under a perpetual system you update COGS after each sale. Both can use FIFO to assign which layer costs flow into COGS.
Does FIFO affect taxes?
Yes. In an inflationary environment FIFO reports lower COGS and higher taxable income than LIFO. Businesses choosing between methods should consult a tax professional, as the choice must be applied consistently and disclosed in financial statements.
How is ending inventory valued under FIFO?
Ending inventory under FIFO is valued at the cost of the most recently purchased units because the oldest units have already been assigned to COGS. This means balance-sheet inventory is closer to current replacement cost during inflationary periods.
Which currency does this calculator use?
All amounts are displayed in US dollars (USD). The FIFO calculation logic itself is currency-agnostic; enter costs in any consistent currency.

Resources and references

The formulas and methods in this calculator were checked against these independent sources.