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.