Cost of Goods Sold (COGS) Calculator

Use our COGS calculator to calculate the cost of goods sold from beginning inventory, purchases, and ending inventory. Includes what COGS stands for, how to calculate COGS from inventory, the cost of goods sold calculation formula, and Excel-ready formulas with an example.

Beginning inventory (USD)
Inventory value at the start of the period.
Purchases (USD)
Total inventory purchases during the period.
Ending inventory (USD)
Inventory value at the end of the period.
Results
Cost of goods sold (COGS)
COGS = beginning inventory + purchases − ending inventory.
COGS = beginning inventory + purchases − ending inventory
Did we solve your problem today?

What COGS Stands For

COGS stands for cost of goods sold. It represents the direct costs tied to producing or purchasing the products a business sells during a period.

For product-based businesses, COGS is commonly calculated using inventory accounting: start with beginning inventory, add purchases (or production costs), and subtract ending inventory.

Knowing how to calculate COGS matters because it impacts gross profit, margins, pricing decisions, and budgeting.

Cost of Goods Sold Calculation Formula

The classic inventory-based formula calculates the cost of goods sold using beginning inventory, purchases, and ending inventory.

COGS formula =
COGS = Beginning Inventory + Purchases Ending Inventory

All values should be from the same accounting period.

COGS percentage (gross cost rate) =
COGS % = (COGS / Revenue) × 100

Use this if you want to calculate COGS percentage (requires revenue).

Cost of goods sold calculation example
Beginning = $12,000; Purchases = $45,000; Ending = $10,000 → COGS = 12,000 + 45,000 − 10,000 = $47,000

This is the standard “calculate the cost of goods sold” workflow.

Quick sanity check
COGS should usually be ≥ 0

If COGS is negative, it often indicates incorrect inputs (like purchases recorded as negative, or ending inventory higher than beginning + purchases due to adjustments).

How to Calculate COGS

  1. 1

    Enter beginning inventory (inventory value at the start of the period).

  2. 2

    Enter purchases (total inventory purchases or production costs added during the period).

  3. 3

    Enter ending inventory (inventory value at the end of the period).

  4. 4

    The calculator computes COGS = beginning inventory + purchases − ending inventory.

Frequently Asked Questions

How to calculate COGS from inventory?

Use the inventory formula: COGS = Beginning Inventory + Purchases − Ending Inventory.

What is the cost of goods sold calculation formula?

The standard formula is COGS = Beginning Inventory + Purchases − Ending Inventory.

How to calculate COGS in Excel?

If Beginning is in A1, Purchases in B1, and Ending in C1, use: =A1+B1-C1. For COGS percentage, if Revenue is in D1, use: =(A1+B1-C1)/D1 and format as a percentage.

Can COGS be negative?

In most normal cases, COGS should not be negative. A negative result can happen if ending inventory is greater than beginning inventory plus purchases (or if inputs include negatives). That may reflect data entry issues or inventory/accounting adjustments that need review.

What is a cost of goods sold budget formula?

Many budgets use the same structure: estimated COGS = beginning inventory + planned purchases − projected ending inventory. You may also forecast COGS using expected unit costs and expected units sold.

What is cost of goods sold per unit formula?

A common approach is: COGS per unit = Total COGS ÷ Units sold (for the period). This requires knowing how many units were sold.

How do I calculate COGS percentage?

COGS % = (COGS ÷ Revenue) × 100. You need revenue (sales) for the same period.