What this calculator does
Cost of goods sold is the direct cost of the inventory a business actually sold during a period, as opposed to inventory still sitting on the shelf. It is a core line on an income statement, sitting directly below revenue and above gross profit.
The COGS formula works from three inventory figures rather than tracking every individual sale: what stock was on hand at the start of the period, what was bought during it, and what was left at the end. Whatever is not left over must have been sold, which is the logic behind the calculation.
The formula
Add beginning inventory to purchases made during the period to get the total goods available for sale. Subtract ending inventory, the stock still on hand, and what remains is the cost of what was sold.
| Term | Meaning |
|---|---|
| Beginning inventory | The value of stock on hand at the start of the period, at cost. |
| Purchases | The cost of additional stock bought or manufactured during the period. |
| Ending inventory | The value of stock still on hand at the end of the period, at cost. |
| COGS | Cost of goods sold: beginning inventory + purchases − ending inventory. |
The inputs explained
| Field | What to enter |
|---|---|
| Beginning inventory value ($) | The value of inventory on hand at the start of the period, valued at cost, not selling price. |
| Purchases during the period ($) | The cost of inventory purchased or produced during the period. |
| Ending inventory value ($) | The value of inventory still on hand at the end of the period, valued at cost. |
When to use it
Preparing an income statement
COGS is subtracted from revenue to arrive at gross profit, so it needs to be worked out before gross margin or gross profit can be reported for the period.
Checking inventory shrinkage
A COGS figure that looks unusually high relative to sales can point to stock loss, theft or write-offs being absorbed into the cost of goods sold rather than tracked separately.
Comparing periods with different purchasing patterns
A business that bought heavily ahead of a busy season will show a larger goods-available-for-sale figure even before any of it is sold, which COGS by itself does not distinguish from actual sales volume.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How COGS changes as ending inventory rises, at fixed beginning inventory and purchases
A fixed $40,000 beginning inventory and $120,000 in purchases, across a range of ending inventory values.
| Ending inventory | Cost of goods sold | Goods available for sale |
|---|---|---|
| $20,000 | $140,000.00 | $160,000.00 |
| $30,000 | $130,000.00 | $160,000.00 |
| $35,000 | $125,000.00 | $160,000.00 |
| $40,000 | $120,000.00 | $160,000.00 |
| $50,000 | $110,000.00 | $160,000.00 |
| $60,000 | $100,000.00 | $160,000.00 |
How COGS changes as purchases rise, at fixed beginning and ending inventory
A fixed $35,000 ending inventory, across a range of purchase totals.
| Purchases during the period | Cost of goods sold | Goods available for sale |
|---|---|---|
| $80,000 | $85,000.00 | $120,000.00 |
| $100,000 | $105,000.00 | $140,000.00 |
| $120,000 | $125,000.00 | $160,000.00 |
| $140,000 | $145,000.00 | $180,000.00 |
| $160,000 | $165,000.00 | $200,000.00 |
| $200,000 | $205,000.00 | $240,000.00 |
Questions
Is COGS the same as total expenses?
No. COGS only covers the direct cost of the inventory sold, such as the wholesale or production cost of goods. Operating expenses like rent, wages and marketing sit further down the income statement and are not part of COGS.
Should inventory be valued at cost or at selling price?
At cost. Beginning inventory, purchases and ending inventory should all be valued at what it cost the business to acquire or produce the stock, not what it sells for, otherwise the COGS figure will be distorted.
What does it mean if COGS comes out negative?
A negative result means ending inventory is larger than beginning inventory plus purchases, which normally signals an input error, such as double-counting stock or mixing up the beginning and ending figures, rather than a real business outcome.
How does COGS relate to gross margin?
Gross profit is revenue minus COGS, and gross margin expresses that profit as a percentage of revenue. COGS is therefore the starting input for both figures; see the margin calculator to take that next step.
Once COGS is known, the margin calculator turns cost and selling price into a gross margin percentage. For the share of revenue left after running costs as well, see the operating margin calculator.