A margin calculator answers one question: how much of each sale do you keep? Margin is profit divided by the selling price, markup is profit divided by the cost, and confusing the two is one of the most expensive mistakes in pricing. A $100 product sold at $150 has a 50% markup but only a 33.3% margin.
This guide gives you the formulas, a markup vs margin conversion table, the contribution margin per sale, how to set a price for the margin you want and how margin decides what you can afford to pay for a customer in Google Ads or Meta Ads.
Markup vs margin: the one-line definitions
Margin (gross margin) is the share of the selling price that is left after paying for the product. Markup is how much you add on top of the cost to reach the price. Both start from the same profit per unit; only the denominator changes.
Margin % = (price minus cost) ÷ price × 100Markup % = (price minus cost) ÷ cost × 100
Use prices excluding sales tax or VAT on both sides. The tax passes through your hands but is not part of your profit.
Suppose (hypothetically) you buy a product for $100 and add a 50% markup:
- Price: $100 × 1.50 = $150
- Profit per unit: $150 minus $100 = $50
- Markup: $50 ÷ $100 = 50%
- Margin: $50 ÷ $150 = 33.3%
Same $50, two percentages. Your supplier, your accountant and your sales team may each use a different one, so always say which one you mean.
Margin calculator: try your own numbers
Enter the cost and the selling price excluding tax. The calculator shows profit per unit, margin and markup. Add a target margin to see the price you would need.
Margin and markup calculator
Enter prices without VAT or sales tax: the result updates as you type.
The gross margin formula for your whole business
The same logic works on totals. Gross margin compares your revenue with the cost of goods sold (COGS) over a month or a year.
Gross margin % = (revenue minus COGS) ÷ revenue × 100
If your shop sells $50,000 in a month and the products cost you $30,000, gross profit is $20,000 and gross margin is 40%. This is the number your accountant reports, and the one to use when you judge marketing ROI on gross profit.
For a service business, COGS is the direct cost of delivering the work: freelancers, materials, hours of staff assigned to the job. Rent, software and your own salary are not part of it; they belong to fixed costs.
Markup to margin conversion table
You can switch between the two without knowing the price:
Margin = markup ÷ (1 + markup)Markup = margin ÷ (1 minus margin)
| Markup on cost | Margin on price | Price for a $100 cost |
|---|---|---|
| 25% | 20.0% | $125 |
| 33.3% | 25.0% | $133.33 |
| 50% | 33.3% | $150 |
| 66.7% | 40.0% | $166.67 |
| 100% | 50.0% | $200 |
| 150% | 60.0% | $250 |
| 200% | 66.7% | $300 |
| 300% | 75.0% | $400 |
Two things to notice. Margin can never reach 100%, while markup has no ceiling. And at low values the two are close (a 25% markup is a 20% margin), while at high values they drift far apart. That is why the confusion costs little on cheap commodities and a lot on products with big markups.
How to set a price for a target margin
Most pricing mistakes come from this step. You want a 40% margin on a product that costs $60, so you add 40%: $60 × 1.40 = $84. The real margin is $24 ÷ $84 = 28.6%, not 40%.
The correct formula divides instead of multiplying:
Price = cost ÷ (1 minus target margin)
With $60 and 40%: $60 ÷ 0.60 = $100. Profit is $40, which is 40% of $100. Compared with the wrong price, you keep $16 more on every unit.
A quick routine for each product:
- Take the full unit cost: purchase price plus inbound shipping and any duties.
- Choose the margin you need, based on your fixed costs and your marketing (more on that below).
- Divide the cost by (1 minus the margin).
- Compare the result with competitors and round to a sensible price point.
- Check the margin again after any discount: a 10% discount on a 40% margin product leaves a 33.3% margin, because the cost stays the same.
Contribution margin: what each sale really leaves you
Gross margin only subtracts the product cost. But every online sale has other costs that grow with each order: shipping to the customer, packaging, payment fees, marketplace commissions. Contribution margin is the price minus all these variable costs.
Contribution margin per sale = price minus all variable costs per sale
A hypothetical online order at $100 excluding tax:
| Line | Amount | Share of price |
|---|---|---|
| Selling price (excl. tax) | $100 | 100% |
| Product cost | $60 | 60% |
| Gross profit | $40 | 40% |
| Shipping to the customer | $6 | 6% |
| Payment fees | $2 | 2% |
| Packaging | $2 | 2% |
| Contribution margin | $30 | 30% |
A 40% gross margin has become 30% once the order is shipped and paid. That $30 is what each sale contributes to your rent, salaries, software and advertising. If you want to know how many of these sales cover your monthly fixed costs, the break-even point guide continues from here.
Why margin decides your max CPA and break-even ROAS
This is where margin meets your ad accounts. The contribution margin per sale is the most you can pay to win that sale without losing money on it.
Max CPA = contribution margin per saleBreak-even ROAS = 1 ÷ contribution margin %
With the order above, max CPA is $30 and break-even ROAS is 1 ÷ 0.30 = 3.33. A campaign with a ROAS of 3 sells at a loss on every order, even if 3 sounds like a good number. A campaign at ROAS 4 leaves $10 on each $100 sale after the ad cost.
Look at what happens if you use the wrong margin:
| Margin used | Max CPA | Break-even ROAS | Effect |
|---|---|---|---|
| Markup 66.7% (wrong) | $66.70 | 1.5 | you pay far too much per sale |
| Gross margin 40% | $40 | 2.5 | still too optimistic |
| Contribution margin 30% | $30 | 3.33 | the real limit |
Google Ads describes Target ROAS as the average conversion value you want for each dollar spent (About Target ROAS bidding). If you set that target from markup or gross margin, the bidding will happily buy sales that lose money. Also check what your conversion value contains: if your shop sends order values with tax or shipping included, the ROAS in the platform is higher than the one you should compare with your break-even. The ROAS guide covers how to read the metric itself.
Max CPA per order is a ceiling for one sale. If customers buy again, you can afford to pay more for the first order, which is the logic behind customer acquisition cost compared with lifetime value.
How to check your margins every month
Margins move without anyone deciding it: suppliers raise prices, shipping rates change, discounts pile up. A short monthly check is enough:
- Gross margin of the month from your accounts or shop backend, next to the previous month.
- Average discount given, because it eats margin directly.
- Contribution margin per order for your main products or your average order.
- Break-even ROAS recalculated from that contribution margin, then compared with the actual ROAS of each ad platform.
Klyrax shows the ROAS and spend of Google Ads, Meta Ads and Microsoft Ads in one summary, so the last step takes a minute instead of three logins. Your margin stays your own input: no ad platform knows what a product costs you.
Common mistakes with margin and markup
- Adding the target margin to the cost. $60 + 40% is a 28.6% margin. Divide by (1 minus margin).
- Mixing prices with and without tax. Always compare cost and price excluding tax.
- Calling markup "margin" in conversations with suppliers. Agree on the definition before negotiating.
- Stopping at gross margin. Shipping, fees and packaging can take ten points or more off what you keep.
- Setting ad targets from the wrong number. Max CPA and break-even ROAS come from contribution margin.
- Forgetting discounts. A promotion changes the price, not the cost, so the margin falls more than the discount suggests.
Know your contribution margin per sale, price with the division formula and set your ad targets from it. Those three habits protect more profit than most campaign optimizations.
Frequently asked questions
What is the difference between markup and margin?
Both use the same profit, but divide it by different numbers. Margin divides profit by the selling price, markup divides it by the cost. With a $100 cost and a $150 price, profit is $50: the markup is 50% ($50 ÷ $100) and the margin is 33.3% ($50 ÷ $150). Margin is always lower than markup for the same product.
What is the gross margin formula?
Gross margin = (revenue minus cost of goods sold) ÷ revenue × 100. If you sell a product for $100 excluding sales tax and it costs you $60 to buy or make, gross profit is $40 and gross margin is 40%. Use prices without sales tax or VAT, because the tax is not yours.
How do I calculate the price for a 40% margin?
Price = cost ÷ (1 minus target margin). With a cost of $60 and a 40% target margin, the price is $60 ÷ 0.60 = $100. Do not multiply the cost by 1.40: that gives $84, which is a 40% markup but only a 28.6% margin. The difference is $16 of profit on every unit.
How do I convert markup to margin?
Margin = markup ÷ (1 + markup). A 50% markup becomes 0.50 ÷ 1.50 = 33.3% margin. The other way round, markup = margin ÷ (1 minus margin): a 40% margin needs 0.40 ÷ 0.60 = 66.7% markup. A 100% markup, doubling the cost, is a 50% margin.
What is a good profit margin?
There is no single good figure. Gross margins vary widely by sector: resellers of electronics often work on thin margins, while software, services and own-brand products can keep much more of each sale. Compare your margin with your own previous months and check that the contribution margin covers your fixed costs and your marketing.
See how your marketing is really doing
Klyrax connects GA4, Search Console, Google Ads, Meta Ads, your Google reviews and more in read-only mode, shows the numbers that matter for your business and writes you a plain-language report every month.
Request info