# COGS Calculator (Cost of Goods Sold)

URL: https://speedycalculator.com/calculators/finance/cogs/
Last updated: 2026-10-25

> The COGS calculator works out the cost of goods sold for a period from beginning inventory, purchases and ending inventory, and the resulting gross profit and gross margin.

## Inputs

- Beginning inventory
- Purchases during the period
- Ending inventory
- Revenue for the period

## Results

- Cost of goods sold
- Gross profit
- Gross margin
- Inventory turnover

## Formula

```
COGS = beginning inventory + purchases − ending inventory
Gross profit = revenue − COGS; gross margin = gross profit ÷ revenue
```

## Explanation

Cost of goods sold is the direct cost of the products a business sold in a period – materials, merchandise and direct labour, but not overheads such as rent or marketing. It is deducted from revenue to give gross profit.

### How to use the COGS Calculator

- **Beginning inventory**
- **Purchases during the period**
- **Ending inventory**
- **Revenue for the period**

Results update as you type, and every field accepts the units shown in its menu.

### How it works

Enter inventory at the start of the period, purchases (including freight-in) during it, inventory at the end and, optionally, revenue.

### Tips

- Use figures for the same period (a month, a quarter or a year) for every input so ratios compare like with like.
- Track the metric over time – the trend usually tells you more than a single value.
- Compare your result with industry benchmarks, which vary a lot between sectors.
- Treat the result as a starting point for a decision, then check the assumptions behind each input.

### Common mistakes to avoid

- Mixing monthly and yearly numbers in the same calculation.
- Using revenue where the formula needs profit (or the other way round).
- Forgetting hidden costs such as taxes, fees, overheads or your own time.

### Inputs explained

FieldWhat to enterBeginning inventoryAmount in your currencyPurchases during the periodAmount in your currencyEnding inventoryAmount in your currencyRevenue for the periodAmount in your currency

### What each result means

- **Cost of goods sold** = [Beginning inventory] + [Purchases during the period] - [Ending inventory]
- **Gross profit** = [Revenue for the period] - [Cost of goods sold]
- **Gross margin** = [Gross profit]÷[Revenue for the period]×100
- **Inventory turnover** = [Cost of goods sold]÷(([Beginning inventory] + [Ending inventory])÷2)

### Example values

How the main result changes when **Beginning inventory** changes and everything else stays at the example values above:

Beginning inventoryCost of goods sold20,000105,00030,000115,00040,000125,00050,000135,00060,000145,00080,000165,000

## Worked example

Inputs — Beginning inventory: $40,000; Purchases during the period: $120,000; Ending inventory: $35,000; Revenue for the period: $210,000.

Results — **Cost of goods sold = $125,000.00**; Gross profit = $85,000.00; Gross margin = 40.48 %; Inventory turnover = 3.33 ×.

## FAQ

**What is included in COGS?**
Direct materials, merchandise bought for resale, direct labour and freight-in.

**Are operating expenses part of COGS?**
No – rent, salaries of office staff and marketing are operating expenses.

**Why does ending inventory reduce COGS?**
Goods still on the shelf haven't been sold, so their cost isn't an expense yet.

**What formula does the COGS Calculator use?**
COGS = beginning inventory + purchases − ending inventory.


## Sources

- [IRS – Cost of goods sold (Publication 334)](https://www.irs.gov/publications/p334)
