Skip to content
OverCalculator
  1. Home
  2. Financial
  3. FIFO Inventory Calculator
Financial

FIFO Inventory Calculator

Calculate FIFO cost of goods sold, ending inventory, revenue, gross profit, and margin from two inventory purchase layers.

Published

FIFO COGS
Cost of goods sold (FIFO)
$1,240.00
Ending inventory value
$720.00
Revenue
$1,800.00
Gross profit
$560.00
Gross margin
31.11%
Units sold from first batch
100
Units sold from second batch
20

FIFO sells the oldest purchase layer first.

$
$
$

Results update as you type.

FIFO Inventory Calculator

FIFO is the inventory method that answers a very specific question: if the oldest costs in stock are assigned to sales first, what are cost of goods sold and ending inventory after the sale? This calculator uses two purchase layers, a sales quantity, and a selling price. It then removes units from the first batch before touching the second batch. The result is not a generic average-cost estimate; it is the exact first-in, first-out allocation used by the form’s compute logic.

Use this page when you have two recorded purchases and need a clean FIFO schedule for a worksheet, small-business margin check, class assignment, or pricing review. If you need the opposite cost flow, use the LIFO inventory calculator. If the result is part of a merchandising review, compare the margin with the GMROI calculator and the inventory turnover calculator. For broader profit planning, the accounting profit calculator can help connect gross profit with other business costs.

Inputs this calculator uses

The form has six numeric inputs. First units purchased and first unit cost describe the oldest layer. Second units purchased and second unit cost describe the newer layer. Units sold is the sale quantity you want to cost. Selling price per unit is used only for revenue, gross profit, and margin; it does not change FIFO COGS.

All quantities and costs must be nonnegative. The calculator accepts decimal costs and whole-unit steps, but the formula works the same if you use fractional units for a weight-based inventory. If the units sold input is greater than first units plus second units, the calculator sets sold units equal to total units available. It reports the largest sale it can support from the inventory entered rather than returning an invalid result.

FIFO method and formula

First-in, first-out is a cost-flow assumption. It does not require a warehouse to physically ship the oldest item, although many perishable or dated products are managed that way. For accounting, the key point is that older costs move to cost of goods sold before newer costs. Ending inventory therefore represents the unsold remainder after the oldest layer has been consumed.

The calculator first caps sold units at available units:

sold units=min(units sold entered,first units+second units)\text{sold units} = \min(\text{units sold entered}, \text{first units} + \text{second units})

It then assigns the sale across the two layers:

sold from first=min(sold units,first units)\text{sold from first} = \min(\text{sold units}, \text{first units})

sold from second=min(max(0,sold unitsfirst units),second units)\text{sold from second} = \min(\max(0, \text{sold units} - \text{first units}), \text{second units})

FIFO COGS, ending inventory, and margin are calculated as:

FIFO COGS=(sold from first×first cost)+(sold from second×second cost)\text{FIFO COGS} = (\text{sold from first} \times \text{first cost}) + (\text{sold from second} \times \text{second cost})

ending inventory=(first unitssold from first)×first cost+(second unitssold from second)×second cost\text{ending inventory} = (\text{first units} - \text{sold from first}) \times \text{first cost} + (\text{second units} - \text{sold from second}) \times \text{second cost}

gross margin=revenueFIFO COGSrevenue×100%\text{gross margin} = \frac{\text{revenue} - \text{FIFO COGS}}{\text{revenue}} \times 100\%

If revenue is zero, the form displays a zero gross margin rather than dividing by zero.

Example: valuing inventory with FIFO

Suppose the oldest purchase has 100 units at 10.00 each, the second purchase has 80 units at 12.00 each, 120 units are sold, and the selling price is 15.00 per unit. Total inventory is 180 units, so the sale is not capped. FIFO uses all 100 units from the first batch, then 20 units from the second batch.

The COGS calculation is 100 · 10.00 plus 20 · 12.00, which equals 1,240.00. Ending inventory is zero first-batch units plus 60 second-batch units at 12.00, or 720.00. Revenue is 120 · 15.00, or 1,800.00. Gross profit is 1,800.00 minus 1,240.00, or 560.00. Gross margin is 560.00 divided by 1,800.00, multiplied by 100, which is 31.11% when rounded to two decimals.

Now test the cap behavior. With the same purchases but 250 units sold, only 180 units are available. The calculator uses 180 sold units, not 250. FIFO COGS becomes 100 · 10.00 plus 80 · 12.00, or 1,960.00. Ending inventory is 0.00. Revenue is 180 · 15.00, or 2,700.00. The note explains that results were capped at inventory on hand.

When FIFO is useful

FIFO is especially intuitive for food, medicine, cosmetics, parts with revision dates, and any item where older inventory is normally moved first. In rising-cost periods, FIFO often leaves newer, higher costs in ending inventory and sends older, lower costs to COGS. That can make gross profit look stronger than a last-in, first-out calculation using the same sale.

Managers use FIFO to see how price changes flow through margin. If the second batch cost is much higher than the first, a small sale may still look profitable because it is costed from the old layer. Once sales reach the new layer, COGS jumps. That timing matters for reorder pricing, promotions, and gross margin targets.

Tips for accurate FIFO results

  • Keep purchase layers in chronological order: first batch means oldest batch.
  • Use cost per selling unit, not case cost, unless units sold are also cases.
  • Enter selling price net of discounts if you want margin after markdowns.
  • Reconcile inventory before relying on the cap behavior; selling more than recorded stock signals a records issue.
  • Compare FIFO, LIFO, and GMROI together when cost inflation or slow-moving stock could distort merchandising decisions.

Sources

Frequently asked questions

What does FIFO mean in inventory accounting?
FIFO means first in, first out. It assigns the oldest recorded inventory costs to the units sold first, then uses newer purchase costs only after the earlier layer is exhausted. The assumption is about accounting costs, not necessarily the exact physical boxes shipped.
What does this FIFO calculator calculate?
It calculates FIFO cost of goods sold, ending inventory value, revenue, gross profit, gross margin, and the units sold from each of two purchase batches. If units sold exceed inventory on hand, the calculator caps the sale at the total available units.
How is FIFO different from LIFO?
FIFO pulls sold units from the oldest purchase layer first, while LIFO pulls from the newest layer first. When unit costs are rising, FIFO usually reports lower cost of goods sold, higher gross profit, and higher ending inventory than LIFO for the same sales quantity.
Can FIFO ending inventory include old units?
Yes, if the sale quantity is smaller than the oldest layer, the remaining oldest units stay in ending inventory. In this calculator, ending inventory is whatever remains in the first and second batches after the FIFO sale allocation is completed.
Is FIFO allowed for tax and financial reporting?
FIFO is a common inventory cost-flow method, but reporting rules depend on jurisdiction, accounting framework, and tax elections. This calculator is an educational model only. Use your accounting policy and professional advice for financial statements, tax filings, and audit support.
Why does the calculator cap units sold?
The FIFO form accepts any nonnegative units sold value, but the compute logic cannot sell more units than the two batches contain. When the input is too high, it uses total inventory on hand and displays a note explaining the cap.

Related calculators

FIFO Inventory Calculator updated at