LIFO Inventory and COGS Calculator

Last-in, first-out charges your newest purchase costs to the goods you sold and leaves the oldest costs sitting in inventory. Enter your opening layer and up to three purchases in date order, say how many units you sold, and the calculator consumes the layers from the bottom of the stack upward. You get LIFO cost of goods sold, LIFO ending inventory, gross profit and margin — plus the two numbers that decide whether LIFO is worth the paperwork: the LIFO reserve against FIFO, and the current tax that reserve defers.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Beginning inventory unitsUnits on hand at the start of the period — under LIFO this is the layer you touch last.100 units
Beginning inventory unit costThe cost already recorded for that opening layer, which on a long-standing LIFO base can be very old.10 $
Units sold during the periodTotal units shipped in the period; this models periodic LIFO, where only the total matters.300 units
Selling price per unitAverage net price received per unit, so gross profit and margin can be derived.20 $
Purchase 1 unitsUnits in your earliest purchase of the period.200 units
Purchase 1 unit costDelivered cost per unit including freight-in, net of returns and discounts taken.12 $
Purchase 2 unitsUnits in your next purchase. Leave at zero if you only bought once.150 units
Purchase 2 unit costDelivered cost per unit for that second lot.14 $
Purchase 3 unitsUnits in your most recent purchase — the layer LIFO costs out first.50 units
Purchase 3 unit costDelivered cost per unit for the newest lot.15 $
Marginal income tax rateYour combined marginal rate; 21% is the US federal corporate rate, so add your state rate if it applies.21 %

It returns

  • LIFO cost of goods sold — Your newest layers charged to expense, which is what makes LIFO a tax-deferral method.
  • LIFO ending inventory
  • Gross profit
  • Gross margin
  • FIFO cost of goods sold, same facts
  • LIFO reserve — FIFO inventory minus LIFO inventory — the cumulative profit LIFO has kept off the income statement.
  • Income tax deferred by LIFO
  • Units remaining on hand

The formula

COGS=k=nnm+1qkck
ILIFO=CCOGSLIFO
Tax deferred=Reserve×t

In plain text: COGS(LIFO) = Σ (units taken from layer k × unit cost of layer k), newest layer first; LIFO reserve = FIFO inventory − LIFO inventory

  • qₖUnits drawn from layer k, emptying the newest layer before moving down the stack (units)
  • cₖDelivered unit cost of layer k, layer n being the most recent purchase ($/unit)
  • mNumber of layers touched before the units sold are fully costed (count)
  • CCost of goods available for sale: Σ (all layer units × their costs) ($)

This is periodic (year-end) LIFO, the version US tax returns are built on: the whole period's sales are costed against the layers as they stand at the close, so the order of individual sales is irrelevant.

Updated Category Inventory, Receivables & Asset Accounting Verified against published test cases Reading time 13 min

What LIFO does, and why anyone chooses it

LIFO exists for one reason: cash tax. By charging your most recent, most expensive purchase costs against revenue, it reports the smallest gross profit of the three cost-flow methods whenever prices are rising — and a smaller taxable profit means tax paid later rather than sooner. That deferral is the entire economic case, and it is a real one. A distributor holding a large, stable stock of a commodity input can carry an interest-free deferral for decades.

Everything else about LIFO is a cost you accept to get that benefit. The balance sheet becomes progressively less informative, because the layers that survive are your oldest: a company that adopted LIFO in 1975 may still carry part of its inventory at 1975 prices. Ratios with inventory in them stop being comparable to a FIFO competitor's without restatement. You take on the annual work of tracking layers or dollar-value pools, and you accept that a bad year which forces you to sell into the old base will pull years of deferred profit into income at once.

LIFO is also geographically confined. US GAAP permits it under ASC 330, and US tax law permits it under IRC §472, but IAS 2 prohibits it outright. Any company reporting under IFRS — which is most of the world — uses FIFO or weighted average cost and has no LIFO option to weigh.

Note what LIFO is not. It is not a claim about physical movement. A grain elevator drawing from the top of the pile genuinely ships newest-first, but a bookshop can cost under LIFO while shelving strictly by date. Both standards treat the cost formula as an accounting policy, independent of warehouse practice.

How the layer arithmetic runs, and where the reserve comes from

Build the same stack of dated cost layers you would for any method: beginning inventory at the bottom, each purchase on top in date order, every layer carrying its delivered cost per unit. Then cost the period's sales from the top down. Empty the newest layer, move to the one below it, and continue until every unit sold is accounted for. Exactly one layer ends up partially consumed; everything below it is untouched and forms ending inventory.

The identity that makes the arithmetic self-checking is the same one behind the cost of goods sold calculator: cost of goods available for sale splits, without remainder, into cost of goods sold and ending inventory. So you can add up the layers you consumed, or value the layers that survived, and subtract — the two routes must agree to the cent.

The LIFO reserve is the difference the method has made. Formally it is FIFO inventory minus LIFO inventory: the profit LIFO has kept off the income statement since adoption. Because the cost pool is fixed, that same figure equals the cumulative excess of LIFO cost of goods sold over FIFO cost of goods sold, which is why this calculator can report the reserve from a single period's layers. Multiply the reserve by your marginal rate and you have the deferred tax the choice has bought.

Two mechanical warnings. First, this is periodic LIFO — the whole period's sales are costed against the layers as they stand at the close, which is how a US return is prepared. Perpetual LIFO, which costs each sale against the newest layer existing on that date, gives a different answer, and the reference table below shows how much. Second, most real LIFO filers do not track units at all: they use dollar-value LIFO, grouping similar items into pools and deflating each year's ending inventory with a price index so that only genuine quantity increases create a new layer. Unit LIFO, as modelled here, is the version you learn the logic from and the version that works for a single-SKU business.

Worked example: 500 units in, 300 out, costs climbing

A distributor opens the quarter with 100 units carried at $10 and buys three times as its supplier raises prices: 200 units at $12, then 150 at $14, then 50 at $15. It sells 300 units at $20 each. Work it by hand, top of the stack down.

  1. Build the pool. Units available: 100 + 200 + 150 + 50 = 500. Cost available: $1,000 + $2,400 + $2,100 + $750 = $6,250.
  2. Empty the newest layer. Purchase 3 has 50 units at $15 = $750. 250 units still to cost.
  3. Empty the next. Purchase 2 has 150 units at $14 = $2,100. 100 units still to cost.
  4. Take a partial slice of Purchase 1. 100 of its 200 units at $12 = $1,200, and the requirement is satisfied. LIFO cost of goods sold = $750 + $2,100 + $1,200 = $4,050.
  5. Value what survived. 100 units of Purchase 1 at $12 = $1,200, plus the whole opening layer, 100 units at $10 = $1,000. LIFO ending inventory = $2,200. Cross-check: $6,250 − $4,050 = $2,200. Agreed.
  6. Gross profit. Revenue is 300 × $20 = $6,000, so gross profit is $1,950 and gross margin is $1,950 ÷ $6,000 = 32.5%.

Now cost the identical 300 units oldest-first, the FIFO way: 100 × $10 + 200 × $12 = $3,400, leaving FIFO ending inventory of $2,850. So LIFO charged $650 more to expense and reported $650 less pre-tax profit — a margin of 32.5% against FIFO's 43.3% on physically identical facts.

That $650 is the LIFO reserve: $2,850 of FIFO inventory minus $2,200 of LIFO inventory. At a 21% federal rate it defers about $136.50 of tax. Scale the layers by a thousand and you are deferring $136,500 — which is why the paperwork can be worth it, and why the deferral has to be tracked and disclosed rather than quietly enjoyed.

How to read the result

Read cost of goods sold first, because under LIFO it is the meaningful number. It sits close to what those units would cost you to replace today, so gross margin under LIFO is a fair reading of current trading. That is LIFO's genuine analytical virtue and the mirror image of FIFO's: the income statement is current, the balance sheet is stale.

Read the reserve as an accumulated, contingent liability of profit. A large and growing reserve tells you costs have risen steadily and volumes have held, so the deferral is compounding. A reserve that shrinks is a warning: either your input costs are falling, or you are selling into old layers. Divide the reserve by LIFO inventory and you have a rough measure of how understated the balance sheet is: the larger that ratio, the further the carrying figure sits below what the same stock would cost today.

Read ending inventory with suspicion for any purpose that needs a current value. Do not use a LIFO inventory figure in a borrowing-base calculation, an insurance schedule or an acquisition model without adding the reserve back. To compare a LIFO company with a FIFO competitor, add the reserve to inventory, add the reserve net of tax to equity, and adjust cost of goods sold by the change in the reserve for the year. Analysts do this routinely before computing current ratio or inventory turnover.

Watch the negative case, which surprises people. If your purchase costs fall through the period, LIFO charges the cheapest costs to expense, reports a higher profit than FIFO, and accelerates tax. The reserve goes negative. LIFO is a bet on inflation, and in deflation the bet loses.

LIFO periodic and perpetual give different answers — FIFO does not

One transaction sequence: open with 100 units at $10.00; buy 200 at $12.00 on 10 March; sell 250 on 5 June; buy 150 at $14.00 on 20 September; sell 50 on 8 November. In total 450 units costing $5,500 are available, 300 are sold and 150 remain.
MethodPeriodic COGSPerpetual COGSPeriodic ending inventoryPerpetual ending inventory
LIFO$3,900.00$3,600.00$1,600.00$1,900.00
Weighted average$3,666.67$3,500.00$1,833.33$2,000.00
FIFO$3,400.00$3,400.00$2,100.00$2,100.00

Periodic LIFO costs the year's 300 units against the layers standing at 31 December, so the September purchase absorbs 150 units at $14.00. Perpetual LIFO charges the June sale against the March layer, which was the newest layer in existence that day, and only the November sale reaches the $14.00 layer — a $300 difference in cost of goods sold. Perpetual average cost is a moving average, $11.3333 before the June sale and $13.3333 after the September purchase.

LIFO is an election with strings attached

You must apply for it. A US taxpayer adopts LIFO by filing Form 970 with the return for the first year of use. Leaving LIFO later is a change in accounting method that generally requires IRS consent on Form 3115, and the resulting income adjustment is taxable.

The conformity requirement binds your financial statements. IRC §472 conditions the election on using LIFO for income reporting to shareholders and creditors as well — you cannot take the tax deferral while showing FIFO profits to your bank. The LIFO reserve disclosure is what lets readers convert back.

The measurement ceiling is different. Since ASU 2015-11, inventory measured under FIFO or average cost is carried at the lower of cost or net realisable value, but LIFO and retail-method inventory retain the older lower of cost or market test. Do not apply the FIFO rule to a LIFO pool.

Mistakes that produce a wrong LIFO figure

  • Consuming layers in the wrong direction. LIFO starts at the newest purchase. Costing oldest-first is simply FIFO with a LIFO label on it, and the reserve will come out zero or negative for no economic reason.
  • Mixing periodic and perpetual within one period. Pick one. Periodic LIFO is what the tax return expects; a perpetual system's month-end totals will not tie to it, and the gap is not an error to chase.
  • Treating unit LIFO as dollar-value LIFO. Multi-item pools need an index-based calculation, and applying unit layers to a pool with changing product mix produces layers that do not exist.
  • Forgetting freight-in and duty. Delivered cost is inventory cost under ASC 330 and §263A. Understating a layer's cost understates every future LIFO charge that touches it.
  • Ignoring a LIFO liquidation. If sales dip into the old base, the margin that period is inflated by decades-old costs. It is a one-off gain and must be disclosed as such, not presented as trading performance.
  • Reporting a LIFO inventory figure as current value. Lenders, insurers and buyers all need the FIFO-equivalent. Add the reserve back before the number leaves your building.
  • Assuming LIFO always cuts tax. It defers tax only while costs rise. In deflation it does the opposite, and you cannot switch back without IRS consent.

When LIFO earns its keep, and when to use something else

LIFO pays when three conditions hold together: your input costs rise persistently, your unit volumes are stable or growing, and your inventory is large relative to profit. Petroleum, chemicals, metals distribution, industrial supply and automotive parts are the classic homes, because all three conditions are structural rather than lucky. If any one fails — costs flat, volumes cyclical, inventory small — the deferral will not repay the tracking cost and the reporting friction.

Use FIFO instead when the balance sheet is doing work: raising asset-based finance, negotiating a sale, or reporting to an IFRS parent that will not accept LIFO in consolidation. Use weighted average cost when you have thousands of low-value interchangeable SKUs and the honest answer is that no layer story is worth maintaining; average cost is also the least manipulable of the three, since there are no layers to select.

Whatever you choose, the downstream figures inherit the choice. Gross margin, days inventory outstanding and every working-capital measure move with the split between cost of goods sold and ending inventory. Comparability across periods and against peers matters more than the method itself, which is why both ASC 330 and IAS 2 treat a change of cost formula as a disclosed accounting-policy change rather than a free choice each year.

Key terms

LIFO reserve
FIFO inventory minus LIFO inventory. The cumulative pre-tax profit LIFO has deferred, and the figure you add back to restate a LIFO balance sheet.
LIFO liquidation
Selling more units than you buy, so old low-cost layers are charged to expense. Inflates margin once, then the deferral is gone.
Dollar-value LIFO
Pooling similar items and using a price index to strip inflation out of ending inventory, so a new layer forms only when real quantity rises.
LIFO conformity
The IRC §472 condition that a taxpayer electing LIFO for tax also reports on LIFO to shareholders and creditors.

Frequently asked questions

How do you calculate ending inventory using LIFO?

Value the oldest layers that survive after the sales are costed. Work down from your newest purchase, consuming layers until every unit sold is accounted for, then price whatever is left at its own layer cost. The cross-check is cost of goods available for sale minus LIFO cost of goods sold. In the example on this page, $6,250 of goods available less $4,050 of LIFO cost gives $2,200, which is the surviving 100 units at $12 plus the opening 100 units at $10.

Why does LIFO lower my taxes?

Because it charges your highest costs to expense first while prices are rising, which reduces taxable income now and pushes it into a later year. The saving is a deferral, not a permanent exemption: the deferred profit sits in the LIFO reserve and comes into income whenever you sell into the old layers or leave the method. On the layers in the worked example the deferral is $650 of profit, about $136.50 of federal tax at 21%.

Is LIFO allowed under IFRS?

No. IAS 2 permits only FIFO and weighted average cost, so LIFO is prohibited for any entity reporting under IFRS. That is the single biggest practical constraint on the method: a US subsidiary of an IFRS parent normally cannot use LIFO in the group accounts, and the US tax conformity rule in §472 makes the mismatch awkward. LIFO remains available under US GAAP in ASC 330 and under US tax law.

What is a LIFO liquidation and why does it matter?

A LIFO liquidation happens when you sell more units than you replace, so the costing reaches down into layers laid years or decades ago. Those old low costs produce an unusually wide margin for one period, and the tax that LIFO deferred becomes payable. It matters because the gain is neither repeatable nor operational — a company reporting record margins in a demand slump is often just liquidating LIFO layers, and the effect has to be disclosed so readers can strip it out.

Can I use LIFO for tax and FIFO for my financial statements?

No. The conformity requirement in IRC §472 conditions the LIFO election on using LIFO in the income statements you give shareholders and creditors. You can, and generally must, disclose the LIFO reserve so a reader can convert your figures back to a FIFO basis — that disclosure is the sanctioned way to show both, not a second set of books. Internal management reporting on a FIFO basis is permitted.

What is dollar-value LIFO and do I need it?

Dollar-value LIFO groups similar inventory into pools and measures each year's layer in constant dollars using a price index, so a new layer forms only when the real quantity of the pool increases. You need it once you hold more than a handful of items, because unit-by-unit layers become unmanageable and product mix changes would otherwise create phantom layers. The logic on this page — newest cost out first — is identical; only the unit of account changes from units to deflated dollars.

How do I restate a LIFO company's accounts onto a FIFO basis?

Three adjustments, all driven by the disclosed reserve. Add the reserve to inventory and to pre-tax equity, reduce equity by the deferred tax on the reserve, and adjust cost of goods sold by the change in the reserve during the year — subtract an increase, add a decrease. After that the inventory, current ratio, turnover and margin are comparable with a FIFO peer's. Skipping the restatement is the most common error in cross-company inventory analysis.

What happens to the reserve if my purchase costs fall?

It shrinks, and it can go negative. LIFO charges the newest costs to expense, so when those costs are the cheapest ones you hold, LIFO reports lower cost of goods sold and higher profit than FIFO — the reverse of the usual picture. The edge case in this calculator's tests shows a $400 negative reserve on falling prices. Because leaving LIFO requires IRS consent and triggers a taxable adjustment, you cannot simply switch out when the bet turns.

References

  • FASB Accounting Standards Codification Topic 330, Inventory — Financial Accounting Standards Board
  • IAS 2 InventoriesIFRS Foundation / International Accounting Standards Board
  • Form 970, Application to Use LIFO Inventory MethodInternal Revenue Service
  • Internal Revenue Code §472, Last-in, first-out inventories — Office of the Law Revision Counsel, U.S. House of Representatives
  • Intermediate Accounting, 18th ed., chapters on inventory valuation — Wiley (Kieso, Weygandt & Warfield)