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.
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
- Opening stock: value of the goods at the start of the period (closing stock of the last stocktake).
- + Net purchases: purchase prices plus inbound costs such as freight and customs, less returns to suppliers, discounts, rebates and early-payment discounts.
- − Closing stock: value of the goods at the end of the period per stocktake.
- = 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
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
| Item | In cost of goods sold? | Note |
|---|---|---|
| Purchase price of goods, net | yes | without deductible input VAT |
| Freight, customs, import duties on purchase | yes | incidental acquisition costs (Section 255 HGB); import VAT only if not deductible |
| Supplier discounts, rebates, early-payment discounts | reduce | price reductions |
| Shipping to your customers | no | selling expense, calculate per order |
| Payment fees, commissions, advertising | no | separate cost types |
| Customer return, resaleable | lowers | back into stock |
| Unsaleable return, shrinkage, theft | raises | missing 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
- Gross instead of net: purchases with input VAT, revenue with VAT. The ratio is then wrong.
- Forgetting freight and customs: especially with goods from non-EU countries this adds several percentage points.
- Closing stock estimated instead of counted: without a stocktake, cost of goods sold is an assumption.
- Returns counted twice: revenue corrected and cost of goods sold reduced as well, although the goods are already in closing stock.
- 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?
What is a good cost-of-goods ratio?
Do shipping costs belong to the cost of goods sold?
How do returns affect the cost of goods sold?
Is cost of goods sold the same as COGS?
This article is not tax or legal advice.