Cost of Goods Sold (COGS) Calculator

Calculate Cost of Goods Sold (COGS) for any business.
Determine gross profit and gross margin from beginning inventory, purchases, and ending inventory.

$
The value of stock on hand on the first day of the period.
$
$
Stock still unsold on the last day. It gets subtracted, not added.
$
Changes the symbol only. No exchange-rate conversion is applied.
COGS and Gross Profit

What Is COGS?

Cost of Goods Sold (COGS), also called Cost of Sales, is the direct cost of the goods a company actually sold during a period.
It is the first line subtracted from revenue, and what survives it has to pay for everything else in the business.

The COGS Formula

COGS = Beginning Inventory + Purchases During Period − Ending Inventory

This is the periodic inventory method, which calculates COGS at the end of an accounting period (month, quarter, or year).

Gross Profit and Gross Margin

Gross Profit = Revenue − COGS

Gross Margin % = (Gross Profit / Revenue) × 100

Gross margin is the number to watch on a product business.
It says how much of each sales dollar is left once the goods themselves are paid for, and rent, wages, marketing and profit all come out of that remainder.

A worked example

Type the placeholder figures into the boxes above and this is what comes back.

Beginning inventory $50,000, purchases $200,000, ending inventory $60,000, revenue $400,000.

  • COGS = $50,000 + $200,000 − $60,000 = $190,000
  • Gross profit = $400,000 − $190,000 = $210,000
  • Gross margin = $210,000 ÷ $400,000 = 52.50%
  • COGS as a share of revenue = 47.50%

The ending inventory is the part people get wrong. It is a subtraction, not an addition: stock still sitting on your shelf at the close of the period was never sold, so its cost has not been incurred yet.

Inventory Valuation Methods

The method used to value inventory affects COGS, especially when costs change over time:

  • FIFO (First In, First Out): Oldest inventory is sold first. In rising cost environments, FIFO produces lower COGS and higher gross profit.
  • LIFO (Last In, First Out): Newest inventory is sold first. Produces higher COGS in rising cost environments (allowed in the US, but not IFRS).
  • Weighted Average Cost: Smooths out price fluctuations by averaging all unit costs. Simpler to administer.

What Is Included in COGS?

  • Raw materials and components
  • Direct labor (workers who make or handle the product)
  • Manufacturing overhead (factory rent, utilities, equipment depreciation)
  • Freight and import duties
  • Packaging costs

Not included in COGS:

  • Selling, General & Administrative (SG&A) expenses
  • Marketing and advertising
  • Executive salaries
  • R&D costs

Industry Gross Margin Benchmarks

Industry Typical Gross Margin
Software / SaaS 70% – 90%
Healthcare services 40% – 60%
Manufacturing 25% – 40%
Retail 20% – 50%
Food service 60% – 75% (food cost is 25–40%)
Grocery 20% – 30%

How to Reduce COGS

  • Negotiate better pricing with suppliers
  • Buy in larger quantities for volume discounts
  • Reduce waste and scrap in production
  • Outsource manufacturing to lower-cost regions
  • Substitute materials without sacrificing quality

On a business with $3M in COGS, a 2% reduction cuts $60,000 of cost and drops it straight to gross profit.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.