Cost of goods sold (COGS) calculator

Work out COGS from opening inventory, purchases and closing inventory, and optionally gross profit.

Enter your values and press Calculate. Your inputs stay in the address, so you can switch language or share the link.

Formula

COGS = beginning inventory + purchases − ending inventory

How it works

Goods available for sale are the opening inventory plus purchases; whatever is left at the end is not yet sold, so COGS is the difference. Enter sales revenue to see gross profit and margin too.

Worked example

The same calculation with the default values:

  • Beginning inventory 20,000
  • Purchases during the period 55,000
  • Ending inventory 18,000
  • Sales revenue (optional) 0
  1. COGS = 20,000 + 55,000 − 18,000 = 57,000

Result: Cost of goods sold: 57,000.00 USD

Uses the periodic inventory method. Your costing method (FIFO, average cost…) determines the inventory values you enter.

Common mistakes

  • Using purchase price alone for "purchases" without including freight-in and other costs needed to get inventory ready for sale, which belong in COGS under most accounting standards.
  • Mixing up beginning and ending inventory - swapping them flips the sign of the inventory change and produces a nonsensical COGS figure.
  • Confusing COGS with total operating expenses - COGS is only the direct cost of the goods sold, not rent, marketing, or administrative costs (see the net-profit calculator for those).

Related calculators