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.

Updated · 12 min read

By the ROASaurus team

The short answer
  • 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.

Profit margin (%)=(revenue − costs) ÷ revenue × 100
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.

MarginCosts subtractedFormulaWhat it tells you
Gross marginCost of goods sold (COGS)(revenue − COGS) ÷ revenueWhether your products are priced well against what they cost you.
Contribution marginCOGS plus every cost that moves with an order: shipping, packaging, payment fees, often ad spend(revenue − variable costs) ÷ revenueWhat each sale leaves to pay for the business.
Operating marginCOGS plus all operating expenses: fulfilment, marketing, staff, software, rentoperating profit ÷ revenueWhether running the store is profitable before financing and tax.
Net marginEverything, including interest, depreciation and income taxnet profit ÷ revenueWhat the business keeps in the end.
Contribution margin is not on a classic income statement, but for a webshop that spends on ads it is often the most useful of the four.

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

  1. Take net revenue

    Sales after discounts and refunds, without VAT or sales tax.

  2. 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.

  3. Divide by revenue and multiply by 100

    The result is gross profit as a share of revenue.

Gross margin for one monthSample data
Net revenue€80,000
Cost of goods sold−€28,000
Gross profit€52,000
Gross margin (52,000 ÷ 80,000)65.0%
Example data for a fictional store.

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

  1. Start from gross profit

    Revenue minus COGS, as above.

  2. 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.

  3. Divide operating profit by revenue

    Multiply by 100 for the percentage.

Operating margin for the same monthSample data
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%
Example data for a fictional store. Operating expenses total €42,000.

How to calculate net profit margin

  1. Start from operating profit

    The result of the step above.

  2. Subtract interest, depreciation and income tax

    And add any income that is not from selling products, such as interest received.

  3. Divide net profit by revenue

    This is the net profit margin, the bottom line as a share of sales.

Net margin for the same monthSample data
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%
Example data for a fictional store.

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.

Contribution margin (%)=(revenue − COGS − shipping − packaging − payment fees − ad spend) ÷ revenue × 100
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.

  1. Set the selling price

    What a customer pays for one unit, without VAT and after the usual discount if most sales are discounted.

  2. 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.

  3. Subtract and divide

    Profit per unit ÷ price × 100 gives the product margin.

  4. 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.

Profit per unit: Hydrating SerumSample data
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
Example data for a fictional product of the ROASaurus Demo Store.

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.

One order, from revenue to contributionSample data
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
Example data for a fictional order. Payment fee: 2% of €62.95 plus €0.25.

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:

Revenue includes
  • Product sales after discounts
  • Shipping charged to customers
  • Other operating income, such as a supplier rebate
  • Minus refunds and returns
Expenses include
  • 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.

Price for a target margin=cost ÷ (1 − target margin)

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.

  1. 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.

  2. Add the formulas in row 2

    Revenue, total cost including the fee, profit and margin, as in the block below.

  3. 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.

  4. Copy the row down

    The $ signs keep K1 fixed while the other references move with each row.

  5. 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.

Excel and Google Sheets
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 whenMove to an automated view when
You have a handful of products and orders a dayYou have many variants, channels or stores
Costs rarely changeProduct, shipping or ad costs change month to month
You check margins once a monthYou 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.

In ROASaurusProfit › Products
  1. 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.
  2. Set shipping rules and payment fees per gateway under Settings › Costs › Cost settings.
  3. Open Profit › Products and choose By product or By variant and the period.
  4. 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.
  5. For a single order, open Profit › Orders › Profit per order to see its revenue, costs, margin and contribution.
The ROASaurus Mac app showing Profit › Products: the POAS of every product with its trend, by product or by variant. Fictional demo store, simulated data.
The ROASaurus iPhone app showing Profit › Products: the POAS of every product with its trend, by product or by variant. Fictional demo store, simulated data.
Profit › Products: units, revenue, refunds, COGS, gross profit, CM2, net margin, ad spend, CM3 and POAS per product. Fictional demo store, simulated data.

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.

Sources

  1. Shopify Help Center: profit reports

More guides on profit and finance · All guides

FAQ

Questions, answered

More answers in the FAQ and the help center.

What is the formula for profit margin?

Profit margin = (revenue − costs) ÷ revenue × 100. Use COGS only for gross margin, all operating costs for operating margin, and every cost including interest and tax for net margin.

How do you calculate gross profit margin?

Subtract the cost of goods sold from net revenue, divide by net revenue and multiply by 100. With €80,000 revenue and €28,000 COGS, gross margin is 65%.

How do you calculate net profit margin?

Subtract every cost from revenue (COGS, operating expenses, interest, depreciation and tax), then divide the net profit by revenue. It is the margin the business keeps in the end.

How do you calculate a 20% margin?

Divide the cost by 0.80. A product that costs €40 needs a price of €50 for a 20% margin. Adding 20% to the cost gives a markup, which is a lower margin.

What is a 30% margin on $100?

A 30% margin on a $100 price is $30 of profit, so costs are $70. If $100 is the cost instead, the price for a 30% margin is $100 ÷ 0.70, about $142.86.

What is the difference between profit and margin?

Profit is an amount (€12.95 per unit); margin is that profit as a share of revenue (32.4%). Margin lets you compare products and periods of different size.

How do you calculate profit per unit?

Selling price per unit minus the cost per unit. For a useful figure, include shipping, packaging, the payment fee and the unit's share of ad spend, not only the purchase price.

How do you calculate profit margin in Excel or Google Sheets?

Put revenue in one cell and costs in another, then use =(revenue−cost)/revenue and format the cell as a percentage. Wrap it in IF(revenue=0,"",…) to avoid division errors, and sum totals before dividing.

How do I calculate profit in a business?

Total revenue minus total expenses for the same period. Start with sales after discounts and refunds, subtract cost of goods, order costs, marketing, overheads, interest and tax; the result is net profit.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.