Accounting
Cost of goods sold, step by step.
Enter your inventory and cost lines for the period. Add revenue to see gross profit and gross margin.
COGS = beginning inventory + purchases + labor + materials + other costs - ending inventory. $10,000 + $50,000 + $2,000 - $12,000 = $50,000 of cost of goods sold.
Your numbers
Result
Worked example
Start the year with $10,000 of inventory, buy $50,000 more and pay $2,000 of freight-in. Goods available for sale are $62,000.00. If $12,000 is still on the shelf at year end, cost of goods sold is $50,000.00. With $80,000 of revenue, gross profit is $30,000.00 and gross margin is 37.50%.
How it works
COGS is the cost of the goods you actually sold, so unsold stock stays out of it. The structure follows the cost of goods sold section of IRS Publication 334, Tax Guide for Small Business (Schedule C lines 35 to 42): inventory at beginning of year, plus purchases, cost of labor, materials and supplies and other costs, then subtract inventory at end of year. Its "other costs" include freight-in and containers. Ending inventory is a number you supply, from a count and your valuation method; this calculator does not value inventory, apply FIFO or LIFO, or file anything. Service businesses without inventory have no COGS under this definition.
Source: IRS Publication 334, Tax Guide for Small Business, "Cost of Goods Sold" (irs.gov/publications/p334, retrieved 2026-10). Rules for inventory valuation and what counts as a cost differ by country and business type, so confirm yours with your accountant or tax authority.
Everything runs in your browser. Nothing you type is sent or stored.
Quick reference table
| COGS as a share of revenue | Gross margin | Revenue per $1 of COGS |
|---|---|---|
| 10% | 90.00% | $10.00 |
| 20% | 80.00% | $5.00 |
| 30% | 70.00% | $3.33 |
| 40% | 60.00% | $2.50 |
| 50% | 50.00% | $2.00 |
| 60% | 40.00% | $1.67 |
| 70% | 30.00% | $1.43 |
| 80% | 20.00% | $1.25 |
| 90% | 10.00% | $1.11 |
| 95% | 5.00% | $1.05 |
Common mistakes
- Putting the cost of everything you bought into COGS. Goods still in stock at period end are inventory, not yet an expense.
- Mixing selling prices into inventory. Beginning and ending inventory are valued at cost, not at the price you plan to charge.
- Counting selling and administrative costs, such as ads and rent for an office, as COGS.
- Leaving out freight-in. The cost of getting goods to you is part of what they cost.
FAQ
What is the COGS formula?
Beginning inventory plus purchases and other production costs during the period, minus ending inventory.
Is COGS the same as cost of sales?
The terms are often used interchangeably for businesses that sell products. For a service business, cost of services or cost of revenue is the closer idea.
What is included in COGS?
The cost of the goods sold: purchases or materials, direct labor, and costs such as freight-in and containers. Overhead can be included for manufacturers under the method you use.
How do I get gross margin from COGS?
Subtract COGS from revenue to get gross profit, then divide by revenue. $80,000 revenue and $50,000 COGS is a 37.5% gross margin.