Understanding the FIFO inventory calculator — concept and principle
This calculator applies the first-in, first-out (FIFO) method to a list of inventory lots. It works out the cost of goods sold, the ending inventory, units left, the average cost per unit sold, the oldest unit cost still in stock and, with a selling price, gross profit and margin. Small retailers, bookkeepers and accounting students use it to value stock and check textbook exercises.
How it is calculated
- Enter the beginning stock and each purchase, oldest first: units, then cost per unit.
- Goods available = Σ units × cost; units available = Σ units
- COGS: take the units sold from the oldest lot first, then the next, each at its own cost, until all units sold are covered
- Ending inventory = cost of goods available − COGS (the most recent purchases)
- Gross profit = units sold × selling price − COGS; margin = gross profit ÷ sales × 100
The principle
FIFO assumes goods leave in the order they arrived, like most perishable stock. The oldest costs go to COGS and the newest stay in inventory. When prices are rising, FIFO therefore gives a lower COGS and higher profit than LIFO, and an ending inventory close to current replacement cost. With FIFO, the periodic method (one calculation at the end) and the perpetual method (after every sale) give the same result. IFRS (IAS 2) allows FIFO and weighted average cost but not LIFO.
Worked example
Defaults: lots 120 at 18.50, 200 at 19.75, 150 at 21.00, 180 at 22.40; 400 units sold at 32.
- Goods available = 2,220 + 3,950 + 3,150 + 4,032 = $13,352.00 for 650 units.
- COGS = 120 × 18.50 + 200 × 19.75 + 80 × 21.00 = 2,220 + 3,950 + 1,680 = $7,850.00.
- Ending inventory = 13,352 − 7,850 = $5,502.00, 250 units (70 at 21.00 and 180 at 22.40).
- Average cost per unit sold = 7,850 ÷ 400 = $19.63; oldest cost still in stock = $21.00.
- Gross profit = 400 × 32 − 7,850 = $4,950.00; margin = 4,950 ÷ 12,800 = 38.7%.
How to read the result
Compare the average cost per unit sold with the latest purchase price: here 19.63 against 22.40. That gap is the extra profit FIFO reports in a period of rising costs. If prices keep rising, the next period's COGS will be higher even if the selling price does not change, so price decisions should look at replacement cost, not FIFO cost.
Common mistakes
- Listing lots newest first.
- Including lots that arrived after the period end.
- Forgetting freight-in when working out the cost per unit.
- Switching methods between periods without disclosure.
Frequently asked questions
Does FIFO increase profit?
When costs are rising, yes: the older, cheaper costs go to COGS, so reported profit is higher than under LIFO or average cost.
Is FIFO allowed under IFRS?
Yes. IAS 2 allows FIFO and weighted average cost; LIFO is not permitted.
Do periodic and perpetual FIFO give different results?
No. With FIFO both give the same COGS and ending inventory.
Sources: OpenStax, Principles of Accounting, Volume 1: Financial Accounting, section 10.2 "Calculate the Cost of Goods Sold and Ending Inventory Using the Periodic Method" · IFRS Foundation, IAS 2 "Inventories"