FIFO Inventory Calculator
Value cost of goods sold and ending inventory under first-in, first-out, then connect the cost flow to revenue and gross margin.
Inventory and sales inputs
Use two chronological purchase layers. Batch 1 is the oldest and is consumed first under FIFO.
FIFO results
All values update from the same canonical FIFO layer model used by the table and Excel workbook.
FIFO layer breakdown
| Purchase layer | Purchased units | Unit cost | Units assigned to COGS | Remaining units | COGS assigned | Ending inventory |
|---|---|---|---|---|---|---|
| 1st purchase | 100 | $10.00 | 100 | 0 | $1,000.00 | $0.00 |
| 2nd purchase | 110 | $15.00 | 50 | 60 | $750.00 | $900.00 |
| Total | 210 | – | 150 | 60 | $1,750.00 | $900.00 |
How to use this FIFO inventory calculator
What this calculator does
This calculator applies the first-in, first-out cost-flow assumption to two chronological inventory purchases. It estimates the cost of goods sold (FIFO COGS), the value of inventory still on hand, revenue from the units sold, and the resulting gross profit and gross margin. FIFO is a cost assignment method: it assumes the oldest acquisition costs move into COGS before newer costs. It does not decide your selling strategy, tax position, net income, write-downs, or whether FIFO is the correct accounting policy for your reporting framework.
Use it when you want to check a small inventory example, explain how purchase-price changes affect COGS and ending inventory, reconcile a two-layer inventory exercise, or test the gross-margin effect of changing a selling price. For formal reporting, also consider the rules that apply to your entity. IAS 2 Inventories describes inventory measurement and permitted cost formulas under IFRS Accounting Standards.
How to calculate
- The calculator opens with a complete demonstration: 100 units at $10.00, then 110 units at $15.00, with 150 units sold at $24.00 each. The results and a validated example XLSX are available immediately.
- Replace the two purchase prices and quantities with your own chronological layers. Keep the 1st purchase as the older layer because FIFO consumes it first.
- Enter Total units sold. It must be a whole number no greater than the 1st and 2nd purchase quantities combined.
- Enter Selling price per unit. The calculator multiplies this by units sold for Revenue, then subtracts FIFO COGS for Gross profit and divides gross profit by revenue for Gross margin when revenue is positive.
- Read the result cards and the FIFO layer breakdown. Download Excel exports the current valid model. Reset clears the demonstration and all semantic input data; while the cleared state is incomplete, Download Excel is disabled until a complete valid set of inputs is entered again.
Input guide
1st units purchased price is the required nonnegative USD unit cost of the oldest layer, entered with a period as the decimal separator, for example 10.00. A higher value raises initial inventory and, when this layer is sold, raises FIFO COGS. Do not enter scientific notation or a decimal comma. Number of units purchased 1st time is a required whole-number count, for example 100. Increasing it can keep the second layer out of COGS for longer because FIFO exhausts this first layer before touching the next one.
2nd units purchased price is the required nonnegative USD unit cost of the newer layer, for example 15.00. If costs are rising, a higher second-layer price tends to make ending inventory higher while the older first layer is sold. Number of units purchased 2nd time is a required whole-number count, for example 110. It expands the newer inventory available after the first layer. Quantities must be whole units rather than fractional counts.
Total units sold is a required whole number from zero through total units purchased; the example uses 150. Raising this value moves more units into COGS and fewer units into ending inventory. Entering more units than were purchased is rejected rather than assuming negative inventory. Selling price is the required nonnegative USD amount charged per unit, such as 24.00. It affects Revenue, Gross profit, and Gross margin but does not change FIFO COGS or ending inventory because those are based on acquisition costs.
Output guide
FIFO COGS is the acquisition cost assigned to sold units, expressed in USD. Initial inventory value is the value of both purchase layers before sales: quantity times unit cost for each layer, summed. Ending inventory is the USD cost remaining after FIFO COGS is removed; it equals the unsold units in each layer times their respective costs. Revenue is units sold times Selling price. Gross profit is Revenue minus FIFO COGS, and Gross margin is gross profit divided by revenue when revenue is positive. A negative gross profit or margin means the FIFO cost assigned to the sold units exceeds their sales revenue; zero revenue makes the margin not applicable rather than infinite.
Total units purchased and Remaining units are exact counts. The FIFO layer table shows, for each Purchase layer, Purchased units, Unit cost, Units assigned to COGS, Remaining units, COGS assigned, and Ending inventory. The total row cross-foots to the result cards. These are accounting identities from the entered layers, not forecasts.
Worked example
With 100 units at $10.00 and 110 units at $15.00, initial inventory is $1,000 + $1,650 = $2,650.00. Selling 150 units uses all 100 older units plus 50 of the newer units, so FIFO COGS is $1,000 + $750 = $1,750.00. The 60 unsold newer units are worth $900.00. At a $24.00 selling price, revenue is 150 × $24 = $3,600.00, gross profit is $1,850.00, and gross margin is 51.39%. These figures match the first-open controls, table, result cards, and workbook.
Learn more
For U.S. tax-method context, the IRS discusses inventory identification and the FIFO method in Publication 538, Accounting Periods and Methods. Businesses that report cost of goods sold on applicable U.S. returns may also encounter IRS Form 1125-A, Cost of Goods Sold. These sources help frame reporting requirements; this calculator itself is an educational costing tool and not tax or accounting advice.
How FIFO changes interpretation
When acquisition costs rise over time, FIFO typically moves the older, lower costs into COGS first and leaves newer, higher costs in ending inventory. That can produce lower COGS and higher ending inventory than a method that assigns newer costs first. When prices fall, the direction can reverse. The key point is that the accounting cost flow can change reported COGS and inventory even when the physical number of units is identical.
FIFO COGS = oldest sold units at their layer cost, then newer sold units as needed
Ending inventory = Initial inventory – FIFO COGS
Revenue = Units sold × Selling price
Gross profit = Revenue – FIFO COGS