FIFO For Inventories Calculator
FIFO cost of goods sold and ending inventory from an opening stock layer and one purchase layer: units and unit cost for each, plus the units you sold.
FIFO For Inventories Calculator
Background.
A shop that buys the same product at different prices through the year ends up with identical boxes on the shelf that cost different amounts. Nothing on the box says which price it carries, so the accounts have to assume an order. First-in, first-out assumes the oldest stock leaves first: units sold are costed at the earliest prices paid, and whatever is still on hand carries the most recent ones.
The assumption moves real numbers. When purchase prices are rising, FIFO matches older, cheaper costs against this period's sales, so cost of goods sold comes out lower and gross profit higher than under last-in, first-out. In the default example, selling 120 of 180 units costs $1,000 under FIFO and $1,120 under LIFO: $120 more expense and $120 less profit from exactly the same goods. The flip side is the balance sheet, where FIFO leaves inventory valued at recent prices, close to what it would cost to restock.
FIFO is accepted under both US GAAP and IFRS, while IFRS does not permit LIFO at all, so FIFO is the usual choice for businesses that report internationally. It also tends to mirror how perishable and dated stock physically moves, although it does not have to.
The working here uses two cost layers: the opening inventory and a single purchase. Sales draw down the opening layer first and reach the purchase only once it is exhausted. Returns, write-downs to net realizable value and periods with more than one purchase lot are outside its scope.
What is fifo for inventories calculator?
FIFO cost of goods sold is the cost assigned to units sold on the assumption that the earliest-acquired units go out first. With an opening layer and one purchase layer, sales consume the opening units at their cost until none remain, then purchase units at theirs. Ending inventory is the cost of all goods available for sale minus that cost of goods sold, which leaves the unsold units valued at the most recent prices.
How to use this calculator.
- Enter the opening layer: units on hand at the start of the period and the cost per unit they were carried at in the last closing valuation.
- Enter the purchase layer: units bought during the period and the cost per unit, including freight-in and other costs of getting the goods to you, less any trade discount.
- Enter the units sold in the period. The total cannot exceed opening units plus purchased units.
- Compare the ending units with your physical stock count. Any gap is shrinkage, damage or a counting error, and needs adjusting separately.
- With more than one purchase in the period, check whether sales reach beyond the first purchase. If they do not, enter the first two layers here and add the cost of later purchases to the ending inventory yourself.
The formula.
Write the opening layer as n₁ units at cost c₁, the purchase as n₂ units at c₂, and units sold as S. FIFO takes S₁ = min(S, n₁) from the opening layer and S₂ = S − S₁ from the purchase. Cost of goods sold = S₁ × c₁ + S₂ × c₂. The cost of goods available is n₁ × c₁ + n₂ × c₂, and ending inventory is goods available minus cost of goods sold, which works out to (n₁ − S₁) × c₁ + (n₂ − S₂) × c₂. Ending units are n₁ + n₂ − S. The threshold that matters is n₁: while sales stay within the opening layer, COGS is simply S × c₁ and the purchase price has no effect on it at all; it only changes the value of what is left.
A worked example.
Opening stock is 100 units carried at $8 each. During the period 80 more are bought at $10, and 120 units are sold. FIFO empties the opening layer first: 100 × $8 = $800. The remaining 20 units sold come from the purchase: 20 × $10 = $200. Cost of goods sold is $800 + $200 = $1,000. Goods available cost 100 × $8 + 80 × $10 = $1,600, so ending inventory is $1,600 − $1,000 = $600, which is the 60 unsold units, all from the newer lot at $10. For contrast, LIFO would sell the 80 newer units first (80 × $10 = $800) and then 40 older ones (40 × $8 = $320), for $1,120 of cost and $480 left in inventory. Weighted average costing, at $1,600 ÷ 180 = $8.89 a unit, lands between them at $1,066.67.
Frequently asked questions.
Why does FIFO show higher profit when prices are rising?
Do I have to sell the oldest stock first to use FIFO?
Does FIFO give a different answer under perpetual and periodic inventory systems?
Why is FIFO common for companies reporting under IFRS?
What if I made three or four purchases during the period?
What should I do if stock has lost value since I bought it?
References& sources.
- [1]Financial Accounting Standards Board. Accounting Standards Codification current 2026. ASC 330 Inventory (PAYWALL). Retrieved 2026-08-06. access: gated.
- [2]OpenStax, Rice University. Principles of Finance, 2022. Chapters 6–10. Retrieved 2026-08-06.
- [3]U.S. Securities and Exchange Commission. Investor.gov current 2026. Investment products and risk. Retrieved 2026-08-06.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 3 cited below
- Method
- FIFO COGS = cost of units sold from oldest layer first
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled