Understanding the cost of goods sold (COGS) calculator — concept and principle
This calculator finds the cost of goods sold with the periodic inventory method: what you had at the start, plus what you bought or made, minus what is left at the end. With net sales entered it also shows gross profit, gross margin, inventory turnover and days of inventory. Retailers, small manufacturers and bookkeepers use it at year end or when preparing an income statement.
How it is calculated
- Goods available for sale = beginning inventory + net purchases + direct labour + freight-in and other product costs
- COGS = goods available for sale − ending inventory
- Gross profit = net sales − COGS; gross margin = gross profit ÷ net sales × 100
- Average inventory = (beginning + ending) ÷ 2
- Inventory turnover = COGS ÷ average inventory; days of inventory = 365 × average inventory ÷ COGS
The principle
Every product cost ends up in one of two places: still on the shelf (ending inventory) or sold (COGS). Starting from everything you could have sold and subtracting what remains leaves what must have been sold. This is why the ending count matters so much: overstating it understates COGS and overstates profit. Both inventory counts must use the same valuation method, such as FIFO or average cost.
Worked example
Defaults: beginning inventory 40,000; net purchases 185,000; direct labour 0; freight-in 6,000; ending inventory 52,000; net sales 310,000.
- Goods available = 40,000 + 185,000 + 0 + 6,000 = $231,000.
- COGS = 231,000 − 52,000 = $179,000.
- Gross profit = 310,000 − 179,000 = $131,000; margin = 42.3%; COGS = 57.7% of sales.
- Average inventory = 46,000; turnover = 179,000 ÷ 46,000 = 3.89 times.
- Days of inventory = 365 × 46,000 ÷ 179,000 = 93.8, shown as 94.
| Net purchases (after returns and discounts) | Cost of goods sold (COGS) |
|---|---|
| 46,250 | $40,250 |
| 92,500 | $86,500 |
| 138,750 | $132,750 |
| 185,000 | $179,000 |
| 231,250 | $225,250 |
| 277,500 | $271,500 |
| 370,000 | $364,000 |
How to read the result
A higher gross margin means more of each sale is left to pay operating costs. Turnover shows how quickly stock sells: about 3.9 times a year here, or roughly 94 days on the shelf. Faster turnover ties up less cash but risks stock-outs. Compare with your own past years and similar businesses, since grocery and fashion, for example, turn stock at very different speeds.
Common mistakes
- Including selling or office costs in COGS; only product costs belong there.
- Forgetting freight-in, or deducting returns twice.
- Valuing beginning and ending inventory with different methods.
- Using days of inventory with a COGS figure for less than a year.
Frequently asked questions
Is COGS an expense?
Yes. It is the expense for the products sold in the period and appears directly below revenue on the income statement.
Does COGS include shipping to customers?
Usually not. Freight-in to bring goods to you is a product cost; shipping to customers is generally a selling expense.
What happens if ending inventory is overstated?
COGS is understated and gross profit is overstated by the same amount.
Sources: OpenStax, Principles of Accounting, Volume 1: Financial Accounting, chapter 10 "Inventory"