Skip to content

Profit · 7 min read

Calculating cost of goods sold: formula, ratio and example for online shops

How to calculate cost of goods sold and its ratio, what is included in online retail (freight, customs, returns) and why it can differ from the purchase price per order. With a worked table.

Iron Saleh · Founder, NorthProfit

In short

Cost of goods sold = opening stock + purchases − closing stock, all net. It tells you what the goods you sold cost you to buy. The cost-of-goods ratio is cost of goods sold ÷ net revenue × 100. In online retail, freight and customs on purchase are included; shipping to customers, payment fees and advertising are not.

The formula

  1. Opening stock: value of the goods at the start of the period (closing stock of the last stocktake).
  2. + Net purchases: purchase prices plus inbound costs such as freight and customs, less returns to suppliers, discounts, rebates and early-payment discounts.
  3. − Closing stock: value of the goods at the end of the period per stocktake.
  4. = Cost of goods sold.

Valuation is at acquisition cost: purchase price plus incidental acquisition costs, less price reductions (Section 255 (1) HGB). Input VAT is not part of it if you can deduct it. Merchants who prepare a balance sheet count stock at year end (inventory, Section 240 HGB); in the income statement the cost of goods sold appears as expense for purchased goods (Section 275 (2) No. 5 HGB).

Worked example for an online shop

Cost of goods sold for one quarter (made-up numbers, net)
Opening stock per last stocktake€12,000
+ Purchases€30,000
+ Freight and customs on purchase€1,500
− Returns to suppliers€500
− Closing stock per stocktake€14,000
= Cost of goods sold€29,000
Net revenue for the quarter€72,500
Cost-of-goods ratio (29,000 ÷ 72,500 × 100)40%
Gross profit (net revenue − cost of goods sold)€43,500

Gross profit is not yet profit. In online retail, customer shipping, packaging, payment fees, marketplace commissions, advertising and return costs come off it before fixed costs such as software and rent.

What is included in online retail and what is not

Items and their effect on cost of goods sold
ItemIn cost of goods sold?Note
Purchase price of goods, netyeswithout deductible input VAT
Freight, customs, import duties on purchaseyesincidental acquisition costs (Section 255 HGB); import VAT only if not deductible
Supplier discounts, rebates, early-payment discountsreduceprice reductions
Shipping to your customersnoselling expense, calculate per order
Payment fees, commissions, advertisingnoseparate cost types
Customer return, resaleablelowersback into stock
Unsaleable return, shrinkage, theftraisesmissing at the stocktake

Period cost of goods sold and purchase price per order

The formula above works with stock and needs a stocktake. For day-to-day management, online merchants usually calculate differently: the purchase price per item sold, from the purchase prices recorded per variant. Both figures should converge over the year. If cost of goods sold per stocktake is clearly higher than the sum of purchase prices per order, inbound costs are missing from your purchase prices, or there is shrinkage and unsaleable returns.

If you use cash-basis accounting, purchases are usually deducted as business expenses in the year of payment (Section 11 EStG). Taxable profit then does not show what the goods sold cost. You still calculate cost of goods sold for prices and ad budgets.

Five common mistakes

  1. Gross instead of net: purchases with input VAT, revenue with VAT. The ratio is then wrong.
  2. Forgetting freight and customs: especially with goods from non-EU countries this adds several percentage points.
  3. Closing stock estimated instead of counted: without a stocktake, cost of goods sold is an assumption.
  4. Returns counted twice: revenue corrected and cost of goods sold reduced as well, although the goods are already in closing stock.
  5. Purchase prices not updated: if the purchase price rises and the old one stays in the system, every order looks better than it is.

Without and with NorthProfit

Without a tool, a stocktake list, purchase invoices and a spreadsheet with the formula above are enough. In NorthProfit you enter purchase prices per variant, import them by CSV or take them over from Shopify. From that, NorthProfit calculates cost of goods per order and shows profit after shipping, fees, advertising and returns. NorthProfit does not replace a stocktake.

Frequently asked questions

How do I calculate the cost of goods sold?
Cost of goods sold = opening stock + purchases (net, including inbound costs, less returns to suppliers, discounts and early-payment discounts) − closing stock per stocktake. All values net, i.e. without input VAT.
What is a good cost-of-goods ratio?
It depends on range and pricing strategy. What tells you more is the comparison with your own previous months and whether a contribution is left per order after goods, shipping, fees, advertising and returns.
Do shipping costs belong to the cost of goods sold?
Freight and customs on purchase yes, they are part of acquisition costs (Section 255 HGB). Shipping to your customers no, it is a selling expense and belongs in profit per order, not in the cost of goods sold.
How do returns affect the cost of goods sold?
Resaleable returns go back into stock and raise closing stock, so the cost of goods sold falls. Unsaleable goods are missing at the stocktake and raise the cost of goods sold. You correct the revenue of the return separately.
Is cost of goods sold the same as COGS?
Almost. The period's cost of goods sold comes from stock and purchases; the purchase price per item sold (COGS per order) from the purchase prices you recorded. The difference shows shrinkage, valuation changes or missing inbound costs.

This article is not tax or legal advice.

Published · Found a mistake? Write to us← All articles

Check it against your own numbers.

Connect your shop and see what stays on the bottom line.