If you sell physical products online, cost of goods sold (COGS) is the single number that decides whether you're actually making money. Get it wrong and your profit and loss account lies to you, your tax bill is off, and you can't tell which products are worth restocking.
It's also the number most online sellers get muddled, because marketplace payouts, postage, fees and stock purchases all land in your bank feed at different times. The cash in your account is not your profit.
This guide explains what COGS is, how to calculate it, how to value your inventory, and how to use it to protect your margin. It's written for UK sole traders and limited companies selling on Amazon, eBay, Etsy, Shopify and their own sites.
What is cost of goods sold for an online seller? {#what-is-cogs}
Cost of goods sold is the direct cost of the products you actually sold in a period. Not the products you bought. Not the products sitting in a warehouse or an Amazon FBA fulfilment centre. The ones that left and turned into revenue.
That distinction matters. When you buy stock, it's an asset on your balance sheet, not an expense. It only becomes an expense, your COGS, at the moment it's sold. This is the matching principle: you match the cost of an item against the income it generated, in the same period.
HMRC treats "goods for resale (stock)", "raw materials" and "direct costs from producing goods" as allowable business expenses, so they reduce your taxable profit. Goods bought for private use are not allowable. (See GOV.UK on reselling goods.)
Get COGS right and your gross profit, the figure you live or die by, is right. Get it wrong and you'll either overstate profit and overpay tax, or understate it and get a nasty surprise at year end.
What goes into COGS, and what doesn't? {#what-goes-in}

COGS is strictly the direct costs of getting a product ready to sell. The general rule: if the cost would disappear when you stop selling that product, it's probably COGS.
Costs that usually belong in COGS:
- The purchase price you paid your supplier for the stock
- Import duty and freight to get goods into your warehouse (inbound shipping)
- Direct manufacturing or production costs if you make the product
- Packaging that's part of the product itself
- Inbound customs and clearance charges
Costs that usually sit below the line as overheads or selling costs, not in COGS:
- Marketplace selling fees and referral fees
- Payment processing fees
- Advertising and PPC
- Outbound postage to the customer (treatment varies, see below)
- Software subscriptions, rent, and your accountant's fee
A grey area worth flagging: many sellers lump marketplace fees and outbound postage into "cost of sales" on their management accounts because they're so closely tied to each sale. That's a reasonable management view, but for your statutory accounts and tax return the important thing is to be consistent and to keep true product cost separate so you can see real product margin. If you're unsure how to classify a cost, our bookkeeping team can set the chart of accounts up properly from the start.
How do you calculate COGS? (the formula) {#the-formula}
Talk to an e-commerce accountant →
The formula is simple. Applying it accurately is where sellers slip.
COGS = Opening stock + Purchases (and direct costs) − Closing stock
- Opening stock is the value of inventory you held at the start of the period.
- Purchases is everything you bought to resell during the period, plus inbound freight and duty.
- Closing stock is the value of inventory still unsold at the end of the period.
The closing stock figure is what stops you expensing goods you haven't sold yet. To get it, you need to know how many units you're holding (a stock count or accurate system figure) and what each unit cost (your valuation method, below).
Worked example: a Shopify and Amazon seller {#worked-example}
Illustrative example. Maya runs a homeware brand as a sole trader, selling through Shopify and Amazon FBA. Here are her figures for the 2025/26 tax year.
| Item | Amount |
|---|---|
| Opening stock (6 April 2025) | £8,000 |
| Stock purchased in year | £42,000 |
| Inbound freight and import duty | £5,000 |
| Closing stock (5 April 2026) | £11,000 |
Her COGS for the year:
£8,000 + £42,000 + £5,000 − £11,000 = £44,000
Now bring in her sales. Maya's total product revenue for the year was £96,000 (net of VAT, as she's VAT-registered).
| Profit line | Amount |
|---|---|
| Revenue | £96,000 |
| Cost of goods sold | (£44,000) |
| Gross profit | £52,000 |
That's a gross margin of £52,000 ÷ £96,000 = 54.2%.
Notice what's not in COGS here: her Amazon and Shopify fees, her advertising spend, and her outbound postage all sit below gross profit as selling costs and overheads. They'll reduce her net profit further, but keeping them out of COGS means Maya can see her true product margin of 54.2% and price accordingly.
One more point. Maya is VAT-registered because her turnover is above the £90,000 VAT registration threshold for the current year (GOV.UK). The standard VAT rate is 20%, so her sales and purchase figures above are recorded net of VAT. If you're below the threshold and not registered, you'd record stock at the gross (VAT-inclusive) cost you actually paid, because you can't reclaim the VAT.
How should you value your inventory? {#valuation}
To work out closing stock, you need a consistent way to value units, especially when you've bought the same product at different prices over the year. UK businesses commonly use one of two methods:
| Method | How it works | When it suits |
|---|---|---|
| FIFO (First In, First Out) | Assumes the oldest stock is sold first, so closing stock is valued at your most recent purchase prices | Most ecommerce sellers; matches how perishable and trend-led goods actually move |
| Weighted average cost | Averages the cost of all units held, so each sale is costed at the blended average | Sellers with large volumes of interchangeable, identical units |
A third method, LIFO (Last In, First Out), is not permitted under UK accounting standards (UK GAAP) or IFRS, so don't use it for your accounts.
There's one more golden rule. Stock should be valued at the lower of cost and net realisable value. If goods have become damaged, obsolete or unsellable at their normal price, you write them down to what you can actually get for them. You don't carry dead stock on your balance sheet at full cost.
Whichever method you pick, pick one and stay consistent year to year. Chopping and changing distorts your profit and raises questions with HMRC.
Cash basis or traditional accounting: which affects stock? {#cash-basis}
How you account changes how stock hits your numbers.
Under traditional (accrual) accounting, you apply the COGS formula above: stock is an asset until sold, and you adjust for opening and closing stock. This gives you a true gross margin and is required for limited companies.
Under the cash basis, you record income and expenses only when money actually moves (GOV.UK). The cash basis is the standard method for sole traders and most partnerships, though limited companies can't use it. With cash accounting you generally don't do a formal opening and closing stock adjustment, which sounds simpler but can badly distort your view of profit if you hold significant inventory, because a big stock purchase shows as an expense before you've sold a thing.
In practice, the mistake we most often see with growing online sellers is staying on a cash view long after their stock holding has become material. If inventory is a big part of your business, traditional accounting gives you the honest picture. A limited company always uses it anyway, and you'll need it for your statutory accounts.
How does COGS drive your gross margin? {#gross-margin}
Gross margin is the percentage of each sale left after COGS, and it's the heartbeat of an ecommerce business.
Gross margin % = (Revenue − COGS) ÷ Revenue × 100
In Maya's example that's (£96,000 − £44,000) ÷ £96,000 = 54.2%.
Tracking margin by product, not just overall, tells you where the money really comes from. A product can look like a bestseller by units sold and still lose you money once true COGS is in. High revenue with thin margin is a treadmill; lower revenue with strong margin often pays you better.
For Amazon FBA sellers especially, watch how inbound freight, prep and per-unit costs eat into margin on low-price items. We dig into the wider tax and accounting picture on our Amazon FBA accounting page, and the broader setup on our ecommerce accounting page.
How to track COGS accurately as you scale {#tracking}
When you're tiny, a spreadsheet and a year-end stock count are enough. As volume grows across channels, manual tracking breaks down. A few practical steps:
- Separate stock purchases from expenses in your bookkeeping. Code supplier invoices to stock, not to a general "purchases" expense, so the balance sheet stays right.
- Record inbound freight and duty against the stock it relates to, so each unit's true landed cost is captured.
- Reconcile marketplace payouts properly. A Shopify or Amazon payout is net of fees, refunds and adjustments. Don't treat the deposit as revenue. Split it into gross sales, fees and refunds. Our Shopify sellers guide covers this in more depth.
- Do a real stock count at year end, or trust your inventory system only if it reconciles to a physical count.
- Value at lower of cost and net realisable value, writing down obsolete stock.
Get these five right and your COGS, margin and tax are all trustworthy.
Want your ecommerce numbers to actually make sense?
Zmartly helps UK online sellers track inventory, nail their COGS and see true product margin across every channel. Book a free 20-minute call with a Zmartly accountant and we'll show you exactly where your margin is going.
Frequently asked questions {#faqs}
Are marketplace and payment fees part of COGS?
Usually no. Selling fees, referral fees and payment processing fees are selling costs that sit below gross profit, not direct product costs. Keeping them out of COGS lets you see your true product margin. They're still fully allowable expenses that reduce your taxable profit; they're just classified differently.
Is inbound shipping included in cost of goods sold?
Yes. Freight, import duty and customs charges to get stock into your warehouse are part of the landed cost of the goods, so they belong in COGS. Outbound postage to the customer is a selling cost and is normally treated separately.
Do I have to count my stock at year end?
If you use traditional (accrual) accounting, yes, you need a reliable closing stock figure, ideally backed by a physical count or a reconciled inventory system. It's how the COGS formula stops you expensing goods you haven't sold. Under the cash basis a formal stock adjustment generally isn't required, but a count is still good practice.
Can I use LIFO to value my inventory in the UK?
No. LIFO (Last In, First Out) is not permitted under UK accounting standards or IFRS. UK sellers typically use FIFO (First In, First Out) or weighted average cost, and should apply the chosen method consistently.
How does COGS affect my tax bill?
COGS reduces your gross profit, which flows through to your taxable profit, so an accurate COGS figure means an accurate tax bill. Overstate COGS and you risk an HMRC challenge; understate it and you overpay tax. The closing stock adjustment is the key step that gets it right.





