FIFO Calculator for Inventory

Work out FIFO cost of goods sold and ending inventory value from a beginning inventory layer and a purchase layer — the oldest costs are charged to COGS first, and the newest costs remain in stock.

Quick Facts

Method
FIFO — First-In, First-Out
The oldest inventory costs are recognized as COGS first; the most recently acquired costs remain in ending inventory.
Formula
COGS = sum of (units sold from a layer x that layer's unit cost)
Layers are consumed in the order acquired — beginning inventory before newer purchases.

Your Results

Calculated
Cost of Goods Sold
-
FIFO cost of the units sold
Ending Inventory Value
-
Cost of the unsold units remaining
Ending Inventory (units)
-
Units left after this sale
Average Cost per Unit Sold
-
COGS divided by units sold

Ready

Enter beginning inventory, the purchase batch, and units sold, then press Calculate.

How the FIFO Calculator for Inventory works

FIFO — First-In, First-Out — is one of the standard inventory costing methods under GAAP. It assumes that the first units placed into inventory are the first units sold, so the cost of goods sold (COGS) is built from the oldest cost layers, and whatever inventory remains at the end of the period is valued at the more recent purchase costs.

The formula

This calculator models two cost layers: a beginning inventory layer (quantity and unit cost already on hand) and a purchase layer (quantity and unit cost of stock bought during the period). Given units sold, it consumes the beginning layer first:

Units from beginning layer = min(units sold, beginning inventory units)
Units from purchase layer = min(units sold − units from beginning layer, units purchased)
COGS = (units from beginning layer x beginning cost) + (units from purchase layer x purchase cost)

Whatever units are not consumed stay in ending inventory, valued at the cost of the layer they came from: Ending inventory value = Total goods available for sale − COGS, where total goods available for sale is (beginning units x beginning cost) + (purchased units x purchase cost).

Worked example

Start with 100 units on hand at $10.00 each, then purchase 150 more units at $12.00 each — 250 units available for sale. If 180 units are sold, FIFO takes all 100 units from the beginning layer ($1,000) plus 80 units from the purchase layer ($960), for a COGS of $1,960. The 70 units left over all come from the purchase layer, so ending inventory is valued at 70 x $12.00 = $840. Average cost per unit sold works out to $1,960 / 180 ≈ $10.89.

Why layer order matters

Because unit costs usually change between purchases, which layer a sale draws from changes the reported COGS and ending inventory value even though the physical units sold and the total dollars spent on inventory are identical. When costs are rising, FIFO tends to report a lower COGS (using older, cheaper costs) and a higher ending inventory value than LIFO would for the same purchases — the opposite is true when costs are falling.

What the calculator assumes

  • Only two layers. Real inventory systems may track many purchase batches; this calculator simplifies to a beginning-inventory layer and one purchase layer, which is enough to show how FIFO sequencing works.
  • No returns, spoilage, or shrinkage. All units sold are assumed to be valid, fulfillable sales drawn only from the two layers entered.
  • Units sold cannot exceed units available. Beginning inventory plus purchases is the hard ceiling on what can be sold in the period.

Frequently Asked Questions

How does FIFO calculate cost of goods sold?
FIFO (First-In, First-Out) assumes the oldest inventory costs are the first ones charged to cost of goods sold. The calculator consumes units sold from the beginning inventory layer first at its unit cost, then from the purchase layer at its unit cost, until the units sold are fully accounted for. COGS is the sum of (units taken from each layer x that layer's unit cost).
How is ending inventory valued under FIFO?
Whatever units are left after removing the units sold stay valued at the cost of the layers they came from. Because FIFO removes the oldest costs first, the units remaining in ending inventory are usually the most recently purchased ones, valued at the newer purchase cost.
What happens if units sold exceeds the units available?
You cannot sell more units than you have on hand (beginning inventory plus purchases). If units sold exceeds total units available, the calculator flags the input as invalid so you can correct the quantities.
How is FIFO different from LIFO?
FIFO charges the oldest (first-acquired) costs to cost of goods sold and leaves the newest costs in ending inventory. LIFO (Last-In, First-Out) does the opposite: it charges the newest costs to cost of goods sold first and leaves the oldest costs in ending inventory. The two methods produce different COGS and ending inventory values whenever unit costs change between purchases, though total goods available for sale is the same either way.