Module 04 · Inventory and Cost Management

Cost of Goods Sold (COGS) Explained, With Formula

COGS is opening inventory plus purchases minus closing inventory, and your costing method (FIFO or average) decides which purchase prices end up in it.

5 min readLesson 7 of 13 in this moduleUpdated 2026-08-25

The cost of goods sold formula is opening inventory value, plus purchases made during the period, minus closing inventory value. That single calculation tells you the true direct cost of everything you actually sold — not what you spent on suppliers, and not what's still sitting on the shelf. Get it wrong, and gross profit is wrong too, even if every other number in your books is perfect.

Cost of goods sold (COGS) is calculated as opening inventory value plus purchases made during the period, minus closing inventory value. It represents the direct cost of the products a business actually sold, and subtracting it from revenue gives gross profit — the clearest measure of core buying-and-selling profitability.

This lesson looks at COGS through inventory and costing: how the method you choose moves cost between COGS and closing inventory. For the step-by-step calculation, including from an income statement, from a trial balance and for retail, see how to calculate cost of goods sold.

Key takeaways

  • COGS = Opening inventory + Purchases − Closing inventory. It measures what you sold, not what you bought or what you still hold.
  • COGS includes only direct costs — the goods themselves and directly attributable costs like inbound freight — not rent, marketing, or admin salaries.
  • Revenue minus COGS is gross profit, the number that shows whether your core buying-and-selling activity is profitable before overhead is even considered.
  • COGS is only as accurate as your inventory records. A stock count that's drifted from reality quietly produces a wrong COGS, even with perfect purchase records.
  • Your costing method (FIFO or average cost) decides which purchase prices land in COGS versus stay in closing inventory when prices move.

What cost of goods sold actually measures

COGS is the direct cost of the products a business sold during a specific period — a month, a quarter, a year. It is not the same thing as how much you spent buying stock during that period, and it's not the same as your total expenses.

The reason those three numbers differ is timing. You might buy $10,000 of stock in March but sell only $7,000 worth of it — the rest is still sitting in inventory at month-end, and it isn't part of March's COGS yet. The formula exists precisely to separate what you spent from what you sold.

The cost of goods sold formula

COGS = Opening inventory + Purchases − Closing inventory

The cost of goods sold formula

Read it as a flow. Opening inventory is what you had on hand at the start of the period. Add everything purchased during the period, and you get the total value of goods available for sale. Subtract whatever is still unsold at the end — closing inventory — and what's left is the cost of what actually left the building as a sale.

What's included in COGS, and what isn't

COGS is limited to direct costs — the ones tied specifically to the products sold:

  • The purchase price (for a retailer or wholesaler) or manufacturing cost (for a producer) of the goods.
  • Directly attributable costs like inbound freight to get the goods into stock.

It excludes indirect operating costs, which are recorded separately as operating expenses further down the income statement: rent, marketing, office salaries, insurance, and similar overhead. A business selling $1,000 of product that cost $600 to buy or make has a $600 COGS regardless of how much it spent that month on advertising or the shop lease.

A worked example

Cedar Grove Wholesale sells reusable water bottles to smaller retailers. Here's January.

Component Amount
Opening inventory (1 January) $18,400
Purchases during January $32,600
= Goods available for sale $51,000
Closing inventory (31 January) $21,000
= Cost of goods sold $30,000

COGS = $18,400 + $32,600 − $21,000 = $30,000.

If January's revenue was $52,000, gross profit is $52,000 − $30,000 = $22,000, a gross margin of $22,000 ÷ $52,000 = 42.3%. Every dollar of that COGS figure depends on the $18,400 and $21,000 inventory values being accurate — which is exactly why a physical stock count matters so much to a number that looks, on the surface, like a purchasing calculation.

Bad stock counts wreck COGS even with perfect purchase records

If closing inventory is overstated — say, because stock that was actually stolen or damaged is still counted as on-hand — COGS comes out understated, and gross profit looks better than it really is. The formula has no way to catch that on its own; only an accurate count does. It's one of the common inventory and costing mistakes that quietly distorts a business's real profitability.

How your costing method changes the COGS number

The formula tells you what to calculate, but not which specific purchase price to use when the same product was bought at different prices during the period. That's decided by your costing method — typically FIFO (first-in, first-out) or average cost. FIFO vs average costing, with a worked example shows exactly how the same set of purchases and sales produces a different COGS figure depending on which method you use. Neither method changes how much cash the business actually made — only how that same total is split between COGS and the value left in inventory.

A quick example. A product starts the month with 100 units at $10 each ($1,000). You then buy 100 more units at $12 each ($1,200) and sell 120 units. Goods available for sale cost $2,200 in total. Costed two ways:

Method COGS (120 units sold) Closing inventory (80 units)
FIFO: 100 × $10 + 20 × $12 $1,240 $960 (80 × $12)
Average cost: $2,200 ÷ 200 units = $11 per unit $1,320 (120 × $11) $880 (80 × $11)

Both methods account for the same $2,200 of cost; they only split it differently between COGS and closing inventory. Because prices rose, FIFO charges the older, cheaper units to COGS first, so COGS is $80 lower and gross profit $80 higher than under average cost. If prices had fallen the effect would reverse, and if every unit cost the same the two methods would agree. (The example assumes both purchases arrive before the sale.)

For a manufactured product rather than a bought-and-resold one, the "purchase price" in the formula is replaced by the manufacturing cost per unit, which a bill of materials is built to calculate properly — materials, labor, and overhead, not just the raw ingredients.

Why COGS matters more than it looks like it should

COGS determines gross profit, and gross profit is the first real signal of whether the core of the business — buying or making something, then selling it for more — actually works, before rent, wages, and every other overhead cost even enters the picture. Two businesses with identical revenue can have very different gross profit if one has sloppy inventory records inflating or understating COGS.

It's also a number lenders, investors, and your own income statement rely on directly — everything from pricing decisions to gross margin analysis starts from an accurate COGS figure. A "good" COGS percentage varies enormously by industry (retail often runs 50–65% of sales; food and beverage businesses often target closer to 28–35% for food cost specifically), so tracking your own number consistently, using the same terms defined in the inventory and costing glossary, matters more than chasing a generic benchmark.

Doing this in Reyuko

Every Reyuko Invoice posts cost of goods sold automatically the moment you record a sale — debiting COGS and crediting Inventory alongside the revenue and tax entries, using whichever costing method (Average, FIFO, or LIFO) you've set on that product. You don't calculate COGS by hand at month-end from a separate spreadsheet: it's built into every sale as it happens.

The Income Statement report, under Reporting, is generated live from the ledger, so gross profit — revenue minus that same COGS — is already sitting there whenever you check it, rather than something you reconstruct at period-end. Because it's live, it reflects a stock opname adjustment the moment you post one, instead of waiting for a manual recalculation.

Product catalog, sales, inventory, and core reporting including the Income Statement are all in Reyuko's free edition — none of this depends on a paid plan.

Check yourself: calculate this month's COGS

A café supply shop starts the month with $9,200 of inventory, buys $14,300 more during the month, and counts $8,100 remaining at month-end. What's COGS?

Answer: $9,200 + $14,300 − $8,100 = $15,400.

Keep going: the module Inventory Accounting and COGS in Practice covers a full COGS worked example from purchase invoice to gross profit, when FIFO vs average cost actually matters for a growing retailer and inventory accounting journal entries for purchases, sales and returns.

Frequently asked questions

What is the formula for cost of goods sold?

COGS equals opening inventory value, plus purchases made during the period, minus closing inventory value. This formula works because it captures the total cost of everything available for sale during the period, then subtracts whatever is still sitting in stock unsold at the end.

What is included in cost of goods sold?

COGS includes the direct cost of the products or materials sold — purchase price or manufacturing cost, plus directly attributable costs like inbound freight. It excludes indirect operating costs such as rent, marketing, or admin salaries, which are recorded separately as operating expenses instead.

Is cost of goods sold the same as expenses?

No. COGS is specifically the direct cost of the goods a business sold during a period, while expenses is the broader category covering everything else it costs to run the business, like rent, wages, and utilities. COGS sits above operating expenses on an income statement and directly determines gross profit.

Why is COGS important for a small business?

COGS determines gross profit — revenue minus COGS — which shows whether a business's core buying and selling activity is actually profitable before overhead is even considered. An inaccurate COGS, often from bad inventory records, can make a business look profitable or unprofitable when the reality is different.

What is a good COGS percentage?

It varies enormously by industry — retail often runs COGS around 50 to 65 percent of sales, while food and beverage businesses often target closer to 28 to 35 percent for food cost specifically. What matters more than hitting a benchmark is knowing your own number and tracking it consistently over time.

How does inventory costing method affect COGS?

The costing method (FIFO or average cost) determines which purchase prices get counted in COGS versus left in ending inventory when prices have changed over the period. Two businesses with identical stock movements can report different COGS figures purely because they use different costing methods.

Does a stock count actually change my COGS figure?

Yes, directly. Closing inventory is one of the three terms in the formula, so if a physical count finds less stock than the books show, closing inventory drops and COGS rises by the same amount — the write-down effectively becomes part of that period's cost of goods sold.

When does FIFO give a different COGS than average costing?

Only when the purchase price of a product changed during the period. If every unit cost the same, both methods give the same COGS. When prices rise, FIFO charges the older, cheaper units to COGS first, so COGS is lower and gross profit higher than under average cost; when prices fall, the effect reverses. In the example above, FIFO gives $1,240 against $1,320 for average cost, while the total cost of $2,200 is the same either way.

Does FIFO save a growing retailer money compared with average costing?

Not in cash terms. FIFO and average costing split the same purchase cost between COGS and closing inventory, so neither changes what you pay suppliers. When supplier prices are rising, FIFO reports a lower COGS and a higher gross profit than average costing, which can mean more profit to report, and where profit is taxed more tax, in that period. Check which methods your tax authority accepts before choosing.

Let COGS post itself from every sale

Every Reyuko Invoice posts cost of goods sold automatically using your chosen costing method, so your Income Statement reflects it live — free in every plan.

Download Reyuko freeSee what's included