Sub topic 5
FIFO: oldest costs go to COGS first
This chapter assumes you know the goods available for sale equation (beginning inventory plus purchases) and the difference between periodic and perpetual systems. It also assumes you can read an income statement.
The idea
First-in, first-out (FIFO) is a cost flow assumption. It treats the oldest purchase cost as the first cost sold. Cost of goods sold (COGS) takes costs from the oldest layer forward. Ending inventory keeps the costs of the most recent purchases.
FIFO is an assumption about costs, not about boxes on a shelf. A company may ship goods in any physical order and still use FIFO. Many companies pick it because it often matches how perishable or dated goods actually move.
Worked example
A business has three cost layers, listed oldest first:
| Layer | Units | Unit cost | Total |
|---|---|---|---|
| Beginning inventory | 100 | $10 | $1,000 |
| Purchase 1 | 200 | $12 | $2,400 |
| Purchase 2 | 100 | $14 | $1,400 |
Goods available for sale are 400 units costing $4,800. The business sells 250 units.
- Take all 100 units at $10. That is $1,000.
- Take the remaining 150 units from the $12 layer. That is $1,800.
- COGS is $1,000 + $1,800 = $2,800.
- Ending inventory is 50 units at $12 plus 100 units at $14. That is $600 + $1,400 = $2,000.
The check is COGS + ending inventory = $2,800 + $2,000 = $4,800, which equals goods available for sale.
If the selling price is $20 per unit, sales are $5,000 and gross profit is $5,000 − $2,800 = $2,200.
FIFO in code
This program applies FIFO perpetually. It records each purchase as a layer and removes cost from the oldest layer at each sale.
from collections import deque
layers = deque([[100, 10]]) # [units, unit_cost], oldest on the left
def sell(layers, qty):
cost = 0
while qty > 0:
if not layers:
raise ValueError("sold more units than available")
units, unit_cost = layers[0]
take = min(units, qty)
cost += take * unit_cost
qty -= take
if take == units:
layers.popleft()
else:
layers[0][0] -= take
return cost
cogs = 0
layers.append([200, 12]) # day 5 purchase
cogs += sell(layers, 150) # day 10 sale
layers.append([100, 14]) # day 15 purchase
cogs += sell(layers, 100) # day 20 sale
units_left = sum(u for u, _ in layers)
inventory_value = sum(u * c for u, c in layers)
print(cogs, units_left, inventory_value)
# 2800 150 2000The perpetual result matches the periodic result of $2,800. That is not a coincidence. Under FIFO, the oldest costs are always the first ones used, whether you compute COGS after each sale or once at period end. LIFO and weighted average do not have this property.
Effects to expect
- Rising prices: FIFO charges older, lower costs to COGS. COGS is lower and gross profit is higher than under LIFO or weighted average.
- Ending inventory: It carries the newest costs, so the balance sheet amount is close to current replacement cost.
- Falling prices: The effects reverse. COGS is higher and gross profit is lower than under the other methods.
Common errors
- Taking the oldest layer for ending inventory instead of for COGS. Ending inventory holds the newest layers.
- Forgetting to reduce a partly used layer. After selling 150 from a 200-unit layer, 50 units remain at that layer's cost.
- Calling FIFO a statement about physical movement. It only describes which costs are assigned.
- Using an average of layers in the middle of a FIFO calculation. FIFO keeps each layer's own unit cost.
Exercise
Using the same three layers (100 at $10, 200 at $12, 100 at $14), what are FIFO COGS and ending inventory if 300 units are sold?
Show answer
COGS is 100 × $10 + 200 × $12 = $1,000 + $2,400 = $3,400. The remaining 100 units come from the newest layer, so ending inventory is 100 × $14 = $1,400. The total is $4,800, which matches goods available for sale.