ShelfCalc

Cost of goods sold calculator

Work out cost of goods sold from your inventory counts and purchases. Add sales to see your gross profit and margin.

$
$
$
Delivery charges on what you bought. Optional.
$
$
Optional. Used for gross profit and margin.

How it works

Cost of goods sold is what the merchandise you actually sold cost you. You can't read it off your invoices, because some of what you bought is still on the shelf and some of what you sold was already there at the start. Inventory counts at both ends of the period sort that out.

Goods available for sale = Beginning inventory + Purchases + Freight in
Cost of goods sold = Goods available for sale − Ending inventory

Example. A store starts the quarter with $40,000 of inventory at cost. It buys $85,000 of product and pays $1,500 in freight, so $126,500 of goods were available to sell.

At the end of the quarter, $38,500 is still on hand. Cost of goods sold is $88,000.

With $150,000 in sales, gross profit is $62,000, a 41.3% gross margin.

Use cost, not retail

Every inventory number here has to be at cost, what you paid, not at the shelf price. Mixing a retail-value count with cost-value purchases is the most common way this calculation goes wrong.

What goes in purchases

Why shrink hides in here

Anything that disappears from the shelf, whether stolen, damaged or expired, never shows up in ending inventory, so it lands in cost of goods sold. That's why a store can have healthy item margins and a disappointing gross margin. The shrink calculator helps you measure how much of the gap is loss.

Common questions

What if I don't count inventory every month?
You can only get an accurate cost of goods sold between two counts. Between counts, many stores estimate it from sales and their expected margin, then correct it at the next physical count.
What do I do with this number?
Subtract it from sales to get gross profit, or use it with average inventory in the inventory turnover calculator.

Last updated October 11, 2026.