COGS calculator: cost of goods sold and cost per unit in one place
This COGS calculator works out the cost of goods sold for a period from your opening inventory, purchases, freight and returns, and closing inventory. Add your net sales and it also gives gross profit, gross margin and COGS as a share of sales; add units sold and you get COGS per unit. It is the number that sits between sales and gross profit on an income statement.
Switch to Cost per unit to find the full production cost of one item from direct materials, direct labour and manufacturing overhead, the usual answer to a cost of production calculator search. Enter a selling price to see profit per unit, margin and markup, and units sold to see the cost of the goods you sold and the value of what is left unsold.
How to use the COGS & Cost-per-Unit Calculator
- Choose Cost of goods sold or Cost per unit, and the currency.
- For COGS, enter opening inventory, purchases and closing inventory at cost; add freight in and returns if you have them.
- Optionally add net sales and units sold to see gross profit, margin and COGS per unit.
- For cost per unit, enter the materials, labour, overhead and units produced, plus a price if you want the profit per unit.
- Read the result, the table of steps or cost shares, and copy the summary.
COGS & Cost-per-Unit Calculator features
Standard COGS formula
Opening stock plus purchases and freight, minus returns and closing stock, shown step by step.
Gross profit and margin
Optional net sales turn COGS into gross profit, gross margin and COGS as a percentage of sales.
Full cost per unit
Materials, labour and overhead are added and divided by the units produced, with each cost’s share.
Profit per unit
Margin and markup at your selling price, and the value of unsold units when you enter units sold.
Sensible checks
Closing inventory above the goods available, or zero units produced, is flagged instead of giving a wrong answer.
The COGS formula with an example
COGS = opening inventory + purchases (+ freight in) − purchase returns and discounts − closing inventory. A shop starts the year with $25,000 of stock at cost, buys $80,000 more, pays $2,000 freight, returns $1,500 of goods and counts $30,000 on the last day. Goods available for sale were $105,500, so COGS is $105,500 − $30,000 = $75,500. With net sales of $150,000, gross profit is $74,500, a 49.7% gross margin.
COGS includes the purchase price and the costs of bringing goods to a saleable state. It excludes selling, marketing, rent of the shop and other operating expenses, which sit below gross profit. The period must be the same for opening stock, purchases, sales and closing stock.
| Line | Example |
|---|---|
| Opening inventory | $25,000 |
| + Purchases and freight | $82,000 |
| − Returns and discounts | $1,500 |
| − Closing inventory | $30,000 |
| = Cost of goods sold | $75,500 |
Cost per unit and its limits
Under absorption costing, cost per unit = (direct materials + direct labour + manufacturing overhead) ÷ units produced. For $12,000 of materials, $8,000 of labour and $5,000 of overhead over 2,500 units, each unit costs $10.00. Sold at $14, the profit is $4.00: a 28.6% margin of the price and a 40% markup on cost. Use the profit margin calculator and markup calculator to explore prices.
Limits: the unit cost depends on units produced, so it changes if volume does; fixed overhead is spread, not avoided. Valuation methods (FIFO, weighted average and others) change closing inventory and therefore COGS: see the stock register for stock valued both ways. How fast stock sells is shown by the inventory turnover calculator.
COGS & Cost-per-Unit Calculator FAQ
How do you calculate cost of goods sold?
Add purchases (and freight in) to opening inventory, subtract purchase returns and discounts, then subtract closing inventory. The result is COGS.
What is the formula for cost per unit?
Add direct materials, direct labour and manufacturing overhead, then divide by the number of units produced.
Is COGS the same as cost of sales?
Usually yes. Some businesses use “cost of sales” or “cost of revenue” for COGS plus the direct cost of services.
What is not included in COGS?
Selling and marketing costs, administration, rent of the shop and other operating expenses. They are deducted after gross profit.
How do I get gross profit from COGS?
Subtract COGS from net sales. Enter your net sales in the optional field and gross profit and gross margin appear.
Why can closing inventory not exceed goods available?
You cannot have more stock left than you started with plus what you bought. If it happens, an input or the stock count is wrong.
Is this accounting advice?
No. It applies the standard formulas to your numbers; valuation rules and tax treatment depend on your country and your accountant.