COGS Calculator (Cost of Goods Sold)

Quick answer

The COGS calculator works out the cost of goods sold for a period from beginning inventory, purchases and ending inventory, and the resulting gross profit and gross margin.

$
$
$
$
Cost of goods sold
$ 125,000.00
Gross profit
$ 85,000.00
Gross margin
40.48 %
Inventory turnover
3.33 ×

Cost of goods sold is the direct cost of the products a business sold in a period (materials, merchandise and direct labour), but not overheads such as rent or marketing. It is deducted from revenue to give gross profit.

How to use the COGS Calculator

  1. Beginning inventory
  2. Purchases during the period
  3. Ending inventory
  4. Revenue for the period

Results update as you type, and every field accepts the units shown in its menu.

How it works

Enter inventory at the start of the period, purchases (including freight-in) during it, inventory at the end and, optionally, revenue.

Inputs explained

Field What to enter
Beginning inventory Amount in your currency
Purchases during the period Amount in your currency
Ending inventory Amount in your currency
Revenue for the period Amount in your currency

What each result means

  • Cost of goods sold = [Beginning inventory] + [Purchases during the period] – [Ending inventory]
  • Gross profit = [Revenue for the period] – [Cost of goods sold]
  • Gross margin = [Gross profit]÷[Revenue for the period]×100
  • Inventory turnover = [Cost of goods sold]÷(([Beginning inventory] + [Ending inventory])÷2)

Example values

How the main result changes when Beginning inventory changes and everything else stays at the example values above:

Beginning inventory Cost of goods sold
20,000 105,000
30,000 115,000
40,000 125,000
50,000 135,000
60,000 145,000
80,000 165,000

Formula

COGS = beginning inventory + purchases − ending inventory Gross profit = revenue − COGS; gross margin = gross profit ÷ revenue

Worked example

Inputs: Beginning inventory: $40,000; Purchases during the period: $120,000; Ending inventory: $35,000; Revenue for the period: $210,000.
Results: Cost of goods sold = $125,000.00; Gross profit = $85,000.00; Gross margin = 40.48 %; Inventory turnover = 3.33 ×.

Frequently asked questions

What is included in COGS?

Direct materials, merchandise bought for resale, direct labour and freight-in.

Are operating expenses part of COGS?

No. Rent, salaries of office staff and marketing are operating expenses.

Why does ending inventory reduce COGS?

Goods still on the shelf haven't been sold, so their cost isn't an expense yet.

Sources

  1. IRS: Cost of goods sold (Publication 334)

Cite this calculator

Speedy Calculator. (2026). COGS Calculator (Cost of Goods Sold). Speedy Calculator. https://speedycalculator.com/calculators/finance/cogs/