Cost of Goods Sold Calculator
The formula, and the FIFO, LIFO and weighted average behind it.
Work out cost of goods sold from your accounts, or from a stock ledger under FIFO, LIFO and weighted average, with periodic and perpetual side by side.
If you manufacture rather than resell
- Net purchases
- $80,000.00
- Cost of goods available for sale
- $100,000.00
- Less closing inventory
- −$25,000.00
- Gross profit
- $75,000.00
- Gross margin
- 50.0%
Opening + net purchases − closing. The formula never asks what you sold, only what is missing, which is why it quietly absorbs theft, breakage and stock that was counted wrongly. That is a feature for a set of accounts and a problem if you are trying to explain a margin that moved.
Freight in belongs here because it is part of what the goods cost you. Freight out — delivering to the customer — is a selling expense and sits below the gross profit line. Putting it in the wrong place moves the gross margin without changing the bottom line, which is exactly the kind of error that survives a casual review.
How the Cost of Goods Sold Calculator works
Cost of goods sold is one line of arithmetic: what you started with, plus what you bought, less what you have left. The interesting part is the last term, because what is left depends entirely on which units you decide you sold, and the same warehouse of identical goods is worth different amounts under FIFO, LIFO and weighted average.
Also known as: cogs calculator · fifo lifo calculator · weighted average inventory calculator · ending inventory calculator · inventory costing calculator
Frequently asked questions
What is the formula for cost of goods sold?
Opening inventory plus net purchases less closing inventory. Net purchases means what you bought plus freight in, less returns and discounts taken. Freight in belongs in the cost because it is part of what the goods cost you; freight out, delivering to the customer, is a selling expense and sits below the gross profit line. Putting it in the wrong place moves the gross margin without changing the bottom line, which is the sort of error that survives a casual review.
What is the difference between FIFO and LIFO?
Which units you treat as sold. FIFO assumes the oldest stock goes first, so the newest and usually dearest units stay on the balance sheet. LIFO assumes the newest goes first, so cost of goods sold carries the recent higher prices and profit comes out lower. On a typical rising-cost period LIFO produces the highest cost of goods sold, weighted average sits in the middle, and FIFO the lowest. When costs fall the ordering reverses, which is the same rule rather than an exception.
Is LIFO allowed?
In the United States, yes, under GAAP. It is prohibited under IFRS, so it is not available in the UK, EU, Australia, India or most of the world. Its appeal is tax: in a period of rising prices it reports lower profit and so a lower tax bill. US rules attach a condition, the LIFO conformity requirement, which is that a company using it for tax must use it in its published accounts too, so the lower tax comes with lower reported earnings rather than for free.
What is the difference between periodic and perpetual?
When the cost is struck. Periodic works it out once at the end of the period; perpetual recalculates at every sale. Under FIFO the two always agree, because the oldest layer is the oldest layer whenever you look. Under LIFO and weighted average they routinely disagree, because last in at the moment of a mid-period sale is a different batch from last in at the year end, and a running average is struck before later purchases have pulled it around. Neither answer is wrong, and an exam paper or an auditor will have said which one they meant.
How do I calculate ending inventory?
Cost of goods available for sale less cost of goods sold, which is why the two are always shown together here. Every method accounts for the same total cost: whatever does not go to the income statement stays on the balance sheet. If a calculator's cost of goods sold and closing inventory do not add back to what was available, one of them is wrong.
Does cost of goods sold include labour?
For a reseller, no: it is the cost of the goods. For a manufacturer, yes, along with manufacturing overhead, because the cost of the finished item includes making it. That is the difference between the retail formula and cost of goods manufactured, and it is why both labour and overhead have their own fields here rather than being folded into purchases.
Related calculators
Inventory Turnover Calculator
How many times a year your stock sells through.
OpenFinancial Ratio Calculator
Twenty ratios from one set of figures, each with what it actually means.
OpenGross Profit Calculator
Gross profit in money, per sale and per period.
Open