The profit margin formulas
Profit margin is the share of a sale you keep as profit. Gross margin looks only at the product: the price minus what the product costs you, as a share of the price. Net profit margin goes further and also subtracts shipping, payment fees, refunds, other order costs and the ad cost of the order.
Use the selling price after discounts and without sales tax or VAT. That tax is collected for the tax authorities, so it is not revenue your store keeps. If your prices include VAT, divide them by 1 plus the VAT rate first.
Gross margin = (price − product cost) ÷ price
Markup = (price − product cost) ÷ product cost
Net profit = price − refunds − product cost − shipping − payment fees − other costs − ad cost
Net profit margin = net profit ÷ (price − refunds)
Shopify uses the same gross margin formula for the projected margin in a product’s Price section, based on the Cost per item you enter. The net profit margin divides by the price after refunds, because refunded money is not revenue you keep. WeProfit’s Margin works the same way: net profit ÷ (revenue − refunds).
Worked example: from price to net profit margin
Illustrative calculation, not a customer result. Take an order with a selling price of $50.00, without sales tax or VAT. Its products cost $20.00, shipping costs $3.50, the payment fee is $2.00 (3.4% plus $0.30), and refunds average 5% of revenue, or $2.50 per order. The ads cost $10.00 per order: $1,000 of ad spend for 100 orders.
The gross margin is ($50.00 − $20.00) ÷ $50.00 = 60%, a markup of 150% on the product cost. After refunds, $47.50 of revenue is left. Profit before ad spend is $22.00, and net profit after the ad cost is $12.00: a net profit margin of $12.00 ÷ $47.50 = 25.3%.
| Line | Per order | 100 orders |
|---|---|---|
| Selling price | $50.00 | $5,000 |
| Refunds | −$2.50 | −$250 |
| Revenue after refunds | $47.50 | $4,750 |
| Product costs | −$20.00 | −$2,000 |
| Shipping | −$3.50 | −$350 |
| Payment fees | −$2.00 | −$200 |
| Profit before ad spend | $22.00 | $2,200 |
| Ad spend | −$10.00 | −$1,000 |
| Net profit | $12.00 | $1,200 |
| Net profit margin | 25.3% | 25.3% |
These are the numbers of Campaign A in the ROAS vs POAS guide: $5,000 of revenue, $1,000 of ad spend and $1,200 of net profit, which is 25.3% of the $4,750 left after refunds.
Profit margin vs markup
Margin and markup start from the same profit but divide it by different numbers: margin by the price, markup by the cost. A product that costs $20.00 and sells for $50.00 makes $30.00 of gross profit, which is a 60% margin and a 150% markup.
For a product sold at a profit, markup is always the higher number, because the cost is lower than the price. To turn one into the other, write both as decimals:
Margin = markup ÷ (1 + markup)
Markup = margin ÷ (1 − margin)
| Markup | Gross margin |
|---|---|
| 25% | 20% |
| 50% | 33.3% |
| 100% | 50% |
| 150% | 60% |
| 200% | 66.7% |
| 300% | 75% |
The two are easy to mix up: a 50% markup is a gross margin of only 33.3%, and shipping, fees, refunds and ads still have to come out of it.
Which Shopify costs to include
Count every cost that comes with an order. For a Shopify store, these are the numbers to look up:
- Product cost. What you pay for the products in the order. In Shopify, this is the Cost per item of each product or variant: the cost to you, without taxes, shipping or other costs. If you make the product yourself, use your material and labor costs.
- Shipping. What you pay to send the order, such as the carrier’s label. If customers pay for shipping at checkout, that amount is part of the selling price.
- Payment fees. The percentage and fixed fee your payment provider keeps. Shopify Payments rates depend on your Shopify plan and market, and payments through a third-party provider can also carry Shopify’s third-party transaction fee, which depends on your plan.
- Refunds. The share of revenue you pay back. The calculator still counts the product cost, shipping and payment fee of a refunded order, as when the items do not come back into stock. With Shopify Payments, the original card fee is not returned when you refund an order.
- Ad cost. Your ad spend divided by the orders it brought in. Leave it empty to see what an order leaves before advertising.
- Other order costs. Packaging, fulfillment fees and apps that charge per order.
Leave out sales tax or VAT, and costs that do not come with each order, such as your Shopify plan and monthly app subscriptions. Those are overhead, which a margin per order does not cover.
The price you need for a target margin
Turn the net profit margin formula around to find the price that keeps the margin you want. Add up the costs that do not depend on the price, then divide them by what is left of each unit of price after refunds, payment fees and your target margin.
Price = (product cost + shipping + fixed fee + other costs + ad cost) ÷ ((1 − refund rate) × (1 − target margin) − fee rate)
For the worked example and a 30% target: ($20.00 + $3.50 + $0.30 + $10.00) ÷ ((1 − 5%) × (1 − 30%) − 3.4%) = $33.80 ÷ 0.631 = $53.57.
Some targets cannot be reached at any price. Payment fees and refunds take a percentage of every sale, so even a very high price leaves a net margin below 1 − fee rate ÷ (1 − refund rate): 96.4% in the worked example. If the price you would need is more than customers will pay, the margin has to come from lower costs instead.
From margin to break-even ROAS
Profit before ad spend is the most an order can spend on ads without losing money. In the worked example it is $22.00, or 44% of the $50.00 price, so the ads break even at a ROAS of $50.00 ÷ $22.00 = 2.27x. Your ads then have to bring in at least $2.27 of revenue for every $1 they cost.
The break-even ROAS calculator takes the same order costs and shows that floor for your numbers. To check a running campaign against it, use the ROAS calculator.
What the calculator leaves out
The calculator works out the margin of one order. It leaves out costs that do not grow with each order: rent, salaries, your Shopify plan, software and app subscriptions, income taxes and other overhead. A good margin per order still has to pay for those before the business itself makes a profit.
It also works with averages. Real orders differ in size, product mix, discounts and refunds, and refunded items that go back into stock can be sold again. Check the margin of your main products one by one before you set prices or ad budgets.
Track profit per order with real costs
A calculator starts from one average order. WeProfit puts ad spend, product costs, refunds, fees and shipping next to the revenue of your orders. On Shopify it can import each variant’s Cost per item, and you can also enter costs per product or variant, upload a CSV, or set a default cost percentage for products without a cost. See how to add product costs.
Each order’s profit is labelled exact, partial or estimated, so you can see how much of it rests on saved costs. The Orders page shows each order’s profit before ad spend, the Margin card divides net profit by revenue minus refunds, and saving a cost recalculates past orders.
See how WeProfit profit analytics calculates net profit, or compare plans and pricing. You can try WeProfit free for 14 days.
Profit margin questions
What is a good profit margin for a Shopify store?
There is no single number: margins depend on the product, the price and what it costs to win each order. Start with the gross margin, then check that the net profit margin stays positive once shipping, payment fees, refunds and the ad cost per order are paid, with enough left for overhead. A store that pays for most of its orders with ads needs a higher gross margin than one whose customers come back on their own.
What is the difference between profit margin and markup?
Margin divides profit by the selling price, markup divides it by the cost. A product that costs $20.00 and sells for $50.00 has a 60% gross margin and a 150% markup. Margin = markup ÷ (1 + markup), and markup = margin ÷ (1 − margin).
How do I calculate profit margin on Shopify?
Enter each product’s Cost per item in Shopify. Subtract the cost from the selling price and divide by the price for the gross margin. For the net profit margin, also subtract shipping, payment fees, refunds, other order costs and the ad cost per order, then divide by the price minus refunds. The calculator above does both.
Should the selling price include sales tax or VAT?
No. Sales tax and VAT are collected for the tax authorities, so they are not revenue you keep. Enter the price without them: if your prices include VAT, divide them by 1 plus the VAT rate, for example by 1.2 at a 20% rate.
Why does the net profit margin divide by revenue after refunds?
Because refunded money is not revenue you keep. WeProfit’s Margin works the same way: net profit ÷ (revenue − refunds). Divided by the full price instead, the worked example’s $12.00 of net profit would be a 24% margin rather than 25.3%.
Why does Shopify’s profit report show a different margin?
Shopify’s profit reports work out gross margin on net sales, after discounts and refunds, and count profit only for products and variants that had a cost recorded when they sold. The reports by product and by variant subtract only that cost, while the reports by order and by market also count the shipping, duties and import taxes your store paid. The net profit margin here subtracts every cost you enter, the ad cost per order included, so it usually comes out lower.
Does the calculator include my Shopify plan and app subscriptions?
No. Monthly fees do not come with each order, so they count as overhead. To include them anyway, divide the monthly total by your orders per month and add the result to other costs per order.