Guide · Profit and finance
How to calculate profit margin: per product, per order and for the business
The formulas for gross, operating, net and contribution margin, with worked examples per product, per unit and per order, plus Excel and Google Sheets.
- Profit margin = profit ÷ revenue × 100. Which profit you put on top decides which margin you get: gross, contribution, operating or net.
- Gross margin subtracts only the cost of goods; net margin subtracts every cost, including marketing, overheads, interest and tax.
- For one product or one order, subtract every cost that comes with that sale (product, shipping, packaging, payment fee, and ideally its share of ads) before you divide.
- To price for a target margin, divide the cost by (1 − margin): a €40 cost at a 20% margin needs a €50 price, not €48.
- A spreadsheet works for a first calculation; it goes stale as soon as product costs, fees or ad spend change.
Profit margin tells you how much of each euro of sales you keep as profit. It is a percentage, so you can compare a small month with a big one, a cheap product with an expensive one, or your store with last year's store.
The formula itself is one line. The work is in deciding which costs go into "profit", and getting those costs right for each product and each order. This guide gives the four margin formulas, shows each one on labelled example numbers, then works through profit per product, per unit and per order, and how to set it up in Excel or Google Sheets.
What profit margin is
Profit margin is profit divided by revenue, shown as a percentage. A 25% margin means a quarter of every euro a customer pays stays with you after the costs you counted; the other 75 cents went to those costs.
- Revenue
- What customers paid you, after discounts and refunds, without VAT or sales tax.
- Costs
- The costs you choose to subtract. Which ones you include decides the type of margin.
Because the costs differ, there are four margins in common use. Each sits at a different line of the profit and loss statement.
| Margin | Costs subtracted | Formula | What it tells you |
|---|---|---|---|
| Gross margin | Cost of goods sold (COGS) | (revenue − COGS) ÷ revenue | Whether your products are priced well against what they cost you. |
| Contribution margin | COGS plus every cost that moves with an order: shipping, packaging, payment fees, often ad spend | (revenue − variable costs) ÷ revenue | What each sale leaves to pay for the business. |
| Operating margin | COGS plus all operating expenses: fulfilment, marketing, staff, software, rent | operating profit ÷ revenue | Whether running the store is profitable before financing and tax. |
| Net margin | Everything, including interest, depreciation and income tax | net profit ÷ revenue | What the business keeps in the end. |
Swipe the table sideways to see every column.
Why the margin matters more than revenue
Revenue tells you how much you sold. Margin tells you whether selling it was worth it. Three things depend on knowing it:
- Pricing. A price is only right against its costs. Without the margin you cannot tell whether a 15% discount leaves anything.
- Ad budgets. The margin before ads sets how much you can pay for an order. A 50% contribution margin means a break-even ROAS of 2.0; at 25% it is 4.0.
- Spotting problems early. When the margin falls while revenue grows, a cost grew faster than sales: a supplier, a carrier, refunds or ads. The euro amounts hide that; the percentage shows it.
How to calculate gross profit margin
- Take net revenue
Sales after discounts and refunds, without VAT or sales tax.
- Subtract the cost of goods sold
What the units you sold cost you: purchase price plus inbound freight and import duties (the COGS). Only the units sold in the period count, not the stock you bought.
- Divide by revenue and multiply by 100
The result is gross profit as a share of revenue.
| Net revenue | €80,000 |
|---|---|
| Cost of goods sold | −€28,000 |
| Gross profit | €52,000 |
| Gross margin (52,000 ÷ 80,000) | 65.0% |
Gross margin varies widely by what you sell. Own-brand cosmetics and digital products can keep most of the price; resold electronics keep little. Compare yours with your own history and with stores that sell the same kind of product, not with an all-industry average. Our guide to a good profit margin explains how to read benchmarks.
How to calculate operating profit margin
- Start from gross profit
Revenue minus COGS, as above.
- Subtract operating expenses
Everything it takes to run the store: shipping and fulfilment, payment fees, marketing and ad spend, staff, software and apps, rent, accounting. See operating expenses for what belongs here.
- Divide operating profit by revenue
Multiply by 100 for the percentage.
| Gross profit | €52,000 |
|---|---|
| Shipping, packaging and payment fees | −€9,600 |
| Ad spend and other marketing | −€20,000 |
| Staff, software and other overheads | −€12,400 |
| Operating profit | €10,000 |
| Operating margin (10,000 ÷ 80,000) | 12.5% |
How to calculate net profit margin
- Start from operating profit
The result of the step above.
- Subtract interest, depreciation and income tax
And add any income that is not from selling products, such as interest received.
- Divide net profit by revenue
This is the net profit margin, the bottom line as a share of sales.
| Operating profit | €10,000 |
|---|---|
| Interest and depreciation | −€600 |
| Income tax (estimate) | −€2,000 |
| Net profit | €7,400 |
| Net margin (7,400 ÷ 80,000) | 9.25% |
Read the three together: a 65% gross margin that ends as a 9.25% net margin says the products are priced well and most of the money goes to running and marketing the store. That is where to look first.
Contribution margin: the webshop version
Classic accounting puts shipping, payment fees and ad spend in operating expenses. For an online store that hides the most important question: does each order pay for itself? Contribution margin answers it by subtracting every cost that grows with sales, and nothing else.
- Before ads (CM2)
- Leave ad spend out: what each order earns before you pay to win it.
- After ads (CM3)
- Subtract ad spend too: what the orders leave for overheads and profit.
With the numbers above: €80,000 − €28,000 − €9,600 = €42,400 before ads (53.0%), and €22,400 after €20,000 of marketing (28.0%). The difference between contribution and gross margin is the costs a gross-margin view never shows. For several products with different margins, the weighted average contribution margin gives the store's blended figure.
How to calculate profit margin on a product
For one product, the same formula works per unit: price minus the costs that come with selling one unit, divided by the price.
- Set the selling price
What a customer pays for one unit, without VAT and after the usual discount if most sales are discounted.
- Add up the cost per unit
Purchase or production cost, inbound freight and duty per unit, packaging, the shipping you pay for it, and the payment fee on its price.
- Subtract and divide
Profit per unit ÷ price × 100 gives the product margin.
- Add its share of ads, if you can
Ad spend on the product divided by units sold. This is the step that turns a margin that looks fine into the real one.
| Selling price (excl. VAT) | €40.00 |
|---|---|
| Product cost, freight and duty | −€12.00 |
| Gross profit per unit (70.0%) | €28.00 |
| Shipping paid, per unit | −€4.50 |
| Packaging | −€0.50 |
| Payment fee (2% + €0.25) | −€1.05 |
| Contribution before ads (54.9%) | €21.95 |
| Ad spend per unit sold | −€9.00 |
| Contribution after ads (32.4%) | €12.95 |
The product's gross margin is 70%; after the costs of selling it, 32 cents of every euro remain. A product with a lower gross margin but cheaper shipping and less ad spend can end up ahead.
Profit per unit and why it is worth tracking
Profit per unit is the euro amount behind the product margin: what one sold unit leaves after its costs. There are two useful versions:
- Gross profit per unit: price minus the product's own cost. Quick, and enough to compare purchase prices.
- Net profit per unit: price minus every cost that comes with the unit, including shipping, fees and its share of ads. This is the one to make decisions with.
Tracking it per product shows which products carry the store and which only add volume. It tells you whether a price increase, a cheaper supplier or a bundle helps most, and it stops you from scaling ads on a bestseller that loses money on each unit. Start the day you add a product: enter its cost, check the per-unit result at the price you plan, and recheck when a cost changes. The unit economics guide extends the same idea from one unit to one customer.
How to calculate profit margin per order
An order mixes products, a discount, the shipping a customer paid, the shipping you paid and one payment fee. Margin per order adds them up in one place.
| Items (two products), after a 10% code | €58.00 |
|---|---|
| Shipping charged to the customer | €4.95 |
| Order revenue (excl. VAT) | €62.95 |
| Cost of goods | −€19.50 |
| Shipping paid to the carrier | −€6.20 |
| Packaging and handling | −€0.90 |
| Payment fee | −€1.51 |
| Contribution before ads (55.3%) | €34.84 |
| Marketing cost of the order (CPA) | −€15.00 |
| Contribution after ads (31.5%) | €19.84 |
Margin per order is where discounts, free-shipping thresholds and small baskets show up. An order of €25 with the same €6.20 shipping cost can leave nothing.
How to calculate profit for the whole business
Profit for the business is total revenue minus total expenses for a period. To get it right, be clear about what counts on each side:
- Product sales after discounts
- Shipping charged to customers
- Other operating income, such as a supplier rebate
- Minus refunds and returns
- Cost of goods sold (units sold, not stock bought)
- Shipping, packaging, payment and marketplace fees
- Ad spend, agencies, influencers
- Staff, software, rent, accounting
- Interest, depreciation and income tax
The order of the steps is the profit and loss statement: gross profit, contribution, operating profit, net profit. Our P&L guide builds the full statement line by line; gross, operating and net profit explains the three totals side by side.
Turning a margin into a price
Margin and markup are often confused. Margin is profit as a share of the price; markup is profit as a share of the cost. A product that costs €60 and sells for €100 has a 40% margin and a 66.7% markup. See margin vs markup for more.
A €40 cost at a 20% margin: €40 ÷ 0.80 = €50. Adding 20% to the cost (€48) gives only a 16.7% margin.
Three conversions people ask for most:
- A 30% margin on a €100 price is €30 of profit and €70 of cost.
- To find a margin from price and cost: (price − cost) ÷ price. €150 price and €90 cost give 40%.
- When a payment fee is a percentage of the price, include it: price = fixed costs ÷ (1 − margin − fee %).
Profit margin in Excel and Google Sheets
A sheet with one row per product (or per month) and a column per cost is enough to start. The formulas are the same in Excel and Google Sheets.
- Lay out the columns
A: product, B: price, C: units, D: cost per unit, E: shipping per unit, F: revenue, G: total cost, H: profit, I: margin. Put the payment fee % in one fixed cell, for example K1.
- Add the formulas in row 2
Revenue, total cost including the fee, profit and margin, as in the block below.
- Format the margin as a percentage
Format › Number › Percent in Sheets, or the % button in Excel. Without it, 0.32 looks like a rounding error.
- Copy the row down
The $ signs keep K1 fixed while the other references move with each row.
- Add a totals row
Sum revenue and profit, then divide the totals. Never average the margins of the rows: a small product would count as much as a bestseller.
F2 =B2*C2 revenue G2 =C2*(D2+E2)+F2*$K$1 total cost, with the payment fee from K1 H2 =F2-G2 profit I2 =IF(F2=0,"",H2/F2) margin (format as %) L2 =(D2+E2)/(1-M2-$K$1) price for the target margin in M2
Common mistakes in profit margin calculations
- Dividing by cost instead of revenue. That gives markup, which is always higher than margin.
- Using gross sales. Discounts and refunds lower what you really earned; subtract them first.
- Leaving out "small" costs. Packaging, payment fees, app subscriptions and returns shipping each look minor and together often take several points of margin.
- A product cost entered once and never updated. A new supplier price, a currency move or a tariff changes it; keep the date each cost applies from.
- Mixing periods. Ad spend from the ad platform's time zone and orders from the shop's can put one day's costs in another day.
- Counting stock purchases as COGS. Only the cost of units sold belongs in the period's margin.
- Averaging percentages. Sum the euros, then divide.
- Typing errors and broken references. A wrong cell or a missing $ sign quietly changes every row below it.
Where a spreadsheet stops working
A spreadsheet is fine for a first calculation and for checking a price. It gets harder as the store grows, for four reasons:
- Manual input. Orders, refunds, carrier invoices, fees and ad spend have to be exported and pasted from several places every time.
- Static formulas. The sheet does not change when a new order comes in, a cost changes or spend spikes; it is right as of the last update.
- Missing and changing costs. Per-order shipping, a payment fee that differs per gateway, a refund weeks later: these are hard to put on the right row.
- Scale. Hundreds of variants and thousands of orders make the sheet slow and the errors hard to see.
| Use a spreadsheet when | Move to an automated view when |
|---|---|
| You have a handful of products and orders a day | You have many variants, channels or stores |
| Costs rarely change | Product, shipping or ad costs change month to month |
| You check margins once a month | You decide ad budgets weekly or daily |
How to see profit margin per product in ROASaurus
ROASaurus calculates the margins above from your store's orders, the product costs you enter or sync, your shipping and fee rules, and the ad spend it imports. Profit › Products shows them per product and per variant.
Profit › Products- Enter product costs under Settings › Costs › Product costs, per variant and with the date a cost applies from, or import them by CSV. On Shopify, the cost per item you already entered is used.
- Set shipping rules and payment fees per gateway under Settings › Costs › Cost settings.
- Open Profit › Products and choose By product or By variant and the period.
- Read revenue, refunds, COGS, gross profit, shipping and fees, CM2, net margin, refund rate, ad spend, CM3 and POAS per row; click a column header to sort.
- For a single order, open Profit › Orders › Profit per order to see its revenue, costs, margin and contribution.

Profit › Overview shows the same margins for the whole store, and Profit › P&L as a statement by day or month.
Start freeOpen the live demo14-day trial of every feature, no credit card.