Module 04 · Profit & Profitability

How to Calculate Cost of Goods Sold (COGS) for Your Business

COGS formula: opening inventory + purchases − closing inventory, e.g. $12,000 + $30,000 − $8,000 = $34,000. Covers retail and the income statement.

6 min readLesson 3 of 14 in this moduleUpdated 2026-11-17

The cost of goods sold (COGS) formula is COGS = opening inventory + purchases − closing inventory. For example, a shop that starts the month with $12,000 of stock, buys $30,000 more and counts $8,000 still unsold has COGS of $12,000 + $30,000 − $8,000 = $34,000.

Cost of Goods Sold (COGS) is the direct cost of whatever you actually sold during a period — not everything you spent money on, and not everything sitting on your shelves. Knowing how to calculate cost of goods sold correctly is the difference between a gross profit figure you can trust and one that's quietly wrong every single month.

Key takeaways

  • COGS = Opening Inventory + Purchases − Closing Inventory.
  • COGS only reflects stock that left the business as a sale during the period — unsold stock stays on the balance sheet as inventory, not as a cost.
  • Freight-in (the cost of getting purchased stock to you) is added to COGS. Rent, admin salaries, and marketing are not COGS at all — they're operating expenses.
  • Service businesses without physical inventory often use "cost of service" instead, covering direct labor and materials tied to delivering the service.
  • Get the inventory count wrong at either end of the period, and COGS — and therefore gross profit — is wrong too, even if every purchase was recorded correctly.

The COGS formula

COGS = Opening Inventory + Purchases − Closing Inventory

Cost of Goods Sold

Each term is a value taken at a point in time, not a running total:

  • Opening inventory — the value of stock on hand at the start of the period (which is last period's closing inventory).
  • Purchases — everything bought into stock during the period, plus freight-in (the cost of shipping that stock to you).
  • Closing inventory — the value of stock still on hand, unsold, at the end of the period.

The logic is straightforward once you see it: you start with what you had, add what you bought, and whatever isn't left over at the end must be what you sold. That's COGS.

A worked example

A small trading business starts the month with $12,000 of stock on the shelves. Over the month it buys $30,000 more inventory. At month-end, a physical count shows $8,000 of stock still unsold.

Component Amount
Opening inventory $12,000
+ Purchases $30,000
− Closing inventory ($8,000)
Cost of goods sold $34,000

Cost of Goods Sold (COGS) = Opening Inventory + Purchases − Closing Inventory. For example, a shop starts the month with $12,000 of stock, buys $30,000 more, and ends with $8,000 left unsold. COGS = $12,000 + $30,000 − $8,000 = $34,000 — the cost of what was actually sold that month, no more and no less.

If revenue for the same month was $54,000, gross profit is $54,000 − $34,000 = $20,000, a margin of 37%. Every part of that number depends on the closing inventory count being accurate — count it wrong by $2,000 in either direction, and COGS (and gross profit) is off by exactly $2,000 too.

An inventory count error is a profit error

COGS is only as reliable as your opening and closing inventory figures. If nobody physically checks what's on the shelf and the book figure is used instead, any shrinkage, breakage, or uncounted stock silently distorts COGS — and with it, every profit number built on top of it. A periodic stock count is what keeps this formula honest.

The COGS formula for manufacturers

A business that makes what it sells does not simply buy finished goods, so the inputs change. First work out the cost of goods manufactured (COGM), then use it in place of purchases:

COGM = Direct Materials + Direct Labor + Manufacturing Overhead + Opening Work-in-Progress − Closing Work-in-Progress

Cost of Goods Manufactured

COGS = Opening Finished Goods + COGM − Closing Finished Goods

Cost of Goods Sold for a manufacturer

For example, a workshop uses $18,000 of materials, pays $9,000 of production labor and carries $6,000 of factory overhead. Work-in-progress was $3,000 at the start of the month and $4,000 at the end, so COGM = $18,000 + $9,000 + $6,000 + $3,000 − $4,000 = $32,000. With $5,000 of finished goods at the start and $7,000 at the end, COGS = $5,000 + $32,000 − $7,000 = $30,000.

Which unit cost you place on closing stock also changes the answer; see FIFO vs average costing and COGS and inventory costing. Other business types are covered in what counts as COGS by industry.

What belongs in COGS — and what doesn't

The rule is simple to state and easy to get wrong in practice: COGS is the direct cost of producing or acquiring what was sold. Anything that would exist even if you sold nothing this month is an operating expense, not COGS. It's the same classification question covered in cost vs expense vs asset: inventory sits in the asset column until it sells, at which point its cost becomes COGS.

Included in COGS Not COGS (operating expense instead)
Purchase price of goods for resale Store or office rent
Freight-in (shipping stock to you) Admin and sales staff wages
Direct production labor and materials (manufacturers) Marketing and advertising
Packaging that ships with the product Loan interest
Direct production overhead tied to units made Software subscriptions, insurance, utilities

Mixing these two lists is one of the most common ways a business's gross profit ends up looking healthier than it really is: park an operating cost inside COGS by mistake, and gross margin understates itself; leave a genuine product cost out of COGS, and gross margin looks better than it should.

Not every business calls it COGS

A retailer or wholesaler with physical stock uses the formula above directly. A service business that holds no inventory at all often reports a "cost of service" line instead — covering direct labor, subcontractor fees, and materials tied specifically to delivering the service — but it sits in exactly the same place on the income statement and does exactly the same job. What counts as a direct cost also looks different again for manufacturers, who add production labor and factory overhead into the mix. How COGS differs by business type walks through five of the most common cases side by side.

Recording COGS: when it actually happens

A purchase of inventory is not an expense. It's an asset — value the business is holding, not value it has used up. That value only becomes a cost, and only reduces profit, at the moment the stock is sold. Buying $30,000 of stock this month has no effect on gross profit at all if none of it sells yet:

4 March — purchase $30,000 of inventory on credit
Account Debit Credit
Inventory 30,000
Accounts payable 30,000

Recording a purchase this way — and the sale itself — follows the same pattern used for everyday purchase and inventory transactions throughout this course. Then, at the moment a sale actually happens, two things are recorded together — the revenue earned, and the cost of the specific stock that just left the shelf:

18 March — sell $2,500 of goods that cost $1,700, customer pays on account
Account Debit Credit
Accounts receivable 2,500
Sales revenue 2,500
Cost of goods sold 1,700
Inventory 1,700

Notice the inventory account only moves when a sale happens — not when stock is purchased, and not on some month-end schedule. Run that same paired entry for every sale in the month, and total cost of goods sold builds up automatically, transaction by transaction, matching exactly what the opening-plus-purchases-minus-closing formula would calculate for the period as a whole.

Calculating your own COGS this month

  1. Pull last month's closing inventory value — that's this month's opening inventory.
  2. Total every inventory purchase made this month, including freight-in.
  3. Do a physical stock count at month-end and value it at cost — this is closing inventory.
  4. Apply the formula: opening + purchases − closing = COGS.
  5. Subtract COGS from revenue to get gross profit, and check the margin against what you'd expect for your kind of business.

Keep this formula alongside the rest of the core profitability formulas so you're not hunting for it separately each month. This lesson is the step-by-step calculation. To see how FIFO or average costing changes the inventory values you plug into it, read COGS and inventory costing methods.

Show a second worked answer

Opening inventory: $5,000. Purchases this month: $12,000. Closing inventory: $4,000.

COGS = $5,000 + $12,000 − $4,000 = $13,000.

If nothing had been on the shelf at the start of the very first trading period, opening inventory would simply be $0, and COGS would equal purchases minus closing inventory for that first period only — from the second period on, each period's closing inventory automatically becomes the next period's opening figure.

Doing this in Reyuko

Doing this calculation by hand every month is exactly the kind of work accounting software exists to remove. Reyuko's Product catalog tracks a costing method per item — Average, FIFO, or LIFO — and its inventory ledger records every purchase batch and every sale against it automatically.

That means cost of goods sold isn't a month-end reconstruction: each sale posts its own COGS entry, calculated from the actual batches in stock, at the moment the sale happens — the same mechanism shown in the journal entries above, just automated. The Income Statement report then reflects an up-to-date gross profit at any point in the month, not only after a manual count and calculation.

Keep going: the module Inventory Accounting and COGS in Practice covers how to calculate cost of goods sold from an income statement, how to calculate cost of goods sold from a trial balance, retail COGS for a store and a full COGS worked example from purchase invoice to gross profit.

Frequently asked questions

What is the formula for cost of goods sold?

COGS equals opening inventory plus purchases made during the period, minus closing inventory still unsold at the end. Purchases include freight-in, the cost of shipping stock to you. The result is the cost of stock that actually left the shelves as sales, not the cost of everything you bought in that period.

How do I calculate COGS if I have no beginning inventory?

In your first trading period, opening inventory is zero, so COGS is purchases minus closing inventory for that period. From the second period on, last period's closing inventory becomes the opening figure automatically, so the full formula applies. Keep the count at each period end so the next calculation starts from an accurate figure.

Is cost of goods sold the same as cost of sales?

They are usually used interchangeably in everyday bookkeeping. Cost of goods sold traditionally refers to physical products, while cost of sales can also cover the direct costs of delivering a service. Both sit in the same place on the income statement, directly below revenue, and both reduce revenue to gross profit.

When is cost of goods sold recorded in the books?

It is recorded when a sale happens, not when stock is bought. A purchase of inventory is an asset, so it debits inventory and does not reduce profit yet. When goods are sold, the business debits cost of goods sold and credits inventory for the cost of those specific goods.

Does Reyuko calculate COGS automatically for each sale?

Yes. Reyuko's Product catalog lets you set a costing method per item: Average, FIFO or LIFO. The inventory ledger records every purchase batch and every sale, so each sale posts its own COGS entry from the batches in stock. The Income Statement then shows gross profit at any point in the month, not only after a manual count.

How do I calculate cost of goods sold from the income statement?

Read it from the line labelled cost of goods sold or cost of sales, which sits directly below revenue. If your statement shows only revenue and gross profit, subtract: COGS = revenue − gross profit. For example, revenue of $54,000 and gross profit of $20,000 give COGS of $34,000. If neither line is shown, use the formula with the opening and closing inventory from your balance sheets.

How do I calculate cost of goods sold from a trial balance?

It depends on your inventory system. With a periodic system, the trial balance still shows last period's inventory (the opening figure) and a purchases account. Add the purchases balance (net of returns, with freight-in) to the inventory balance, then subtract the closing inventory from your stock count. For example, $12,000 inventory + $30,000 purchases − $8,000 counted = $34,000. With a perpetual system, the trial balance already carries a cost of goods sold balance, so you read it directly.

How do I calculate COGS for a retail business?

Use the same formula, valued at what the stock cost you, not at its selling price: opening inventory plus purchases of goods for resale (including freight-in, less returns and supplier discounts), minus the cost of the stock counted at the end. For example, a shop with $20,000 of opening stock, $45,000 of purchases and $15,000 of closing stock counted at cost has COGS of $20,000 + $45,000 − $15,000 = $50,000.

How do I calculate cost of sales?

For a business that sells goods, cost of sales is the same figure as COGS: opening inventory + purchases − closing inventory. For a service business with no stock, add up the direct costs of delivering the work in the period, such as direct labor, subcontractors and materials, and use that total as cost of sales. Either way, revenue minus cost of sales equals gross profit. What counts as COGS by industry shows which costs belong in each case.

How do I find sales revenue if I know the cost of goods sold?

Revenue is COGS plus gross profit. If COGS is $34,000 and gross profit is $20,000, revenue is $34,000 + $20,000 = $54,000. If you know the gross margin instead, divide COGS by one minus the margin: with COGS of $34,000 and a 40% gross margin, revenue is $34,000 ÷ 0.60 = $56,667.

Stop calculating COGS by hand

Reyuko tracks Average, FIFO or LIFO cost per product automatically from your purchase and sales history, so cost of goods sold is current, not a month-end estimate.

Download Reyuko freeSee what's included