Cost of Goods Sold (COGS) Calculator
Calculate cost of goods sold from beginning inventory, purchases, and ending inventory, plus gross profit and margin if you enter revenue.
Built by Toolsque Team · last updated October 2, 2026 · checked against our testing process
Your inventory
Result
COGS = Beginning Inventory + Purchases − Ending Inventory. It only counts the direct cost of what was actually sold in the period, not what is still sitting on the shelf. Rent, marketing, and admin salaries are operating expenses, not part of COGS.
Related: break-even point calculator · all finance calculators
How to use the cost of goods sold calculator
- Enter beginning inventory: the dollar value of inventory you had on hand at the start of the period, straight from your last balance sheet or count.
- Enter purchases: inventory bought during the period, or total manufacturing costs incurred if you make what you sell.
- Enter ending inventory: the value of what's still unsold at period end, from a physical count or your inventory system.
- Add revenue (optional): total sales for the same period. This unlocks gross profit and gross margin alongside COGS.
- Read the result: COGS is what it cost you to produce or acquire everything you actually sold, not everything you bought.
Cost of goods sold calculator: the formula behind the number
This cost of goods sold calculator runs the standard formula: beginning inventory plus purchases minus ending inventory. Beginning inventory is what you had on hand when the period started, already paid for and sitting on shelves or in a warehouse. Purchases are what you bought or produced during the period: new stock, raw materials, or the direct cost of manufacturing. Ending inventory is what's left unsold when the period closes. Subtracting ending inventory from the first two numbers strips out everything still sitting in stock, leaving only the cost of what actually left the building as a sale. That's the point of COGS: it doesn't care what you own, only what you sold.
What counts as COGS and what doesn't
COGS covers the direct costs of the product itself: materials, direct labor to make or acquire it, and freight-in to get inventory to you. It does not include rent, marketing, admin salaries, insurance, or any other expense that keeps the business running but isn't tied to a specific unit sold. Those are operating expenses, and they get their own line further down the income statement. Mixing the two categories together is the fastest way to make a healthy-looking product turn into a loser on paper, or vice versa.
Worked example: a quarter for a small retailer
A small retailer starts the quarter with $40,000 in inventory. Over the next three months they buy $65,000 in new stock. At quarter-end, a physical count shows $35,000 still on the shelves. COGS = $40,000 + $65,000 − $35,000 = $70,000. If the store recorded $110,000 in revenue over that same quarter, gross profit is $110,000 − $70,000 = $40,000, and gross margin is $40,000 ÷ $110,000, about 36%. That margin is the number worth tracking quarter over quarter: a falling margin on flat sales usually means rising supplier costs or shrinkage that's getting written off as sold.
Why COGS matters beyond the bookkeeping
COGS is the input to gross profit and gross margin, which is how you tell whether the core business of buying or making a thing and selling it for more is actually working, before rent and payroll even enter the picture. It also directly affects taxable income: a higher COGS means lower reported profit and a smaller tax bill, which is why the IRS cares how it's calculated. One wrinkle worth knowing: the inventory valuation method you use, FIFO, LIFO, or weighted average, can produce a different COGS figure from identical physical inventory, especially when costs are rising or falling. That's a separate decision from the formula itself, and one worth a conversation with an accountant rather than guessing.
A common mistake is folding in costs that don't belong: owner's draw, general overhead, or office expenses getting counted as if they were part of what it costs to produce the product. That inflates COGS, shrinks the apparent margin, and makes a perfectly fine product look like it's barely breaking even. Keep COGS to direct product costs only, and let operating expenses live where they belong.
Related tools
Once you know your margin, the next question is usually how much volume you need to cover fixed costs: the break-even point calculator answers that with your COGS and margin numbers plugged in. For more financial planning tools, see all finance calculators.
How this calculator works
COGS = beginning inventory + purchases − ending inventoryGross profit = revenue − COGSGross margin = gross profit ÷ revenueFrequently Asked Questions
What is the formula for cost of goods sold?
COGS = beginning inventory + purchases − ending inventory. It measures the cost of what you actually sold during a period, not everything you bought or made.
Does COGS include labor?
Only direct labor tied to producing or acquiring the product counts, like a factory worker on the line or staff time spent prepping inventory for sale. Salaries for admin, sales, or management staff are operating expenses, not COGS.
What's the difference between COGS and operating expenses?
COGS is the direct cost of the product itself: materials, direct labor, freight-in. Operating expenses are everything else that keeps the business running, like rent, marketing, and admin salaries, and they sit on a separate line of the income statement.
Why would COGS change if my inventory count stayed the same?
The inventory valuation method you use, FIFO, LIFO, or weighted average, assigns different costs to the same physical units, especially when purchase prices moved during the period. Switching methods can shift your COGS figure without a single unit changing hands.
Can I include shipping in COGS?
Freight-in, the cost of getting inventory to you, belongs in COGS. Freight-out, the cost of shipping a sold product to your customer, is usually treated as a separate selling expense, not COGS.
Does COGS affect my taxes?
Yes. A higher COGS lowers reported gross profit, which lowers taxable income. That's part of why the IRS cares which inventory valuation method you use and expects it applied consistently year to year.
What's a common mistake when calculating COGS?
Folding in costs that aren't direct product costs, like owner's draw or general overhead. That inflates COGS, shrinks your apparent gross margin, and makes a healthy product look like it's barely profitable.
