What this calculator does
FIFO stands for first-in-first-out, the most common method for costing inventory when unit costs change from one purchase to the next. It assumes that the oldest stock on hand is the first stock sold, so cost of goods sold is built from the earliest, and usually cheapest, batches first.
This matters because a business rarely buys the same item at the same price twice. Enter each purchase batch in the order it arrived, along with the quantity sold, and this FIFO calculator works through the batches oldest first, pulling out exactly how many units and how much cost came from each one.
The formula
Starting from the oldest batch, take units from it up to its full quantity, then move to the next batch, and so on, until the total quantity sold has been accounted for. Cost of goods sold is the sum of (units taken from each batch × that batch's unit cost). Whatever is left over in the newest batches, valued at their own unit costs, is the remaining inventory value.
| Term | Meaning |
|---|---|
| FIFO | First-in-first-out: the assumption that the oldest inventory on hand is sold before newer inventory. |
| COGS | Cost of goods sold: the total cost of the units sold, built from the batches consumed to fill that quantity. |
| Batch | A single purchase of inventory at one unit cost, entered in the order it was bought. |
The inputs explained
| Field | What to enter |
|---|---|
| Batch quantities, oldest first (comma separated) | The quantity in each purchase batch, oldest batch first, separated by commas. |
| Batch unit costs, same order (comma separated) | The unit cost of each batch, in the same order as the quantities above. |
| Quantity sold | The total quantity sold or shipped out, to be costed under FIFO. |
When to use it
Closing the books at month end
When unit costs have moved during the month, FIFO gives a defensible, consistent way to split what was sold from what remains, rather than guessing at an average.
Comparing FIFO against a blended average cost
FIFO tends to report a lower COGS than average costing when prices are rising, because it draws from the cheaper, older batches first; running the same batches through both methods shows the size of that gap.
Checking a bookkeeper's inventory entry
Re-entering the same batches and sale quantity independently confirms whether a reported COGS or ending inventory figure was actually built the way FIFO requires.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How COGS changes as more units are sold from the same batches
The same three batches, sold off in increasing quantities.
| Quantity sold | Cost of goods sold (FIFO) | Remaining inventory value | Average cost per unit sold |
|---|---|---|---|
| 50 | $200.00 | $1,875.00 | $4.00 |
| 100 | $400.00 | $1,675.00 | $4.00 |
| 150 | $625.00 | $1,450.00 | $4.17 |
| 220 | $940.00 | $1,135.00 | $4.27 |
| 300 | $1,325.00 | $750.00 | $4.42 |
| 400 | $1,825.00 | $250.00 | $4.56 |
Questions
How is FIFO different from average costing?
Average costing blends every batch into a single weighted unit cost and applies it evenly across everything sold. FIFO instead costs the sale using the actual price of the specific batches consumed, oldest first, so it tracks real purchase history rather than an average.
Does FIFO always produce a lower COGS than LIFO?
When unit costs are rising over time, yes: FIFO draws from the cheaper older stock first, giving a lower COGS and higher reported profit than LIFO, which draws from the most recent, pricier stock first. If costs are falling, the effect reverses.
What happens if I try to sell more units than I have in stock?
There is nothing to cost against that excess, so a valid FIFO calculation needs the quantity sold to be no more than the total units across all the batches entered.
Does the order I enter batches in matter?
Yes. FIFO specifically requires the batches to be entered oldest first, since the whole method depends on consuming stock in the order it arrived.
For a different way to measure inventory efficiency, see the inventory turnover calculator.