Cost of goods sold (COGS) calculator

Enter the inventory at the start of a period, the stock purchased during it and the inventory left at the end. The calculator gives the cost of goods sold and, if you add revenue, the gross profit and gross margin.

Cost of goods sold55,000.00
Goods available for sale
70,000.00
Gross profit
35,000.00
Gross margin
38.89 %

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter the opening inventory (the closing figure of the previous period).
  2. Enter the purchases made during the period and any other direct costs.
  3. Enter the closing inventory from your stock count.
  4. Optionally enter revenue for the period to see gross profit and gross margin.

The formulas

  • Goods available for sale = opening inventory + purchases + other direct costs
  • COGS = goods available for sale − closing inventory
  • Gross profit = revenue − COGS; gross margin = gross profit ÷ revenue × 100 %.

Worked example

Opening inventory 20,000, purchases 50,000, closing inventory 15,000:

  • goods available 20,000 + 50,000 = 70,000;
  • COGS 70,000 − 15,000 = 55,000.00.

With revenue of 90,000 the gross profit is 35,000.00 and the gross margin 35,000 / 90,000 = 38.89 %.

Tips

  • Count the closing stock carefully: every unit missed raises COGS and lowers profit.
  • Returns to suppliers and purchase discounts reduce purchases.
  • The inventory turnover calculator uses COGS to show how fast stock sells.

Frequently asked questions

What is the COGS formula?

Cost of goods sold = opening inventory + purchases − closing inventory. Add other direct costs of getting goods ready to sell, such as freight-in or direct labour in production.

What is not included in COGS?

Selling, marketing and general office costs, such as rent for the shop front, advertising or admin salaries, are operating expenses, not cost of goods sold.

How are gross profit and gross margin found?

Gross profit = revenue − COGS. Gross margin = gross profit ÷ revenue × 100 %. With revenue 90,000 and COGS 55,000 the margin is 38.89 %.

Does the inventory method matter?

Yes. FIFO, weighted average and other methods value the closing inventory differently, and that changes COGS. Use the same method from period to period.

More in Finance

All tools in this category: Finance ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.