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.
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.
All values should be from the same accounting period.
Use this if you want to calculate COGS percentage (requires revenue).
This is the standard “calculate the cost of goods sold” workflow.
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
Enter beginning inventory (inventory value at the start of the period).
- 2
Enter purchases (total inventory purchases or production costs added during the period).
- 3
Enter ending inventory (inventory value at the end of the period).
- 4
The calculator computes COGS = beginning inventory + purchases − ending inventory.
Frequently Asked Questions
Use the inventory formula: COGS = Beginning Inventory + Purchases − Ending Inventory.
The standard formula is COGS = Beginning Inventory + Purchases − Ending Inventory.
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.
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.
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.
A common approach is: COGS per unit = Total COGS ÷ Units sold (for the period). This requires knowing how many units were sold.
COGS % = (COGS ÷ Revenue) × 100. You need revenue (sales) for the same period.