HomeGuides › How to Calculate Cost of Goods Sold

How to Calculate Cost of Goods Sold

Updated 2026-08-31 · ProfitKit

Want the arithmetic done for you? Use the Profit Margin Calculator — free, no signup.

Cost of goods sold is the direct cost of the items you actually sold in a period. It is the line that sits directly under revenue, and gross profit is what remains after it. Get it wrong and every margin figure downstream is wrong too.

The formula

COGS = Opening inventory + Purchases during the period − Closing inventory

The logic: everything you started with plus everything you bought, less whatever is still on the shelf, is what left the building.

Worked example

A shop starts the quarter with $2,400 of stock, buys $6,100 more, and counts $1,900 remaining at the end.

COGS = $2,400 + $6,100 − $1,900 = $6,600

If revenue for that quarter was $14,000, gross profit is $7,400 and gross margin is 52.9%.

What belongs in COGS

What does not

That last point is the one that trips people up. Buying $5,000 of stock in a month does not create $5,000 of COGS in that month. Only the portion that sold does. This is why a month with a big stock order can look catastrophic on a naive spreadsheet and be perfectly healthy in reality.

Why it matters for pricing

Gross margin from COGS tells you whether the product line works at all. Net margin — after fees, postage, advertising and overheads — tells you whether the business works. You need both, and they answer different questions. A shop with a strong 55% gross margin can still lose money if fees and postage take 30 points of it.

Keep the count honest

The formula depends entirely on your closing inventory figure being real. Count it, do not estimate it, and write off what is genuinely unsellable rather than carrying it forever. An inflated closing inventory understates COGS and overstates profit — a flattering error that eventually corrects itself painfully.

Do the calculation

Profit Margin Calculator

Net profit, net margin and markup with every fee subtracted.

How to Calculate Profit Margin

The profit margin formula, the difference between gross and net margin, and the three mist…

Etsy Fees Explained

Every fee Etsy charges sellers — listing, 6.5% transaction, payment processing and Offsite…