FIFO Inventory Calculator

Is inventory management with the FIFO calculator right for your company?

Use this FIFO inventory calculator to estimate cost of goods sold (COGS), remaining inventory value, revenue, gross profit, and gross margin. Enter your purchase batches from oldest to newest, then add your selling price and units sold.

FIFO stands for first in, first out: the earliest inventory costs are assigned to sales first, leaving the newer costs in ending inventory.

First in First Out example

How to use the FIFO calculator

  1. Enter the oldest purchase first. Under “1st purchase,” enter the purchase price per unit and the number of units purchased—not the total batch cost.
  2. Add later purchases in chronological order. The calculator supports up to five purchase batches. Use one batch for each separate cost layer, even when the product is identical.
  3. Enter the selling price per unit. If units sold at different prices, use total sales revenue divided by units sold as the average selling price.
  4. Enter Units Sold. This cannot exceed the total units available across the batches you entered.
  5. Review the results. COGS represents the cost assigned to sold units; remaining inventory value represents the cost of the unsold units. Revenue, gross profit, and gross margin use your selling price and sales quantity.

Use the calculator for one product or a group of interchangeable units measured consistently. Prices are entered in dollars and quantities in pieces. Leave unused purchase batches at zero.

If you have beginning inventory, enter its remaining FIFO cost layers before the period’s new purchases. Combining layers with different costs into a single average-cost batch can change the FIFO result. Include only inventory available for the sales you are analyzing; a later purchase cannot supply an earlier sale.

What does FIFO measure?

FIFO is an inventory cost-flow assumption. It determines which purchase costs become COGS and which remain as an inventory asset. It does not require the physical items shipped to be the exact units bought first.

For example, if you buy 100 units at $10 and later buy 50 units at $12, FIFO assigns the $10 costs to the first 100 units sold. Only after that layer is exhausted do sales use the $12 costs.

Physical stock rotation is a separate operating practice. Selling older stock first may reduce waste or obsolescence, but choosing FIFO accounting alone does not make stock move faster.

FIFO formula: how the calculation works

For each purchase batch, multiply its unit cost by its quantity. Add those batch costs to find the total cost of goods available:

Total inventory cost = P1Q1 + P2Q2 + … + PnQn

Here, P is the purchase cost per unit, Q is the quantity purchased, and n is the number of batches entered.

To calculate FIFO COGS, allocate units sold to the oldest batch first. Continue to the next batch only when the earlier batch is used up:

FIFO COGS = Sum of (units allocated from each batch × that batch’s unit cost)

Only the units used to fulfill sales belong in COGS—not necessarily the entire quantity of every batch touched.

  • Remaining inventory value = Total inventory cost − FIFO COGS
  • Remaining units = Total units purchased − Units sold
  • Total revenue = Selling price × Units sold
  • Gross profit = Total revenue − COGS
  • Gross margin = Gross profit ÷ Total revenue × 100%

When working from accounting records, the equivalent inventory relationship is: beginning inventory cost + purchases − COGS = ending inventory cost, before any other inventory adjustments.

Worked FIFO example

Suppose a T-shirt business has these purchase batches, listed from oldest to newest:

Purchase batch Units purchased Cost per unit Batch cost
1st purchase 100 $10 $1,000
2nd purchase 50 $20 $1,000
3rd purchase 200 $40 $8,000
Total 350 Not applicable $10,000

The business sells 250 shirts at $50 each. FIFO assigns all 100 units from the first batch, all 50 from the second, and 100 from the third to those sales.

COGS = (100 × $10) + (50 × $20) + (100 × $40) = $6,000

The remaining 100 shirts come from the third cost layer, so their inventory value is 100 × $40 = $4,000.

Result Calculation Amount
Cost of goods sold $1,000 + $1,000 + $4,000 $6,000
Remaining inventory value $10,000 − $6,000 $4,000
Total revenue 250 × $50 $12,500
Gross profit $12,500 − $6,000 $6,500
Gross margin $6,500 ÷ $12,500 × 100% 52%

How to interpret your FIFO results

  • Inventory value is a cost, not a selling value. The $4,000 ending balance in the example is the assigned purchase cost of unsold goods. It is not expected sales revenue or a guaranteed recoverable value.
  • Gross profit is not net profit. Rent, marketing, administrative expenses, interest, and taxes are not separate inputs here. Consider them before deciding whether a product is profitable overall.
  • Historical margin may overstate replacement-cost margin. In the example, the reported gross margin is 52%, but a shirt costing $40 and selling for $50 has a 20% gross margin before other expenses.
  • Gross margin differs from markup. Margin divides gross profit by revenue; markup divides it by cost. Gross margin is mathematically undefined when revenue is zero.

A useful reconciliation check is COGS + remaining inventory value = total entered inventory cost. If all available units are sold, remaining inventory should be zero. If none are sold, the full entered cost remains in inventory.

Returns, shrinkage, damage, write-downs, and other adjustments are not separate inputs. Reconcile these in your inventory records rather than treating this estimate as a complete accounting ledger.

FIFO versus LIFO and weighted-average cost

Alternative Methods

The main alternatives assign different costs to the same units sold:

  • FIFO: Assigns the oldest available costs to sales first.
  • LIFO: Assigns the newest available costs to sales first.
  • Weighted-average cost: For a periodic calculation, divides total cost of goods available by total units available, then applies that average cost to units sold and units remaining. This is not the investment strategy called dollar-cost averaging.

When purchase costs rise, FIFO generally produces lower COGS and higher gross profit and ending inventory than LIFO, all else equal. Falling costs generally reverse that relationship. Neither result proves that operations improved or that cash flow increased.

LIFO is permitted under U.S. GAAP but prohibited under IFRS Accounting Standards. Accounting and tax requirements matter when choosing a method; do not select one solely because a calculator shows higher profit.

Using FIFO for inventory decisions

port

Retailers can use FIFO estimates to review product margins as supplier prices change. Manufacturers can examine raw-material cost layers, although calculating finished-goods costs also requires relevant labor and overhead. Wholesalers can estimate the cost remaining after a large order.

For food, medicines, and other dated goods, distinguish purchase order from expiration order. First-expired, first-out (FEFO) may be more appropriate for physical picking when newer deliveries expire sooner. FIFO valuation does not replace expiration controls.

To turn the results into action, compare historical gross margin with the margin expected at your next purchase price. Then review stock levels and sales pace before reordering.

Related inventory calculators

For a supplier’s website, Calcopolis lets you build a customized savings calculator so buyers can compare current and proposed purchase costs before requesting a quote.