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 equals COGS plus ending inventory). It also assumes you can post basic debits and credits and tell a periodic system from a perpetual one. Here you apply first-in, first-out (FIFO) to the running example, check that it gives the same answer under both systems, and learn where it goes wrong in practice.
The FIFO assumption
FIFO assigns the cost of the oldest units on hand to cost of goods sold (COGS) first. Whatever is left in ending inventory carries the cost of the most recent purchases.
FIFO is a cost flow assumption, not a claim about the warehouse. A company can pick stock from any shelf and still use FIFO for its records. In practice FIFO often matches physical flow, since perishable and dated goods are usually sold oldest first. Matching physical flow is not required.
Think of the inventory as a queue of cost layers. Each purchase adds a layer at the back. Each sale removes units from the front.
Worked example: periodic FIFO
The running data are 100 units at $10 in beginning inventory, 200 units at $12 purchased on day 5, and 100 units at $14 purchased on day 15. The company sells 250 units. Goods available for sale are 400 units costing $4,800.
Under a periodic system you count inventory and compute COGS once, at period end. The FIFO steps are:
- COGS takes all 100 units of the $10 layer: 100 × $10 = $1,000.
- COGS takes 150 of the 200 units in the $12 layer: 150 × $12 = $1,800.
- COGS is $1,000 + $1,800 = $2,800.
- Ending inventory is the 50 left in the $12 layer plus the whole $14 layer: 50 × $12 + 100 × $14 = $600 + $1,400 = $2,000.
As a check, $2,800 + $2,000 = $4,800, which equals goods available for sale. If the two parts do not sum to the total, you have misapplied a layer.
You can also work from the ending side. Under FIFO, ending inventory is the newest units, so you count back from the latest purchase until you have the unit count on hand. That is 100 units at $14, then 50 units at $12.
If units sell for $20 each, revenue is 250 × $20 = $5,000. FIFO gross profit is $5,000 − $2,800 = $2,200.
Periodic entries
During the period, purchases go to a Purchases account, and Inventory stays at its beginning balance. At period end the adjusting entries move the balances:
| Account | Debit | Credit |
|---|---|---|
| Cost of goods sold | 2,800 | |
| Inventory (ending, from the count) | 2,000 | |
| Inventory (beginning balance) | 1,000 | |
| Purchases | 3,800 |
Purchases are $2,400 for the day 5 lot and $1,400 for the day 15 lot, which makes $3,800. The entry balances at $4,800 on each side.
FIFO under a perpetual system
A perpetual system updates inventory and COGS at every sale. With the same events, FIFO works as follows:
- Day 5. Buy 200 units at $12. Layers on hand are 100 at $10 and 200 at $12.
- Day 10. Sell 150 units. COGS takes 100 × $10 + 50 × $12 = $1,600. Remaining: 150 at $12 ($1,800).
- Day 15. Buy 100 units at $14. Layers on hand are 150 at $12 and 100 at $14.
- Day 20. Sell 100 units. COGS takes 100 × $12 = $1,200. Remaining: 50 at $12 and 100 at $14 ($2,000).
Total COGS is $1,600 + $1,200 = $2,800, and ending inventory is $2,000. These are the same figures as under the periodic system.
FIFO gives identical results in both systems. The oldest costs always leave first, so it does not matter whether you identify them sale by sale or all at once at period end. This is a key difference from LIFO and weighted average, which give different answers under perpetual and periodic (later chapters cover this). The same property is why FIFO is easy to audit.
The perpetual entry on day 10 is a debit to Cost of goods sold and a credit to Inventory, both for $1,600. The sale itself is recorded separately with a debit to Cash or Receivables and a credit to Sales.
FIFO in code
This script keeps a queue of layers and processes the perpetual events. It prints the result after each sale.
from collections import deque
class FifoInventory:
def __init__(self):
self.layers = deque() # each item: [units, unit_cost], oldest on the left
self.cogs = 0.0
def buy(self, units, unit_cost):
self.layers.append([units, unit_cost])
def sell(self, units):
on_hand = sum(u for u, _ in self.layers)
if units > on_hand:
raise ValueError("sold more units than available")
cost = 0.0
remaining = units
while remaining > 0:
layer = self.layers[0]
take = min(layer[0], remaining)
cost += take * layer[1]
layer[0] -= take
remaining -= take
if layer[0] == 0:
self.layers.popleft()
self.cogs += cost
return cost
def value(self):
return sum(u * c for u, c in self.layers)
inv = FifoInventory()
inv.buy(100, 10)
inv.buy(200, 12) # day 5
print("Day 10 COGS:", inv.sell(150)) # 1600.0
inv.buy(100, 14) # day 15
print("Day 20 COGS:", inv.sell(100)) # 1200.0
print("Total COGS:", inv.cogs) # 2800.0
print("Ending inventory:", inv.value()) # 2000.0The ValueError check matters. Selling more units than the layers hold usually means a missing receipt or a negative-inventory error. Many systems allow the sale anyway and fix the cost later, and you should know that is a data problem and not an accounting treatment.
Rising versus falling prices
FIFO's effect depends on the direction of prices. When prices rise, old, cheap costs go to COGS and the expensive recent costs stay in inventory. When prices fall, the reverse happens.
| Row | Prices rising | Prices falling |
|---|---|---|
| COGS | Lower (older, cheaper costs) | Higher (older, dearer costs) |
| Gross profit and net income | Higher | Lower |
| Ending inventory | Higher, close to current cost | Lower, close to current cost |
| Income taxes (if used for tax) | Higher | Lower |
To see the falling-price case, reverse the layers: 100 at $14, 200 at $12, 100 at $10, with 250 sold. FIFO COGS is 100 × $14 + 150 × $12 = $3,200. Ending inventory is 50 × $12 + 100 × $10 = $1,600. Compare that with the rising-price result of $2,800 COGS and $2,000 inventory.
In both cases the balance sheet figure is close to current replacement cost, because the most recent purchases remain in inventory. This is the main argument for FIFO on the balance sheet. The income statement is the weak side. In a rising market, FIFO matches old costs against current selling prices. Part of the reported gross profit is then an inventory holding gain, the difference between what the oldest units cost and what it now costs to replace them. A company with such a gain must still buy replacement stock at the higher price, so reported profit overstates the cash it can safely distribute.
Edge cases and common errors
- Taking the wrong layer. The most common mistake is using the newest cost for the first sale. Under FIFO the first sale of the period always starts from beginning inventory.
- Partial layers. A sale that ends in the middle of a layer leaves a reduced layer at the same unit cost. It is not re-priced. In the example, the $12 layer shrinks from 200 to 150 and then to 50 units, still at $12.
- Purchase returns and allowances. A return of goods to a supplier reduces the cost of the specific layer the goods came from, so record it against that layer's cost and not at the current average or latest price. Cost reductions that cannot be tied to a layer reduce the cost of goods available.
- Sales returns. Under a perpetual system, returned goods are normally put back at the cost they left at (the cost recorded for that sale), not the cost of the newest layer. Without that, the layers will drift from the original cost record.
- Freight-in and discounts. The cost of each layer includes freight-in and is net of purchase discounts. Using the invoice price alone misstates every unit in the layer.
- Mixing unit counts and dollars. In the periodic system, the ending count drives everything. An understated count increases COGS and understates profit. A count error in one period reverses in the next, because ending inventory becomes the next period's beginning inventory.
- Assuming FIFO equals physical flow. FIFO does not require that the oldest units leave first. Do not argue the method from the warehouse layout.
Where FIFO is allowed
Both US GAAP and IFRS permit FIFO. It is also the base case for lower of cost and net realizable value tests. A company must apply the chosen method consistently from period to period, and a change needs a justification and disclosure of its effects. Chapters on GAAP and IFRS and on LIFO cover how this differs from LIFO, which IFRS prohibits.
Exercise
A company starts with 50 units at $8. It buys 100 units at $9, then 50 units at $11. It sells 120 units. Using FIFO, find COGS and ending inventory. Do the results change between periodic and perpetual systems if all purchases occur before the sale?
Show answer
Goods available: 50 × $8 + 100 × $9 + 50 × $11 = $400 + $900 + $550 = $1,850 for 200 units. COGS takes 50 units at $8 ($400) and 70 units at $9 ($630), so COGS is $1,030. Ending inventory is 30 units at $9 ($270) plus 50 units at $11 ($550), which is $820. Check: $1,030 + $820 = $1,850. The results do not change between systems, because FIFO takes the same oldest layers either way. Under a perpetual system the single sale would be recorded at $1,030 on the sale date.
Exercise
Prices are falling. A company has 100 units at $14, then 100 units at $12, and sells 120 units. Compute FIFO COGS and explain why gross profit is lower than under a method that charges the newer cost first.
Show answer
FIFO COGS = 100 × $14 + 20 × $12 = $1,400 + $240 = $1,640. Ending inventory is 80 × $12 = $960. FIFO charges the older, higher costs to COGS first, so COGS is higher and gross profit is lower than under a method that charges the newer, cheaper $12 cost first. A method that charged $12 first would give COGS of 100 × $12 + 20 × $14 = $1,480.