★ GUIDES · MONEY · COST OF GOODS SOLD

How to Calculate Cost of Goods Sold (COGS)

Cost of goods sold is one number that answers one question: what did the goods you sold cost you? On $50,000 of revenue, $8,000 of beginning inventory, $22,000 of purchases and $6,000 of ending inventory, the cost of goods sold is $24,000, the gross profit is $26,000 and the gross margin is 52%. This guide shows you how to calculate it from the revenue, the beginning inventory, the purchases and the ending inventory, step by step, with the worked example that matters and the traps that catch people out. Try the numbers yourself in the cost of goods sold calculator.

How to calculate cost of goods sold, step by step

Cost of goods sold is one number that answers one question: what did the goods you sold cost you? The calculation needs four numbers: your revenue, your beginning inventory, your purchases and your ending inventory. On $50,000 of revenue, $8,000 of beginning inventory, $22,000 of purchases and $6,000 of ending inventory, the cost of goods sold is $24,000, the gross profit is $26,000 and the gross margin is 52% — a margin, not a value in dollars, and it is below 100% because the goods cost money.

The definition is the cost of the goods that left the shelf: what you had at the start, plus what you bought, minus what is still there. The beginning inventory is what you had on hand at the start of the period, valued at what it cost you — it is the previous period’s ending inventory, not a fresh guess. The purchases are what you bought during the period, at cost. The ending inventory is what you have left at the end, counted and valued the same way. So the cost of goods sold is the beginning inventory plus the purchases minus the ending inventory.

The worked example, line by line. Step 1 — the cost of goods sold: $8,000 + $22,000 − $6,000 = $24,000. Step 2 — the gross profit: $50,000 − $24,000 = $26,000. Step 3 — the gross margin: $26,000 ÷ $50,000 × 100 = 52%. Work it yourself in the cost of goods sold calculator.

A note on the rounding: the figures are displayed to two decimals, half-up. The margin is the profit divided by the revenue, and with whole-dollar inputs it lands exactly on 52.00%. With fractional inputs it can land a hair either side of a round number, and the calculator prints the unrounded margin so the rounding does not mislead you.

What the answer means

A gross margin of 52% means $52 of every $100 of sales stays in the business after the goods are paid for — for every dollar of sales, the goods cost about 48 cents. That $52 has to cover everything else: rent, wages, utilities, marketing and tax, and whatever is left is the profit. A margin above 50% is comfortable for many small businesses, but the right margin depends on the business — a grocery shop runs thin because it sells a lot at a small markup, and a service business runs fat because it sells time rather than goods. Compare your margin against businesses like yours, not against a universal number, and watch it over time: a margin that drifts down while sales rise usually means the cost of goods is climbing faster than the prices.

When there is no gross margin

Some businesses have no gross margin, and the honest answer is that it is undefined. With no sales there is nothing to measure a margin against — the revenue is nothing, so there is no denominator — and the calculator says so plainly. A business that sells nothing has no margin to report, whatever its stock is worth. In each case the calculator shows the figure instead of hiding it.

COGS vs gross profit

The cost of goods sold and the gross profit answer different questions, and mixing them up is the most common mistake. The cost of goods sold is what the goods cost — $24,000 here. The gross profit is what is left after that cost — $26,000 here. One is a cost, the other is what remains. The margin is the profit as a share of revenue — 52% here. A business can have a big gross profit and a thin margin if it sells a lot, or a small gross profit and a fat margin if it sells a little at a high markup. Use the cost of goods sold when you want what the goods cost, and use the gross profit when you want what is left. Work it out in the cost of goods sold calculator.

COGS vs contribution margin

The cost of goods sold and the contribution margin answer different questions too. The cost of goods sold is the cost of the goods sold, whatever those goods are. The contribution margin is revenue minus variable costs only, so it strips out fixed costs that the cost of goods sold can include. On $50,000 of revenue the cost of goods sold is $24,000 and the gross profit is $26,000, and the contribution margin depends on which of those costs vary with sales. One is the cost of the goods, the other is the margin after variable costs. Use the cost of goods sold when you want what the goods cost, and use the contribution margin when you want what each extra sale contributes. Work out the margin in the contribution margin calculator.

Common mistakes

The first mistake is counting the ending inventory wrong — a wrong count moves the profit by the same amount, in the opposite direction, so count the stock at the end of the period carefully. The second is putting overhead in the cost of goods sold — rent, wages and utilities come out of the gross profit, not the cost of goods. The third is using the selling price instead of the cost price for the inventory — the inventory is valued at what it cost you, not what you will sell it for. The fourth is forgetting that a negative cost of goods sold means the count is wrong — you cannot have more stock left than you started with plus what you bought. Work it out in the cost of goods sold calculator, and check the inventory turnover calculator and the break-even point calculator before you decide what the answer means.

Frequently asked questions

How do I calculate cost of goods sold?

Add the beginning inventory and the purchases, then subtract the ending inventory. On the defaults that is $8,000 + $22,000 − $6,000 = $24,000. The gross profit is the revenue minus that cost — $50,000 − $24,000 = $26,000 — and the gross margin is the profit divided by the revenue — 52%.

What does a 52% gross margin mean?

$52 of every $100 of sales stays in the business after the goods are paid for. That $52 has to cover rent, wages, utilities, marketing and tax, and whatever is left is the profit. Compare your margin against businesses like yours, not against a universal number.

What is the difference between COGS and gross profit?

One is a cost, the other is what remains. The cost of goods sold is what the goods cost — $24,000 here. The gross profit is what is left after that cost — $26,000 here. The margin is the profit as a share of revenue — 52% here.

What if my ending inventory is bigger than my beginning inventory plus purchases?

Then the cost of goods sold goes negative, which means the count is wrong. You cannot have more stock left than you started with plus what you bought. Recount before you trust the profit.