This worked example shows a COGS calculation from start to finish. A shop begins March with $18,000 of stock, buys $46,000 more, pays $2,000 freight-in, gets $1,500 of goods credited back and $500 of discounts, and counts $21,000 at month-end. COGS is $18,000 + $46,000 − $1,500 − $500 + $2,000 − $21,000 = $43,000. On net sales of $70,000, gross profit is $27,000, a margin of 38.6%.
Key takeaways
- A COGS calculation starts with source documents (purchase invoices, credit notes, sales invoices) and ends on the income statement. Every step uses the same few numbers.
- Under a periodic system, COGS is the result of an opening balance, net purchases and a stock count. Under a perpetual system, it is the sum of costs posted sale by sale. Both reach $43,000 here.
- Purchase returns, purchase discounts and freight-in must be treated separately from the invoice amount, otherwise COGS is off by exactly their value.
- The inventory ledger should roll forward cleanly: opening + purchases − cost of sales = closing. If it does not, find the missing document before closing the month.
- Gross profit and gross margin are only as good as the closing stock count behind them.
What are we calculating, and for whom?
The business is the fictional furniture and home-goods shop Lakeside Home Goods. The month is March. All figures in this example are fictional, and we assume no sales tax so that the arithmetic stays visible. The goal is to answer a single question: what did the goods that Lakeside sold in March cost, and how much did it earn on them?
We will do it twice. First under a periodic system, where a count at month-end determines COGS. Then under a perpetual system, where each sale posts its own cost. If the difference between those two is new to you, the lesson on inventory accounting journal entries sets it out; if you want the underlying definition of COGS, start with what cost of goods sold includes.
The starting facts:
| Fact | Amount ($) |
|---|---|
| Inventory on 1 March (at cost) | 18,000 |
| Purchases from suppliers (three invoices) | 46,000 |
| Goods returned to a supplier | 1,500 |
| Early-payment discount taken | 500 |
| Freight-in on those purchases | 2,000 |
| Gross sales to customers | 72,000 |
| Goods returned by customers (at selling price) | 2,000 |
| Inventory counted on 31 March (at cost) | 21,000 |
Step 1: Collect and check the source documents
Every number above should trace to a document. A COGS figure you cannot trace is one you cannot defend.
| Document | Supplier / customer | Amount ($) |
|---|---|---|
| Purchase invoice 1 | Oakline Timber | 20,000 |
| Purchase invoice 2 | Harbor Textiles | 16,000 |
| Purchase invoice 3 | Brightwell Ceramics | 10,000 |
| Total purchase invoices | 46,000 | |
| Supplier credit note (returned goods) | Harbor Textiles | 1,500 |
| Freight invoice for inbound shipments | Northway Freight | 2,000 |
Invoice 1 carries a 2.5% early-payment discount if paid within terms. Lakeside pays on time, so the discount is 2.5% × $20,000 = $500. Sales for the month total $72,000 across all customer invoices, and credit notes to customers total $2,000.
Before posting anything, check three things. The supplier credit note refers to goods that were actually sent back. The freight invoice relates to March deliveries only. Goods that arrived on 31 March are on the shelf and in the count, with their invoice recorded in March as well; otherwise you create a cut-off error.
Step 2: Journalise the purchases side (periodic system)
Under a periodic system, purchases are debited to a Purchases account, not to Inventory. Each entry balances.
Purchase invoices received on credit:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Purchases | 46,000 | |
| Accounts payable | 46,000 | |
| Total | 46,000 | 46,000 |
Goods returned to Harbor Textiles (credit note):
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Accounts payable | 1,500 | |
| Purchase returns | 1,500 | |
| Total | 1,500 | 1,500 |
Freight-in invoice:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Freight-in | 2,000 | |
| Accounts payable | 2,000 | |
| Total | 2,000 | 2,000 |
Invoice 1 paid within terms, taking the discount:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Accounts payable | 20,000 | |
| Cash | 19,500 | |
| Purchase discounts | 500 | |
| Total | 20,000 | 20,000 |
Notice that the discount does not reduce the Purchases account directly. It is recorded in its own account so that the gross purchase amount stays visible. For the underlying debit and credit rules, see debit and credit rules.
Step 3: Journalise the sales side
Revenue is recorded at the selling price. In a periodic system, no cost is posted at the time of sale.
Sales for the month:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Accounts receivable | 72,000 | |
| Sales | 72,000 | |
| Total | 72,000 | 72,000 |
Customer returns and credit notes:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Sales returns | 2,000 | |
| Accounts receivable | 2,000 | |
| Total | 2,000 | 2,000 |
Net sales are $72,000 − $2,000 = $70,000.
Step 4: Summarise the relevant ledger accounts
Posting these entries to the general ledger gives the following balances before the month-end adjustment.
| Ledger account | Balance ($) | Side |
|---|---|---|
| Inventory (opening, unchanged during the month) | 18,000 | Debit |
| Purchases | 46,000 | Debit |
| Freight-in | 2,000 | Debit |
| Purchase returns | 1,500 | Credit |
| Purchase discounts | 500 | Credit |
| Sales | 72,000 | Credit |
| Sales returns | 2,000 | Debit |
These are the same accounts that appear on the unadjusted trial balance. The lesson on calculating COGS from a trial balance shows that full trial balance and how to check it.
Step 5: Count the stock and calculate COGS
At 31 March Lakeside counts its shelves and warehouse, values the items at cost, and arrives at $21,000. The method for the count is in the step-by-step stock opname. Then:
COGS = Opening inventory + Net purchases + Freight-in − Closing inventory
Net purchases = purchases − purchase returns − purchase discounts.
| Line | Calculation | Amount ($) |
|---|---|---|
| Opening inventory | 18,000 | |
| Purchases | 46,000 | |
| Less: purchase returns | 1,500 | |
| Less: purchase discounts | 500 | |
| Net purchases | 46,000 − 1,500 − 500 | 44,000 |
| Add: freight-in | 2,000 | |
| Net cost of purchases | 44,000 + 2,000 | 46,000 |
| Goods available for sale | 18,000 + 46,000 | 64,000 |
| Less: closing inventory | From count | 21,000 |
| Cost of goods sold | 64,000 − 21,000 | 43,000 |
Step 6: Post the month-end entries
The ledger still has no COGS and an inventory balance that is a month old. Two entries fix it.
Move opening inventory and purchase accounts into COGS:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Cost of goods sold | 64,000 | |
| Purchase returns | 1,500 | |
| Purchase discounts | 500 | |
| Inventory (opening) | 18,000 | |
| Purchases | 46,000 | |
| Freight-in | 2,000 | |
| Total | 66,000 | 66,000 |
Record closing inventory:
| Account | Debit ($) | Credit ($) |
|---|---|---|
| Inventory (closing) | 21,000 | |
| Cost of goods sold | 21,000 | |
| Total | 21,000 | 21,000 |
The COGS account now has a debit balance of $64,000 − $21,000 = $43,000. For more on this kind of entry, see adjusting journal entries.
Step 7: Prepare the income statement and read gross profit
Now the numbers flow to the statement.
| Lakeside Home Goods, March | Amount ($) |
|---|---|
| Sales | 72,000 |
| Less: sales returns | 2,000 |
| Net sales | 70,000 |
| Cost of goods sold | 43,000 |
| Gross profit | 27,000 |
| Gross margin (27,000 ÷ 70,000) | 38.6% |
| Operating expenses (rent 5,000, wages 9,000, utilities 1,200, other 2,300) | 17,500 |
| Operating profit | 9,500 |
Gross profit is net sales less COGS: $70,000 − $43,000 = $27,000. The gross margin is $27,000 ÷ $70,000 = 38.57%, which we round to 38.6%. Operating profit after $17,500 of operating expenses is $9,500. To see how these layers differ, read the four layers of profit and, for the statement as a whole, how an income statement is laid out.
The same month under a perpetual system
Now run the same facts through a perpetual system, where Inventory is updated every time stock moves. The only new fact needed is the cost of the goods sold and of the goods customers returned. Assume the sales invoices carried a cost of $44,200 in total and the returned goods, which went back on the shelf, carried a cost of $1,200. This extra assumption is fictional.
| Event | Debit | Credit | Amount ($) |
|---|---|---|---|
| Purchases (three invoices) | Inventory | Accounts payable | 46,000 |
| Goods returned to supplier | Accounts payable | Inventory | 1,500 |
| Invoice 1 paid early (2.5% discount) | Accounts payable | Cash 19,500, Inventory 500 | 20,000 |
| Freight-in | Inventory | Accounts payable | 2,000 |
| Sales | Accounts receivable | Sales | 72,000 |
| Cost of the goods sold | Cost of goods sold | Inventory | 44,200 |
| Customer returns (selling price) | Sales returns | Accounts receivable | 2,000 |
| Returned goods back in stock (at cost) | Inventory | Cost of goods sold | 1,200 |
The Inventory account then rolls forward like this:
| Inventory account | Amount ($) |
|---|---|
| Opening balance | 18,000 |
| Add: purchases | 46,000 |
| Less: supplier return | 1,500 |
| Less: discount | 500 |
| Add: freight-in | 2,000 |
| Less: cost of goods sold | 44,200 |
| Add: returned goods restocked | 1,200 |
| Ledger balance at 31 March | 21,000 |
And COGS is $44,200 − $1,200 = $43,000. The ledger says $21,000 of stock; the count also says $21,000. The two systems agree because nothing was lost. If the count had come to $20,400, a periodic system would have reported COGS of $43,600, silently including the $600 shortage. A perpetual system would have kept COGS at $43,000 and recorded the $600 as a stock difference to be investigated. The loss lesson is taken further in inventory shrinkage and write-downs.
Step 8: Sanity-check the result
Gross margin by itself says little until you compare it. Three simple checks:
- Roll-forward. Opening 18,000 + net cost of purchases 46,000 − COGS 43,000 = 21,000, equal to the count.
- Margin trend. Compare 38.6% with last month and the same month last year. An unexplained swing of a few points deserves a look at cut-off, returns and the count.
- Turnover. Average inventory is (18,000 + 21,000) ÷ 2 = 19,500. COGS ÷ average inventory = 43,000 ÷ 19,500 = 2.21 times in the month, or about 14 days of stock (31 ÷ 2.21 = 14.1). It is a useful yardstick for whether $21,000 of stock is reasonable for $43,000 of monthly cost.
The retail lesson on calculating COGS for a store applies the same checks to a store with many small items, and the month-end checklist for inventory and COGS turns them into a routine.
If you used the $72,000 gross sales figure, you would report gross profit of $29,000 and a margin of 40.3% (29,000 ÷ 72,000), overstating both. The $2,000 of customer returns is not revenue you kept, and the returned goods are back in the closing count, so always start from net sales of $70,000.
What changes if the numbers change?
A worked example is most useful when you can vary it. Try these, and recompute with the formula from Step 5:
- Closing count is $19,000 instead of $21,000. Goods available stays $64,000, so COGS is $45,000, gross profit $25,000 and margin 35.7%. A lower count means a higher cost of sales.
- Freight-in was never booked. COGS would be $41,000 and gross profit $29,000. The missing $2,000 flatters profit and understates payables.
- FIFO versus average cost. The count of $21,000 is a quantity valued at a cost method. Change the method and the valuation of the 21,000 changes, along with COGS. The effect is explained in FIFO vs average costing.
Cost-flow assumptions and tax treatment differ by country, so check the rules that apply to your business.
Reyuko is perpetual. A goods receipt debits Inventory and credits GRNI until the supplier's invoice arrives, which then clears GRNI and creates the payable. A sales invoice posts revenue, receivable and tax, plus Dr COGS / Cr Inventory at the cost set for the product (Average, FIFO, LIFO or FEFO). Stock adjustments and stock-take shortages post Dr Inventory shrinkage expense / Cr Inventory, separately from COGS. The inventory roll-forward above is therefore what the ledger already contains.
Reyuko