Cost of Goods Sold (COGS) Calculator

Cost of goods sold is the cost of the inventory you sold in the period, and goods available for sale shows what you had to sell. $80,000 plus $420,000 of purchases is $500,000 available, and with $95,000 left at the end the cost of goods sold is $405,000. It feeds gross profit and gross margin, so mistakes in the ending count flow straight into reported profit.

Cost of Goods Sold (COGS) Calculator: inputs

Calculated result
Cost of goods sold$405,000
Goods available for sale$500,000

Cost of Goods Sold (COGS) Calculator: Beginning inventory sensitivity

Cost of Goods Sold (COGS) Calculator: Beginning inventory and Cost of goods sold5 calculations vary the “Beginning inventory” input while holding the other entered inputs constant.$64,000$389,000$72,000$397,000$80,000$405,000$88,000$413,000$96,000$421,000

Cost of Goods Sold (COGS): worked example

Beginning inventory$80,000
Purchases during the period$420,000
Ending inventory$95,000
Cost of goods sold$405,000
Goods available for sale$500,000

Cost of Goods Sold (COGS): formula

COGS = beginning inventory + purchases − ending inventory

OpenStax Managerial Accounting: inventory cost flows

Common error: Using purchases alone as the cost of sales. Anything still unsold at year end is an asset, and counting it as a cost understates profit.

Beginning inventory is opening stock value. Purchases cover the period and include freight-in. Ending inventory is the closing stock value.

A physical count or perpetual records supply that figure. The method you use to value inventory, such as first-in first-out or average cost, affects the result, so use the method you use for your books and tax return consistently.

Cost of Goods Sold (COGS): changing Beginning inventory

Beginning inventoryCost of goods soldGoods available for sale
$64,000$389,000$484,000
$72,000$397,000$492,000
$80,000 (example)$405,000$500,000
$88,000$413,000$508,000
$96,000$421,000$516,000

Cost of Goods Sold (COGS): compare input ranges

InputTested fromToCost of goods sold: low inputCost of goods sold: high inputSwing
Purchases during the period$378,000$462,000$363,000$447,000$84,000 (21%)
Ending inventory$85,500$104,500$414,500$395,500$19,000 (4.7%)
Beginning inventory$72,000$88,000$397,000$413,000$16,000 (4.0%)

Cost of Goods Sold (COGS): individual input comparisons

InputValueCost of goods soldGoods available for sale
Beginning inventory$64,000$389,000$484,000
$72,000$397,000$492,000
$80,000$405,000$500,000
$88,000$413,000$508,000
$96,000$421,000$516,000
Purchases during the period$336,000$321,000$416,000
$378,000$363,000$458,000
$420,000$405,000$500,000
$462,000$447,000$542,000
$504,000$489,000$584,000
Ending inventory$76,000$424,000$500,000
$85,500$414,500$500,000
$95,000$405,000$500,000
$104,500$395,500$500,000
$114,000$386,000$500,000

Cost of Goods Sold (COGS): combined input changes

Beginning inventory / Purchases during the period$336,000$420,000$504,000
$64,000$305,000$389,000$473,000
$72,000$313,000$397,000$481,000
$80,000$321,000$405,000$489,000
$88,000$329,000$413,000$497,000
$96,000$337,000$421,000$505,000

Cost of Goods Sold (COGS): which assumptions move the result?

Cost of Goods Sold (COGS): Cost of goods sold as Purchases during the period changesCost of goods sold starts at $321,000. Moving Purchases during the period from $336,000 to $504,000 changes it to $489,000, with Beginning inventory $80,000; Ending inventory $95,000 kept fixed.$336,000$321,000$378,000$363,000$420,000$405,000$462,000$447,000$504,000$489,000
Chart quantityDisplayed settings
Purchases during the period$336,000 → $504,000
Cost of goods sold$321,000 → $489,000
Beginning inventory$80,000
Ending inventory$95,000
Cost of Goods Sold (COGS): Cost of goods sold as Ending inventory changesCost of goods sold starts at $424,000. Moving Ending inventory from $76,000 to $114,000 changes it to $386,000, with Beginning inventory $80,000; Purchases during the period $420,000 kept fixed.$76,000$424,000$85,500$414,500$95,000$405,000$104,500$395,500$114,000$386,000
Chart quantityDisplayed settings
Ending inventory$76,000 → $114,000
Cost of goods sold$424,000 → $386,000
Beginning inventory$80,000
Purchases during the period$420,000

Cost of Goods Sold (COGS): values and definitions

Quantity and definitionValue used
Beginning inventory$80,000
Purchases during the period$420,000
Ending inventory$95,000
Cost of goods sold$405,000
Goods available for sale$500,000

Cost of Goods Sold (COGS): half and double Purchases during the period

Purchases during the periodCost of goods sold
$210,000$195,000
$420,000$405,000
$840,000$825,000

The formula assumes the ending count is accurate, and errors, shrinkage and theft show up as higher cost of goods sold. Inventory valuation methods differ when prices change, with first-in first-out showing higher profit in inflation and last-in first-out lower. Service businesses do not have inventory, and their direct labor is used instead.

Business Finance calculators: DuPont Analysis Calculator, Employee Turnover Rate Calculator, Net Promoter Score Calculator, Marketing Metrics Calculator, Sum-of-the-Years'-Digits Depreciation Calculator, Units of Production Depreciation Calculator.

Cost of goods sold is the cost of what you sold, not of what you bought. Start with the inventory you had, add what you purchased, and subtract what is still on the shelf. The goods-available-for-sale subtotal is $500,000 in the worked example.

Count the ending inventory at the same valuation method as the beginning. Switching between methods mid-year shifts COGS without any real change in cost.

Use the result in the gross profit and gross margin calculators, and the inventory turnover page to see how fast stock moves. The inventory carrying cost and reorder point calculators help manage stock levels. Do a physical count at least once a year to keep the numbers honest.

What is included in cost of goods sold?

Beginning inventory plus purchases and direct costs, minus ending inventory. It covers materials, direct labor and freight-in, but not selling or administrative expenses.

Why does the ending inventory count matter so much?

Because it is subtracted from goods available for sale, an overcount lowers COGS and raises profit, while an undercount does the opposite.

Which inventory method should I use?

The one you can apply consistently and that your tax rules allow. First-in first-out is common, and switching methods requires IRS approval.