Accounting
Intermediate

Cost of Goods Sold

Direct cost of goods sold in a period.

Formula

COGS=Beginning+Purchases−EndingCOGS = Beginning + Purchases - Ending

Live Calculator

Members

Variables

Beginning,EndingInventory
PurchasesAdded stock

Example

Inventory flow

How it works

Cost of goods sold measures the value of inventory that was actually sold during a period. You start with what you had on hand, add what you bought or produced during the period, and then subtract what is still left unsold; whatever remains must be the cost of the items that left stock and became expense. This works because inventory is a rolling stock account: everything available to sell must end up either still in inventory or included in COGS.

When to use it

Use this formula in accounting and business reporting when you need to calculate the expense tied directly to sales, especially for merchandising or inventory-based businesses. It is also useful when preparing gross profit, managing stock records, or checking whether inventory balances make sense.

Worked example, step by step

Step 1: Identify the amounts. Beginning inventory = $18,000 Purchases = $42,500 Ending inventory = $15,200 Step 2: Substitute into the formula. COGS = Beginning + Purchases - Ending COGS = 18,000 + 42,500 - 15,200 Step 3: Add the inventory available for sale. 18,000 + 42,500 = $60,500 Step 4: Subtract ending inventory. 60,500 - 15,200 = $45,300 Final answer: Cost of goods sold = $45,300

Common mistakes to avoid

  • subtracting beginning inventory instead of adding it
  • using sales revenue in place of purchases
  • forgetting that ending inventory must be counted as unsold stock and removed from the total

Did You Know?

Cost of goods sold directly shapes gross profit, making inventory accounting surprisingly high-stakes.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026