The inventory equation
Cost of goods sold formula
For a business that carries inventory, cost of goods sold represents the cost assigned to inventory sold during the selected period. Begin with inventory already on hand, add net purchases and applicable costs, then subtract inventory still on hand at the end.
Net purchasesPurchases − returns and allowances − purchase discounts
Goods availableBeginning inventory + net purchases + applicable costs
COGSCost of goods available − ending inventory
The sequence follows IRS Publication 334, which reproduces Schedule C lines for beginning inventory, purchases, labor, materials, other costs, ending inventory and cost of goods sold.
Use one consistent period
What numbers should you enter?
- Beginning inventory: inventory cost on the first day of the month, quarter or year.
- Purchases: merchandise or raw materials acquired for resale or production during that same period.
- Purchase reductions: returns, allowances and discounts that reduce purchase cost under the accounting method used.
- Freight-in: transportation or similar acquisition charges associated with bringing purchased inventory in.
- Production costs: direct labor, materials, supplies and other costs properly assigned to manufactured inventory.
- Ending inventory: the cost assigned to inventory remaining at the end of the same period.
Do not combine annual purchases with monthly inventory balances. Every input must describe the same accounting period and use the same valuation basis.
Retailer or manufacturer
Which additional costs belong in COGS?
A reseller may need only inventory, net purchases and freight-in. A manufacturer can also have direct labor, raw materials, work in process and production overhead assigned to inventory. General marketing, administration and unrelated operating expenses do not become COGS merely because the calculator has an “other” field.
The IRS explains that purchased inventory cost generally starts with invoice price after appropriate discounts plus transportation and other acquisition charges. Produced inventory can also include direct and indirect costs that must be capitalized. Review IRS Publication 538 or obtain accounting advice when classification is uncertain.
Worked example
$76,000 of COGS from a simple retail period
A retailer starts with $25,000 of inventory, buys $80,000, records $2,000 of returns, $1,000 of purchase discounts and $4,000 of freight-in, then counts $30,000 of ending inventory.
With $150,000 of net sales, gross profit is $74,000 and gross margin is about 49.33%. Those profit figures are optional outputs; the inventory equation still works when sales are left at zero.
Avoid a common mix-up
COGS is not the same as purchases
Purchases measure inventory acquired during the period. COGS measures the inventory cost associated with what was sold. When ending inventory rises, some purchase cost remains on the balance sheet instead of becoming expense immediately. When inventory falls, COGS can exceed current-period net purchases because beginning inventory was also sold.
A physical count, inventory system or documented estimate determines ending inventory. This calculator cannot infer that balance from revenue.
From COGS to margin
Calculate gross profit and gross margin
Gross profit equals net sales minus COGS. Gross margin divides that gross profit by net sales. These measures stop before selling, administrative, interest and income-tax expenses, so they should not be treated as net profit.
Gross profitNet sales − cost of goods sold
Gross marginGross profit ÷ net sales × 100
COGS rateCost of goods sold ÷ net sales × 100
Educational calculation tool, not accounting or tax advice. Inventory valuation, capitalization and reporting requirements depend on the entity and accounting method.