---
title: "Cost of goods sold (COGS)"
description: "What cost of goods sold is, the COGS formula (opening inventory plus purchases minus closing inventory), what it includes and excludes, and a worked example."
canonical: https://ledgeriano.com/glossary/cost-of-goods-sold
language: en
publisher: "Ledgeriano"
updated: 2026-11-06
---

# Cost of goods sold (COGS)

> What cost of goods sold is, the COGS formula (opening inventory plus purchases minus closing inventory), what it includes and excludes, and a worked example.

Cost of goods sold (COGS) is the cost of the inventory a business sold during a period, including purchase or production cost and the costs of bringing goods to a saleable condition, such as freight in. It is calculated as opening inventory plus purchases minus closing inventory and is deducted from revenue to give gross profit.

COGS includes the purchase price net of discounts, import duties, inbound freight and, for manufacturers, direct materials, direct labour and production overhead. It excludes selling costs, administrative salaries and outbound shipping, which are operating expenses.

The cost formula changes COGS when prices move. Under [FIFO](https://ledgeriano.com/glossary/fifo) the oldest costs are expensed first; under the [weighted average cost](https://ledgeriano.com/glossary/weighted-average-cost) method every unit sold carries the average. In a perpetual system such as Ledgeriano's inventory module, COGS is posted automatically with each delivery, so the [inventory guide](https://ledgeriano.com/guides/inventory-cost-accounting) and the ledger always agree.

```
COGS = Opening inventory + Purchases - Closing inventory
Gross profit = Revenue - COGS
```

## Example: COGS for a quarter

A retailer starts the quarter with inventory of 20,000, buys goods for 65,000 including inbound freight, and counts 15,000 of stock at quarter end. COGS is 20,000 + 65,000 - 15,000 = 70,000. With sales of 110,000, gross profit is 40,000.

| Line | Amount |
| --- | --- |
| Opening inventory | 20,000 |
| Plus purchases | 65,000 |
| Goods available for sale | 85,000 |
| Less closing inventory | 15,000 |
| Cost of goods sold | 70,000 |

### Is COGS an expense?

Yes. COGS is the expense that matches inventory costs to the revenue from selling it, and it is usually the largest expense of a trading business.

### Do service businesses have COGS?

They usually call it cost of services or cost of revenue: the direct labour and subcontracting costs of delivering the service.

Guide: https://ledgeriano.com/guides/inventory-cost-accounting
