To calculate cost of goods sold (COGS), add the value of the stock you held at the start of a period to the stock you bought or made during that period, then subtract the value of the stock you still hold at the end. The result is what your sold products cost you, and it is the figure you deduct from sales to reach gross profit.
The formula is short. The hard part is the inputs: counting closing stock correctly, deciding which purchase costs belong in the period, and applying the same method month after month. This guide walks through each step, shows a worked example, and points out where small businesses usually go wrong.
Once you have a COGS figure, our profit margin calculator helps you see what it means for your margin. You can run the numbers there while you follow the steps below. If stock is tying up cash, our guide to cash flow management covers how to plan around it.
What cost of goods sold includes
COGS covers the direct costs of the products you sold in the period. For a retailer, that is mainly the cost of goods bought for resale, plus the freight and duties needed to get them into your warehouse. For a manufacturer, it also includes the raw materials used and the labour and production overheads spent making the goods. Office rent, marketing and administrative salaries are normally operating expenses, not COGS.
The boundary matters because it changes gross margin. Put a cost in the wrong place and the margin you see on a monthly report will not match what you earn. The table below sets out common cases. Treatment can differ by accounting framework, so confirm your own rules with your accountant.
| Cost type | Usually part of COGS? | Note |
|---|---|---|
| Purchase price of goods for resale | Yes | Net of supplier discounts and returns |
| Inbound freight and import duties | Usually yes | Include costs needed to get stock ready for sale |
| Raw materials used in production | Yes | Only the materials that went into goods sold |
| Direct labour in production | Yes, for manufacturers | Wages of staff who make the product |
| Factory rent and utilities | Often, as overhead | Allocate with a method you apply every period |
| Office rent, marketing, admin salaries | No | Report as operating expenses |
Step-by-step: how to calculate COGS
Follow these steps in order. Use the same period, cut-off dates and valuation method each time, so that the figures are comparable from one period to the next.
- Set the period. Choose a month, quarter or year. Use the same start and end dates for stock counts, purchase invoices and sales.
- Confirm opening inventory. This is the value of stock on hand at the start of the period. It must equal the closing inventory from the previous period.
- Add purchases and production costs. Total the supplier invoices for stock received in the period, net of returns and credit notes, plus any direct production costs.
- Count and value closing inventory. Count stock at the end of the period and value each line at cost, using the method you have chosen.
- Apply the formula. Opening inventory plus purchases and production costs, minus closing inventory, equals COGS.
- Compare with sales. Subtract COGS from sales to get gross profit, then check the gross margin against previous periods and investigate any sharp change.
A worked example you can copy
The example below uses assumed figures for a small homeware seller. The numbers are not benchmarks; they show how the lines fit together. Replace them with your own ledger and stock count.
| Line | Amount (GBP) |
|---|---|
| Opening inventory at start of quarter | 10,000 |
| Purchases of goods for resale | 25,000 |
| Inbound freight and import duties | 2,000 |
| Less closing inventory at end of quarter | (8,000) |
| Cost of goods sold | 29,000 |
| Sales for the quarter | 60,000 |
| Gross profit (sales minus COGS) | 31,000 |
| Gross margin (gross profit divided by sales) | 51.7% |
Notice that the 8,000 of closing stock is not a cost of the quarter. It remains on the balance sheet until it is sold. If you forget to deduct it, COGS is overstated and the margin looks worse than it is.
Choosing an inventory valuation method
The value of closing stock depends on which costs you assign to the units still on hand. The method you pick changes COGS whenever purchase prices move, so decide once, document it, and apply it consistently. The three methods below are the ones small businesses meet most often.
| Method | How it works | Where it fits |
|---|---|---|
| First in, first out (FIFO) | The oldest units are treated as sold first | Perishable goods and items with expiry dates |
| Weighted average | Every unit is valued at the average cost of stock on hand | Identical items bought at changing prices |
| Specific identification | Each item carries its own recorded cost | High-value or one-off items such as machinery or art |
LIFO (last in, first out) is also used in some countries, but it is not generally accepted for financial reporting in the UK or under international standards. If you are unsure which method your accounts must follow, ask your accountant before you change anything. For a wider comparison of methods such as FIFO and ABC, read our inventory management methods guide.
Common mistakes that distort COGS
Most errors come from timing and completeness rather than arithmetic. Check these points each period:
- Mixing up invoice dates and receipt dates. A purchase belongs in the period the goods arrived, not the period the invoice was issued, unless you have a documented cut-off rule.
- Ignoring returns and credit notes. Goods sent back to a supplier reduce purchases and must be deducted.
- Valuing stock at selling price. Closing inventory must be valued at cost, or at net realisable value if that is lower.
- Skipping shrinkage. Damaged, lost or stolen stock that is not written off keeps closing inventory too high, and COGS too low.
- Changing methods mid-year. A change in valuation method makes this period's margin incomparable with the last one.
How to keep COGS accurate every month
Accurate COGS depends on accurate stock records. A monthly count of high-value lines, combined with a full count at year end, catches most problems early. Record goods receipts when the stock arrives, not when the invoice is paid, and link each supplier invoice to the stock it covers.
In Dika Ops, purchasing, inventory and finance work from one record, so goods received and supplier invoices sit next to the stock they affect. That removes much of the manual reconciliation that usually happens at month end, which is covered step by step in our month-end close checklist. If your stock data, sales data and accounts live in separate files, the team at Dika Design can help you connect them through our data platforms and business intelligence work.
Frequently asked questions
Is cost of goods sold the same as cost of sales?
In most small business reporting the two terms mean the same thing. Some accounts present them differently, so the exact definition depends on your accounting framework. Ask your accountant which label your accounts use before you compare figures with another company.
Are shipping costs part of COGS?
Inbound shipping and import duties needed to bring stock to its selling location are usually part of the cost of that stock. Outbound shipping charged to customers is normally a selling expense. Keep the two separate in your ledger so the gross margin stays clear.
Can I calculate COGS without a stock count?
You can estimate COGS using a gross profit method, which applies your usual margin to sales. That is useful for interim management reports. For the accounts, you still need a physical count or reliable perpetual stock records, because estimates drift over time.
Does COGS include wages?
Only wages that are directly tied to making or preparing the goods sold belong in COGS. For a manufacturer, that can include production staff. Office, sales and management salaries are operating expenses.
How often should I calculate COGS?
Calculate it monthly if you want to track margin and act on it quickly. At minimum, calculate it at every year end for your accounts and any tax filings. The more often you do it, the sooner you spot stock problems.
Summary and next step
To calculate cost of goods sold, start with opening stock, add purchases and production costs, and subtract closing stock. Keep the cut-off dates, the valuation method and the cost boundary the same from period to period, and check the result against sales. If you would like help setting up stock, purchasing and finance on one system, request a demo and we can show you how Dika Ops handles it.



