Skip to content
The Calculatorz
Business finance

Cost of Goods Sold (COGS) Calculator

Calculate cost of goods sold from beginning inventory, purchases and ending inventory, with gross profit, gross margin and inventory turnover.

This is an accounting illustration, not tax or accounting advice. Inventory valuation methods and tax rules vary by country.

Inventory and purchases

Values

What is cost of goods sold?

Cost of goods sold (COGS) is the direct cost of the products a business sold during a period. It is found by adding purchases and other direct costs to the opening inventory and subtracting the inventory left at the end. Deducting COGS from sales gives gross profit.

How to use this calculator

Enter the value of inventory at the start of the period, what you bought and other direct costs of getting goods ready to sell, and the value of inventory left at the end. Add net sales to see gross profit and margin.

Formula

Goods available for sale = beginning inventory + purchases + other direct costs. COGS = goods available − ending inventory. Gross profit = net sales − COGS. Gross margin = gross profit ÷ net sales × 100. Inventory turnover = COGS ÷ average inventory.

Terms in the formula

Beginning inventory
Cost of stock at the start of the period.
Purchases
Cost of stock bought during the period.
Ending inventory
Cost of stock left at the end.
Gross margin
Gross profit as a percentage of net sales.

Understanding your result

COGS shows what the goods you sold cost you, so sales minus COGS is the gross profit available to pay overheads and earn a profit. A falling gross margin can signal rising supplier costs, discounting or stock losses. Accurate stock counts at the start and end of the period are essential, because errors flow straight into profit.

Calculator credits

Calculator developmentJulia Edwards

Editorial supervision

Expert reviewQasimACCA, CFA, Senior Financial Analyst

Published byThe Calculatorz

Last updated

Read how we research, test, review and correct our calculators in our editorial policy.

Frequently asked questions

What is included in cost of goods sold?

The direct cost of the goods you sold: purchase price, freight-in and, for manufacturers, materials and direct labour. Selling, marketing and office costs are operating expenses, not COGS.

Why does ending inventory reduce COGS?

Goods still on the shelf at the end of the period have not been sold, so their cost is carried forward as inventory rather than counted as an expense.

Do service businesses have COGS?

Often not in the same way. Some report cost of services or cost of revenue, such as staff time spent directly on client work.

How does the inventory method affect COGS?

FIFO, LIFO (where allowed) and weighted-average methods value ending inventory differently, which changes COGS and profit when prices change.

Is COGS tax-deductible?

In many countries, yes, as part of calculating business profit. Tax rules on inventory valuation vary, so follow your tax authority's guidance, such as IRS Publication 334 in the US.

What is a good gross margin?

It varies widely by industry: grocery retail may run on 20–30%, while software can exceed 70%. Compare with businesses like yours and track your own trend.

References & methodology sources

These sources support the calculator’s formula, definitions, thresholds, units or result interpretation.

  1. Internal Revenue Service. (2025). Publication 334: Tax guide for small business. View source
  2. Franklin, M., Graybeal, P., & Cooper, D. (2019). Principles of accounting, volume 1: Financial accounting. OpenStax. View source
  3. Franklin, M., Graybeal, P., & Cooper, D. (2019). Principles of accounting, volume 2: Managerial accounting. OpenStax. View source
  4. Dahlquist, J. R., & Knight, R. (2022). Operating efficiency ratios. In Principles of finance (Section 6.2). OpenStax. View source