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

LIFO Inventory Calculator

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

Published

COGS
LIFO cost of goods sold
$144.00
Initial inventory value
$190.00
Ending inventory value
$46.00
Remaining units
4
Revenue
$160.00
Gross profit
$16.00
Gross margin
10%
LIFO layers used
3rd purchase sold
7 × $15.00
2nd purchase sold
3 × $13.00

Last purchase layers are sold first: 10 units sold from 14 available.

Purchase layers
Purchase layers 1
$
Purchase layers 2
$
Purchase layers 3
$
$

Results update as you type.

LIFO Inventory Calculator

The LIFO inventory calculator measures cost of goods sold using the last-in, first-out method. Add purchase layers from oldest to newest, enter units sold, and enter the selling price per unit. The calculator starts with the newest layer, assigns those costs to the sale, then moves backward through older layers until the sale quantity has been filled. It reports LIFO COGS, initial inventory value, ending inventory value, remaining units, revenue, gross profit, gross margin, and a layer-by-layer sale breakdown.

This page is deliberately different from the FIFO inventory calculator. FIFO consumes the oldest layer first; LIFO consumes the newest layer first. Comparing the two can show how much of a period’s gross profit is caused by the cost-flow assumption rather than by pricing, units sold, or supplier economics. For inventory performance after COGS is known, use the GMROI calculator, inventory turnover calculator, and margin calculator.

Inputs and validation

The purchase table accepts up to twelve layers. Each row has a description, unit cost, and units. The description is used in the output group, so names like “January purchase” or “third shipment” make the breakdown easier to audit. Unit cost and units must be finite, nonnegative numbers. Units sold and selling price must also be nonnegative.

The calculation method has one strict validation rule that matters in real use: units sold cannot exceed total units available. If the sale quantity is too large, the result is invalid. This is different from the FIFO calculator in this batch, which caps sold units at inventory on hand. Here, you must correct the sale quantity or add missing inventory layers before the calculator reports a result.

LIFO method and formula

LIFO is a cost-flow assumption in which the last recorded costs are recognized first in COGS. Physical flow can be different. A business might ship older items for quality reasons while still analyzing costs under a LIFO assumption where allowed.

First, the calculator values all layers at cost:

initial inventory=(layer units×layer unit cost)\text{initial inventory} = \sum(\text{layer units} \times \text{layer unit cost})

Then it moves from the newest layer to the oldest layer:

sold from layer=min(layer units,remaining units to sell)\text{sold from layer} = \min(\text{layer units}, \text{remaining units to sell})

The LIFO COGS total is the sum of each sold layer amount:

LIFO COGS=(sold from layer×layer unit cost)\text{LIFO COGS} = \sum(\text{sold from layer} \times \text{layer unit cost})

The remaining measures are:

ending inventory=initial inventoryLIFO COGS\text{ending inventory} = \text{initial inventory} - \text{LIFO COGS}

revenue=units sold×selling price per unit\text{revenue} = \text{units sold} \times \text{selling price per unit}

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

If revenue is zero, gross margin is not defined because the percentage would divide by zero. The result therefore shows Not defined rather than a misleading percentage. Use a positive selling price when you need a meaningful margin.

Worked example

Use the default layers: 2 units at 10.00, 5 units at 13.00, and 7 units at 15.00. They are entered oldest to newest. Sell 10 units at 16.00 each. Total units are 14, so the sale is valid. Initial inventory is 2 · 10.00 plus 5 · 13.00 plus 7 · 15.00, which equals 190.00.

LIFO starts with the newest layer. It sells all 7 units from the third purchase at 15.00, adding 105.00 to COGS. Three units still need to be sold, so it moves to the second purchase and sells 3 units at 13.00, adding 39.00. The first purchase is untouched. LIFO COGS is 144.00.

Ending inventory is initial inventory 190.00 minus COGS 144.00, or 46.00. That ending inventory consists of 2 units at 10.00 and 2 remaining units at 13.00. Revenue is 10 · 16.00, or 160.00. Gross profit is 160.00 minus 144.00, or 16.00. Gross margin is 16.00 divided by 160.00, multiplied by 100, or 10.00%. The output breakdown lists “3rd purchase sold” for 7 units at 15.00 and “2nd purchase sold” for 3 units at 13.00.

When LIFO is useful

LIFO is most informative when costs are changing quickly. In rising-cost periods, it often places recent, higher costs into COGS sooner. That can make gross profit look lower than FIFO while ending inventory carries older, lower costs. In falling-cost periods, the pattern can reverse. Analysts use this difference to understand whether margins improved because selling prices increased or simply because older, cheaper layers were still flowing through COGS.

LIFO can also be useful for stress-testing price decisions. If a new supplier shipment is significantly more expensive, a LIFO scenario shows margin as if sales are immediately costed at the new level. That is helpful for markdown planning, reorder pricing, and category reviews, even if official books use another method.

Tips for accurate LIFO analysis

  • Enter the oldest purchase first and the newest purchase last.
  • Use the same unit of measure for purchases, sales, and selling price.
  • Check the invalid state if no result appears; the most common cause is selling more units than the table contains.
  • Compare with FIFO before drawing conclusions about profitability.
  • Remember that LIFO availability for official reporting depends on accounting and tax rules.

Sources

Frequently asked questions

What does LIFO mean in inventory accounting?
LIFO means last in, first out. The newest recorded purchase layer is assigned to cost of goods sold before older layers. It is a cost-flow assumption for accounting, not a requirement that the newest physical item must be shipped first.
How should I enter purchase layers?
Enter layers in chronological order, with the oldest purchase first and the newest purchase last. The calculator works backward from the final row. If the order is reversed, the result will not represent last-in, first-out costing for your records.
What happens if units sold exceed inventory?
Unlike the FIFO method, LIFO produces an invalid result when units sold are greater than total units available. Available inventory is checked before any last-in, first-out cost layers are assigned to the sale.
Why is LIFO COGS often higher during inflation?
When purchase prices rise over time, the newest layers usually carry the highest unit costs. LIFO assigns those newer costs to goods sold first, so cost of goods sold is often higher and gross profit lower than under FIFO reporting.

Related calculators

LIFO Inventory Calculator updated at