FIFO, LIFO and average cost calculator

List the quantity and unit cost of each purchase in the order you bought them, then the number of units sold. The calculator works out the cost of goods sold and the value of the stock left by first-in first-out, last-in first-out and the weighted average cost, and the gross profit if you add a selling price.

Oldest first, separated by spaces, e.g. 100 150 200 (include opening stock as the first lot)
In the same order, e.g. 10 12 15
Leave empty to skip revenue and gross profit
COGS, FIFO2,800.00
COGS, LIFO3,600.00
COGS, weighted average3,222.22
Ending inventory, FIFO
3,000.00
Ending inventory, LIFO
2,200.00
Ending inventory, weighted average
2,577.78
Weighted average unit cost
12.8889
Units available
450
Units left
200
Cost of goods available
5,800.00
Revenue
5,000.00
Gross profit, FIFO
2,200.00
Gross profit, LIFO
1,400.00
Gross profit, weighted average
1,777.78

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. In Quantity of each purchase, list the lots from oldest to newest, starting with opening stock.
  2. In Unit cost, list the cost per unit of each lot in the same order.
  3. Enter the units sold in the period.
  4. Add a selling price per unit to compare the gross profit of each method.

How it works

  • FIFO: sold units are taken from the first lots; the ending inventory is the newest units.
  • LIFO: sold units are taken from the last lots; the ending inventory is the oldest units.
  • Weighted average: average unit cost = cost of all units ÷ all units; COGS = average × units sold.

In every method, cost of goods sold + ending inventory = cost of goods available.

Worked example

Three lots: 100 units at 10, 150 at 12 and 200 at 15, which is 450 units costing 5,800. You sell 250 units at 20.

  • FIFO: 100 × 10 + 150 × 12 = 2,800.00; ending inventory 200 × 15 = 3,000.00.
  • LIFO: 200 × 15 + 50 × 12 = 3,600.00; ending inventory 100 × 10 + 100 × 12 = 2,200.00.
  • Average: 5,800 ÷ 450 = 12.8889 per unit; 250 × 12.8889 = 3,222.22; ending inventory 2,577.78.
  • Revenue 250 × 20 = 5,000.00, so gross profit is 2,200.00 (FIFO), 1,400.00 (LIFO) and 1,777.78 (average).

Tips

  • Costs rose from 10 to 15 here, which is why LIFO shows the highest cost and the lowest profit.
  • Use the same method from period to period: switching changes the profit without any change in the business.
  • Include freight and other costs of buying in the unit cost if your accounting does.

Frequently asked questions

What is the difference between FIFO and LIFO?

FIFO (first in, first out) assumes the oldest units are sold first, so the stock left is valued at the latest costs. LIFO (last in, first out) assumes the newest units are sold first, so the stock left is valued at the oldest costs.

Which method gives a higher profit?

When costs are rising, FIFO gives a lower cost of goods sold and a higher profit, and LIFO the opposite. When costs are falling it is the other way round. The weighted average lands in between.

Is LIFO allowed?

IFRS (IAS 2) does not allow LIFO; US GAAP does. Check the rules that apply to your accounts and your tax authority before choosing a method.

Is this the periodic or the perpetual system?

Periodic: all purchases of the period are counted first and the sales are taken from them at the end. With sales spread between purchases, perpetual LIFO and moving-average results can differ; for FIFO the two systems give the same answer.

How do I include opening inventory?

Enter it as the first lot with its quantity and unit cost, then the purchases of the period after it.

More in Finance

All tools in this category: Finance ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.