Skip to content
Omnikalc

Cost of goods sold (COGS) calculator

Enter opening inventory, purchases, freight-in, closing inventory and sales to get COGS, gross profit, margin, markup and inventory turnover.

Updated on
Your inputs
$

Value out of range

$

Value out of range

$

Value out of range

$

Value out of range

$

Value out of range

Results

Cost of goods sold (COGS)

$125,500

Cost of goods sold and gross profit for the period
Gross profit
$114,500
Gross margin (gross profit ÷ sales)
47.7%
Markup on cost (gross profit ÷ COGS)
91.2%
Inventory turnover (times per period)
3.14
Days of inventory (for a 365-day year)
116 days

Cost of goods sold (COGS) is the cost of the products you actually sold in a period. It is not the same as what you bought, because some of what you purchased is still on the shelf, and some of what you sold came from stock bought earlier. This calculator derives COGS from your opening and closing inventory and purchases, then shows the gross profit, the margin and how quickly stock turns over.

How the calculation works

  • COGS = opening inventory + purchases + freight-in − closing inventory
  • Gross profit = sales − COGS
  • Gross margin = gross profit ÷ sales
  • Markup on cost = gross profit ÷ COGS
  • Inventory turnover = COGS ÷ average inventory, where average inventory = (opening + closing) ÷ 2
  • Days of inventory = 365 ÷ turnover (when the period is one year)

Example

A retailer starts the year with $42,000 in inventory, buys $118,000 of goods, pays $3,500 in freight-in and ends the year with $38,000 in stock. COGS = 42,000 + 118,000 + 3,500 − 38,000 = $125,500. With sales of $240,000, gross profit is $114,500, the gross margin is 47.7 %, and the markup on cost is 91.2 %. Average inventory is $40,000, so stock turns 3.14 times a year, or about 116 days of inventory.

Why it matters

COGS is the first thing subtracted from sales in an income statement, and the quality of every later figure depends on it. A retailer who does not track closing inventory cannot know whether a good month was due to strong margins or to under-buying. Tracking COGS also shows quickly if supplier prices, freight or shrinkage are cutting into profit.

Good to know

Accounting rules allow different ways of valuing inventory (FIFO, LIFO where allowed, or weighted average), and in times of rising prices they give different COGS and profit. Losses from theft, damage and spoilage (shrinkage) are in COGS unless recorded separately. For a business with high-volume sales, the turnover for the period is not annual: multiply a quarterly turnover by four to compare with a year. This tool is for education and is not accounting advice.

The GMROI calculator relates gross margin to inventory investment, the inventory turnover calculator focuses on how fast stock moves, and the margin calculator converts margin and markup.

Frequently asked questions

What is the formula for COGS?

COGS = opening inventory + purchases (with freight-in) − closing inventory. It is the cost of what you actually sold, rather than of what you bought.

What does COGS include?

The direct cost of the goods: purchase price, freight-in, import duties and, for a maker, materials, direct labor and factory costs. Selling, marketing and administrative costs are not part of COGS.

What is the difference between margin and markup?

Gross margin is gross profit as a share of sales; markup is gross profit as a share of cost. A 50 % markup gives a margin of 33 %, and a 100 % markup gives a margin of 50 %.

Why does the closing inventory matter so much?

Because anything left on the shelf is not yet an expense. A counting error in closing stock moves profit by the same amount, so a physical count at the end of the period is important.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.