AbraCalc

Cost of Goods Sold (COGS) Calculator

Calculate the cost of goods sold for a period using beginning inventory, purchases, and ending inventory.

Embed this tool on your site

How to use this tool

  1. Enter beginning inventory, purchases during period, direct labor costs, manufacturing overhead, ending inventory and revenue (optional, for gross profit) in the fields above.
  2. Results update instantly as you type โ€” or click Calculate.
  3. Read your cost of goods sold (cogs) and the full breakdown beneath it.

โš  This tool provides general estimates for education only and is not financial, tax or legal advice. Figures may not reflect your situation โ€” verify with a qualified professional.

Formula

COGS = Beginning Inventory + Purchases + Direct Labor + Overhead โˆ’ Ending Inventory

Gross Profit = Revenue โˆ’ COGS

Gross Margin = (Gross Profit / Revenue) ร— 100%

How it works

COGS represents the direct costs of producing goods sold during a period. It starts with opening inventory, adds all costs incurred to produce or acquire goods (purchases, direct labor, overhead), and subtracts closing inventory to isolate only the costs of goods actually sold.

Gross profit margin reveals what fraction of revenue remains after direct production costs; higher margins indicate stronger pricing power or production efficiency. This calculator does not include indirect selling or administrative expenses (SG&A).

Worked example

Retailer with $300K Revenue

  1. Beginning Inventory: $50,000 + Purchases: $120,000 + Labor: $30,000 + Overhead: $10,000 = $210,000 goods available.
  2. Subtract Ending Inventory: $210,000 โˆ’ $40,000 = COGS $170,000.
  3. Gross Profit = $300,000 โˆ’ $170,000 = $130,000.
  4. Gross Margin = $130,000 / $300,000 ร— 100% = 43.33%.

COGS = $170,000; Gross Profit = $130,000; Gross Margin = 43.33%

Common mistakes to avoid

  • Forgetting to include direct labor and overhead in COGS, which understates true production cost and inflates gross margin.
  • Using ending inventory from the wrong accounting period, causing COGS to be misstated when inventory counts are misaligned with the reporting period.
  • Mixing cash-basis purchases with an accrual-basis inventory count, creating a timing mismatch between purchases recorded and goods on hand.

Key terms

Cost of Goods Sold (COGS)
The direct costs attributable to producing or purchasing the goods sold by a company during a period.
Beginning Inventory
The value of inventory on hand at the start of an accounting period, equal to the prior period's ending inventory.
Ending Inventory
The value of unsold inventory remaining at the end of an accounting period.
Gross Profit
Revenue minus COGS; the profit before operating expenses, interest, and taxes.
Gross Margin
Gross profit expressed as a percentage of revenue, indicating production and pricing efficiency.

Frequently asked questions

Does COGS include shipping costs to customers?
No. Outbound shipping is a selling expense. Inbound freight to receive raw materials can be included in COGS as a direct acquisition cost.
Why does higher ending inventory lower COGS?
COGS = Beginning Inventory + Purchases - Ending Inventory. A larger ending balance means fewer goods were consumed, so less cost is charged to COGS.
What is the difference between COGS and operating expenses?
COGS covers costs directly tied to producing or purchasing goods sold (materials, direct labor, overhead). Operating expenses are period costs like rent and marketing not linked to individual units sold.

References & sources