COGS Calculator
Calculate cost of goods sold and gross margin for a period — the periodic inventory method.
COGS = Beginning Inventory + Purchases − Ending Inventory
Gross Margin % = (Revenue − COGS) / Revenue
COGS
$35,000.00
Gross Margin
—
What COGS is for a manufacturer
Cost of goods sold (COGS) is the total cost of the inventory you actually sold during a period — raw materials, components, and production costs that ended up in finished goods that left the door. It's the direct input into gross margin, and it's what makes a sale price meaningful: without knowing true COGS, "profitable" is a guess.
The periodic formula vs. perpetual tracking
This calculator uses the periodic method — the simplest way to estimate COGS for a stretch of time using only three numbers:
COGS = Beginning Inventory + Purchases − Ending Inventory
It's quick, but it's only a period-end snapshot — it can't tell you which product, batch, or production run actually drove the cost. Perpetual tracking calculates COGS continuously as each unit moves through raw materials, production, and sale, giving you real-time, per-SKU accuracy instead of a monthly estimate.
Worked example
Say you started the month with $50,000 of inventory, purchased $30,000 more in raw materials during the month, and ended the month with $45,000 of inventory on hand:
COGS = $50,000 + $30,000 − $45,000 = $35,000
If revenue for the month was $80,000, gross margin would be (80,000 − 35,000) / 80,000 = 56.25%.
Frequently asked questions
What counts as "purchases" in the COGS formula?
Purchases are the cost of all inventory (raw materials, components, or finished goods) acquired during the period — including freight and other costs to get materials ready for use. For a manufacturer, this typically also includes direct production costs like labor and overhead allocated to goods made in the period, if you are tracking a full manufacturing COGS rather than a simple merchandise COGS.
Why does my COGS look wrong compared to what I expected?
The most common causes are untracked waste or shrinkage (material that left inventory but wasn't sold or properly recorded), production runs that weren't deducted from raw material stock, or inventory counts that don't reflect what's actually on the shelf. A periodic formula like this one is only as accurate as your beginning and ending inventory counts.
What is the difference between periodic and perpetual COGS tracking?
Periodic tracking (what this calculator does) recalculates COGS at the end of a period from beginning inventory, purchases, and ending inventory — it's simple but only as accurate as your last physical count. Perpetual tracking updates COGS in real time as each transaction happens. Nstock tracks COGS perpetually per production run and per sale, using FIFO lot costing, so the number is always current instead of a period-end estimate.
Get real-time COGS, not month-end estimates
Nstock tracks COGS perpetually per production run using FIFO lot costing, so margin is always current — on every sales quote, not just at period close.



