COGS Calculator (Cost of Goods Sold)

Calculate cost of goods sold from opening inventory, purchases, and closing inventory, and derive gross profit and margin from it.

📦 Accounting📐 COGS = opening inventory + purchases − closing inventory💼 Business
Opening inventory
Purchases during period
Closing inventory
Revenue for the period
Direct labour (if included)
Freight in / direct costs
Please enter valid values.

Formula & Reference

VariableSymbolFormulaUnits
COGS Calculator (Cost of Goods Sold)COGS = opening inventory + purchases − closing inventorycurrency

Step-by-Step Examples

Example 1
Standard Calculation

Opening 180,000, purchases 940,000, freight 22,000, closing 210,000, revenue 1,650,000.

  • Goods available = 180,000 + 940,000 + 22,000 = 1,142,000
  • COGS = 1,142,000 − 210,000 = 932,000
  • Gross profit = 1,650,000 − 932,000 = 718,000
  • Gross margin = 43.52%
✓ COGS 932,000, margin 43.52%
Example 2
Inventory Build

Opening 100,000, purchases 500,000, closing 180,000, revenue 700,000.

  • Goods available = 600,000
  • COGS = 600,000 − 180,000 = 420,000
  • Inventory grew 80,000, so COGS is lower than purchases
  • Gross margin = 40.00%
✓ COGS 420,000 — inventory absorbed 80,000
Example 3
Inventory Drawdown

Opening 250,000, purchases 400,000, closing 120,000, revenue 750,000.

  • Goods available = 650,000
  • COGS = 650,000 − 120,000 = 530,000
  • COGS exceeds purchases because stock was drawn down
  • Gross margin = 29.33%
✓ COGS 530,000 — drawdown of 130,000

Real-World Applications

Common Mistakes to Avoid

⚠️
Including indirect costs in COGS

Marketing, administrative salaries, and general overhead belong in operating expenses, not COGS. Including them understates gross margin and misleads on unit economics.

⚠️
Forgetting freight in

Inbound freight is part of the cost of acquiring inventory and belongs in COGS. Outbound shipping to customers is a selling expense.

⚠️
Confusing purchases with COGS

They are only equal when inventory is unchanged. Building stock makes COGS lower than purchases; drawing it down makes COGS higher.

Frequently Asked Questions

What is cost of goods sold?
The direct cost of producing or acquiring the goods sold during a period — opening inventory plus purchases and direct costs, less closing inventory.
What should be included in COGS?
Direct materials, inbound freight, and direct labour where applicable. Indirect costs such as marketing and administration should not be included.
Why is COGS different from purchases?
Because inventory changes. If you bought more than you sold, some purchases remain in inventory and are not yet expensed as COGS.
Does COGS include shipping to customers?
No. Inbound freight to acquire inventory belongs in COGS; outbound shipping to customers is generally a selling expense.
How does COGS affect gross margin?
Gross profit is revenue minus COGS, so any misclassification directly distorts the gross margin percentage.

Related Business Calculators