Margin is the share of a selling price left after subtracting the cost included in your calculation. For a product sold for $100 with a $60 cost, the profit is $40 and the margin is 40%.
MarginWhat is margin? Formula, target pricing, and discount impact
The denominator is the key:
Margin is not the same as markup. Markup divides profit by cost; margin divides profit by selling price.
The formula: profit divided by selling price
Let:
A 20% price cut is not a 20% profit cut
Margin divides profit by price. A price cut shrinks the numerator and the denominator at once, so profit dollars fall faster than the discount looks.
- Price
- $100
- -Cost
- $60
- Profit
- $40
- Margin (profit / price)
- 40%
- Markup (profit / cost)
- 66.7%
- Price
- $80
- -Cost
- $60
- Profit
- $20
- Margin (profit / price)
- 25%
Then:
Margin = $40 / $100 = 40%Shopify uses the same item-level structure for projected product margin: (price - cost) / price. The formula is simple. The harder part is deciding what cost means for the question you are answering.
If your product system's cost field contains only acquisition or manufacturing cost, then the displayed item margin is a product-cost margin. It does not automatically include payment fees, fulfillment, shipping subsidies, returns, advertising, staff, rent, or overhead.
2 merchants can therefore quote different "margin" figures for the same sale and both be mathematically correct if they included different cost layers. Define the cost scope before comparing the percentage.
Margin vs markup
Using the same $100 selling price and $60 cost:
Profit = $40Margin = $40 / $100 = 40%Markup = $40 / $60 = 66.7%
That difference creates real pricing mistakes. If a product costs $60 and you "add 40%" to cost, you get:
$60 × 1.40 = $84But $84 does not produce a 40% margin:
($84 - $60) / $84 = 28.6%A 40% markup and a 40% margin are different targets.
| Option | Metric | Formula | Denominator | $100 price / $60 cost |
|---|---|---|---|---|
| Profit dollars | Profit dollars | Price - Cost | none | $40 |
| Margin | Margin | Profit / Price | Selling price | 40% |
| Markup | Markup | Profit / Cost | Cost | 66.7% |
How to price for a target margin
Rearrange the margin formula:
Target price = Cost / (1 - Target margin)For a $60 cost and a 40% target margin:
$60 / (1 - 0.40)= $60 / 0.60= $100
For a 30% target margin:
$60 / 0.70 = $85.71This is safer than repeatedly guessing markup percentages until the margin looks right. One constraint matters: target margin must be expressed as a decimal below 1. A 100% margin with a positive cost cannot be reached at a finite selling price because some of the price must still cover the cost.
Why discounts damage margin faster than they look
Start again with:
Price: $100Cost: $60Profit: $40Margin: 40%
Now discount the selling price by 20% while cost stays $60:
Discounted price: $80Cost: $60Profit: $20Margin: 25%
The customer got a 20% price discount, but your profit dollars fell 50%. This happens because the discount comes out of the portion of the price that used to cover profit after cost. It is why a promotion can grow revenue or conversion while producing much less gross profit per unit.
A useful shortcut follows from the same math. If the only cost in the calculation is fixed at $60 and the original price is $100, the maximum discount before unit profit reaches zero is 40% of the original price. That equals the original 40% margin in this simplified case. In real operations, do not call that the true "break-even discount" if there are additional variable costs outside the product-cost field.
Projected margin vs realized gross margin
A catalog can show one margin while reports later show another. At product setup time, a merchant may compare list price with recorded cost per item. During actual sales, discounts and refunds change net sales. Shopify's profit reporting, for example, calculates reported gross margin from net sales and cost, and explicitly notes that discounts and refunds can make the reported margin differ from the product details page. Example:
Catalog price: $100Cost: $60Projected margin: 40%
If the item actually sells for $80 after discount:
Net selling price before other adjustments: $80Cost: $60Realized product margin: 25%
This is why the question "what is our margin?" should include a time and data scope. Are you discussing the planned margin at list price, the realized gross margin on orders, or a broader contribution/net metric after additional costs?
The formula
Margin = (Selling price - Cost) / Selling price × 100Worked example
A merchant sells a bag for $120 and records $72 as product cost.
- Regular margin:
($120 - $72) / $120 = 40%- The merchant wants at least a 25% margin using the same cost scope. Solve for the minimum selling price:
Price = $72 / (1 - 0.25) = $72 / 0.75 = $96
- The largest discount from the $120 list price that still preserves a 25% margin is therefore:
($120 - $96) / $120 = 20%A 25% discount would drop the selling price to $90 and margin to 20%:
($90 - $72) / $90 = 20%That is why discount planning should start from the required post-discount margin, not from a psychologically appealing promotion percentage.
What passes and what does not
- Suppose 2 products produce:
- The simple average of 60% and 20% is 40%, but the store did not earn a 40% margin
- Aggregate the dollars first:
Total sales = $1,000 Total profit = $240 Overall margin = $240 / $1,000 = 24%- Product B represents far more sales, so its lower margin has more weight
- The general rule is:
Combined margin = Total profit / Total relevant sales- not:
Average of item margin percentages- This distinction matters when evaluating product mix, category performance, or a promotion spanning SKUs with different economics
Common mistakes
- Dividing profit by cost and calling the result margin
- Adding a target margin percentage to cost as if it were markup
- Comparing margin numbers that use different cost definitions
- Using list-price margin to judge sales that were heavily discounted
- Ignoring refunds when evaluating realized period margin
- Averaging SKU margin percentages without weighting by sales
- Treating gross/product margin as net profit after every operating expense
- Assuming a "good margin" is universal across products, categories, and business models
Comparison
Do not average SKU margin percentages
| Option | Product | Sales | Profit | Margin |
|---|---|---|---|---|
| A | A | $100 | $60 | 60% |
| B | B | $900 | $180 | 20% |
Questions we get asked
What is a 40% margin?
It means 40% of the relevant selling price remains after subtracting the cost included in that margin calculation. If an item sells for $100 and the defined cost is $60, the margin is 40%.
Is 40% margin the same as 40% markup?
No. At a $100 price and $60 cost, margin is 40% while markup is 66.7%. They use different denominators.
What price gives me a 30% margin?
Use price = cost / (1 - target margin). For a $60 cost and a 30% target margin, the price is about $85.71.
Why did my reported margin fall even though product costs did not change?
Discounts and refunds can reduce net sales, lowering realized margin even when the recorded unit cost is unchanged. Also verify whether the report and product page use the same cost and sales definitions.
What is a good ecommerce margin?
There is no universal number. Product category, fulfillment model, return rate, acquisition cost, overhead, competitive positioning, and what expenses are included in the metric all matter. Start by defining the margin type and cost scope before benchmarking it.
OnVoard's take
Margin is most useful as a constraint for decisions, not a decorative percentage in a report.
For pricing and promotions, work backward from the margin you need after the discount. For reporting, aggregate profit and sales dollars rather than averaging percentages. And whenever someone quotes a margin, ask the most important follow-up question: which costs are included?
Every app on every plan. Connect your store and switch on the flows in an evening.