Short answer

A margin calculator works out profit margin: profit as a percentage of the selling price. Margin = (selling price - cost) / selling price × 100. Enter any two of cost, selling price, profit and margin, and Convertica's free margin calculator returns the rest, plus the markup. A product that costs 90 and sells for 150 has a 40% margin.

  • Margin measures profit against the selling price. Markup measures the same profit against the cost, so for a profitable sale the markup is always the larger number.
  • To price for a target margin, divide the cost by 1 minus the margin. Adding the margin percentage to the cost gives a lower margin than you wanted.
  • Gross, operating and net profit margin divide by the same revenue and subtract more costs at each step.
  • Gross margin sets break-even ROAS and break-even CPA, so it decides what a sale can cost to win.
  • There is no universal good margin: yours has to cover your own overheads and the cost of winning each sale.

Margin calculator

Free to use, no sign-up. Any currency. Change any field: the calculator keeps the last two you changed and works out the other two.

What the item costs you to buy or make.

What you charge. For a period, use revenue.

Selling price minus cost.

Profit as a share of the selling price.

Margin

40.00%

Worked out from a cost of 90 and a selling price of 150.

Profit: 150 - 90 = 60.

Margin: 60 ÷ 150 × 100 = 40.00%.

Markup: 60 ÷ 90 × 100 = 66.67%. It is the same profit, measured against the cost instead of the price.

Formula

margin = (selling price - cost) / selling price * 100
profit = selling price - cost
markup = profit / cost * 100

What is the margin formula?

The margin formula is profit divided by selling price, multiplied by 100: margin = (selling price - cost) / selling price × 100. It tells you what share of each sale is left after paying for what you sold. A product that costs 90 and sells for 150 leaves 60, and 60 / 150 is a 40% margin.

margin        = (selling price - cost) / selling price * 100
profit        = selling price * margin
selling price = cost / (1 - margin)
cost          = selling price * (1 - margin)

Profit margin, gross margin and gross profit margin all name this calculation when the only cost counted is the cost of what was sold. They part ways once other costs come out: see gross, operating and net margin below. Margin on this page always means profit margin on sales, not the margin a broker asks for in trading.

How to use the margin calculator

  1. Enter two numbers you know. Any two of cost, selling price, profit and margin. For a whole period, use revenue as the selling price and cost of goods sold as the cost.
  2. Read the margin. The result shows the margin, the arithmetic behind it and the markup on the same sale.
  3. Change one number. The calculator keeps the last two fields you changed, so you can raise the margin and watch the price, or cut the cost and watch the margin.
  4. Check the price you need. The target margin calculator shows the price for the margin you want and how far your current price is from it.

How to calculate profit margin: a worked example

To calculate profit margin, subtract the cost from the selling price, divide what is left by the selling price, and multiply by 100. The numbers below are the default values in the calculator, made up to show the arithmetic; they are not a benchmark.

  1. Cost: 90. Selling price: 150.
  2. Profit = 150 - 90 = 60.
  3. Margin = 60 / 150 × 100 = 40%. Of every 100 in sales, 40 is profit and 60 pays for the product.
  4. Markup = 60 / 90 × 100 = 66.67%: the same 60 of profit, measured against the cost.
  5. Check: cost / (1 - margin) = 90 / 0.60 = 150, the selling price again.

The step that goes wrong is the divisor. Divide the profit by the selling price and you have the margin. Divide it by the cost and you have the markup, which is the larger figure on any profitable sale.

How to calculate the selling price for a target margin

To find the selling price for a target margin, divide the cost by 1 minus the margin written as a decimal. For a 50% margin on a cost of 90, that is 90 / 0.50 = 180. Do not add the margin percentage to the cost: that is a markup, and it leaves a lower margin than you wanted.

Price for a target margin calculator

The price a cost needs to reach the margin you want, and how far your current price is from it.

Per unit, including every cost that rises with each sale.

Below 100%.

Compares the margin you have with the margin you want.

Selling price for a 50% margin

180.00

90 cost ÷ (1 - 50%) = 180.00.

Profit per sale: 180.00 - 90 = 90.00, which is 50.00% of the price.

As a markup: 90.00 ÷ 90 × 100 = 100.00% on cost.

Adding 50% to the cost is not the same thing: that gives 135.00, a margin of only 33.33%.

Your price of 150.00 gives a margin of 40.00%. Reaching 50% takes a price 30.00 higher (+20.0%), or a cost of 75.00 at the price you have now.

Formula

selling price = cost / (1 - target margin)

The mistake in numbers: a 40% margin on a cost of 90 needs a price of 150. Add 40% to the cost instead and the price is 126, where the margin is only 28.57%. The gap widens as the target rises, because the price has to carry its own margin as well as the cost.

The formula gives the price your costs need. Whether buyers will pay it is a separate question, and one worth testing before you commit: a higher price that sells less can leave you with less profit than the price you started with.

How is margin different from markup?

Margin and markup describe the same profit from two sides. Margin is profit as a percentage of the selling price; markup is profit as a percentage of the cost. On a product that costs 90 and sells for 150, the 60 of profit is a 40% margin and a 66.67% markup. Confusing the two underprices the product.

Margin and markup on the same sale (cost 90, selling price 150; illustrative numbers)
QuestionMarginMarkup
Profit is divided byThe selling priceThe cost
Formula(price - cost) / price × 100(price - cost) / cost × 100
On this sale60 / 150 = 40%60 / 90 = 66.67%
Can it pass 100%?No, unless the cost is below 0Yes: double the cost is a 100% markup
Mostly used forReporting profitability and setting ad targetsSetting a price from a cost

Margin to markup conversion table

To convert a margin to a markup, divide the margin by 1 minus the margin: markup = margin / (1 - margin). The table also shows what to divide a cost by to reach each margin, and the price that gives on a cost of 100.

Margin to markup, and the price each margin needs (arithmetic, not benchmarks)
MarginEqual markupDivide the cost byPrice on a cost of 100
5%5.26%0.95105.26
10%11.11%0.90111.11
15%17.65%0.85117.65
20%25.00%0.80125.00
25%33.33%0.75133.33
30%42.86%0.70142.86
35%53.85%0.65153.85
40%66.67%0.60166.67
45%81.82%0.55181.82
50%100.00%0.50200.00
60%150.00%0.40250.00
70%233.33%0.30333.33
75%300.00%0.25400.00
80%400.00%0.20500.00
90%900.00%0.101,000.00

Gross margin vs operating margin vs net profit margin

Gross margin, operating margin and net profit margin all divide a profit by the same revenue. What changes is how many costs have been subtracted first. Gross margin subtracts only the cost of goods sold. Operating margin also subtracts the cost of running the business. Net profit margin subtracts everything, including interest and tax.

Gross, operating and net margin calculator

Use figures for the same period. The example is a store that sold 1,000 units of the product above.

Sales for the period, net of refunds.

What the goods sold cost to buy or make.

Wages, rent, software, marketing. Adds operating margin.

Adds net profit margin. Enter 0 if there are none.

Net profit margin

10.00%

Gross margin: (150,000 - 90,000) ÷ 150,000 × 100 = 40.00%.

Operating margin: (60,000 - 37,500) ÷ 150,000 × 100 = 15.00%.

Net profit margin: (22,500 - 7,500) ÷ 150,000 × 100 = 10.00%.

Of every 100 of revenue, 60.00 pays for the goods sold, 25.00 for operating expenses and 5.00 for interest, tax and other costs, which leaves 10.00 of net profit.

The three margins on the same revenue
Gross margin40.00% (profit 60,000)
Operating margin15.00% (profit 22,500)
Net profit margin10.00% (profit 15,000)

Formulas

gross margin      = (revenue - cost of goods sold) / revenue * 100
operating margin  = (gross profit - operating expenses) / revenue * 100
net profit margin = (operating profit - interest, tax and other costs) / revenue * 100
The three margins on 150,000 of revenue (illustrative numbers)
MarginCosts subtractedIn the exampleWhat it answers
Gross marginCost of goods sold: products, materials and the direct cost of making or delivering them(150,000 - 90,000) / 150,000 = 40%Does each sale earn enough to be worth making?
Operating marginThe above, plus operating expenses: wages, rent, software, marketing and advertising(60,000 - 37,500) / 150,000 = 15%Does the business pay its running costs?
Net profit marginThe above, plus interest, tax and anything else(22,500 - 7,500) / 150,000 = 10%What is finally left for the owners?

Where a cost sits is decided by your own accounts, and it moves the margins. Payment fees and outbound shipping, for example, are part of cost of goods sold in some stores' books and an operating expense in others. Keep the same treatment from period to period, and check the definition before you compare your margin with anyone else's.

Which margin should you use?

  • Pricing a product or setting an ad target: gross margin, after every cost that rises with each order.
  • Judging how the business runs: operating margin, because it includes the overheads a price has to carry.
  • Judging what the business earns: net profit margin, the only one that counts every cost.

Get your free CRO audit

Enter your website and email and the audit starts right away. Watch it check your page live: eight checks, each scored out of 100, and three fixes you can make now.

How gross margin decides what you can pay for a sale

Gross margin sets the ceiling on what a sale can cost to win. Break-even CPA is the order value multiplied by gross margin, and break-even ROAS is 1 divided by gross margin. At a 40% margin on a 150 order, an order that costs more than 60.00 in advertising loses money, and so do ads that return less than 2.50.

Follow the same product through a paid campaign. For this, use the margin after every cost that rises with each order: the product, shipping, payment fees, packaging and returns.

  1. The product costs 90 and sells for 150: 60 of gross profit an order, a 40% gross margin.
  2. Break-even CPA = 150 × 0.40 = 60.00, the gross profit on one order. Break-even ROAS = 1 / 0.40 = 2.50.
  3. Ads bring 2,000 clicks at 2.50 each: 5,000 of ad spend.
  4. At a 4.00% conversion rate, those clicks become 80 orders: 12,000 of revenue and 4,800 of gross profit. After the ads, that is a loss of 200. CPA is 62.50 and ROAS is 2.40, both on the wrong side of break-even.
  5. At 5.00%, the same clicks and the same spend become 100 orders: 6,000 of gross profit, and 1,000 left after the ads. CPA is 50.00 and ROAS is 3.00.

Neither the margin nor the ad budget changed between the last two steps. One more order from every hundred clicks moved the result by 1,200. The campaign breaks even at a conversion rate of 4.17%: the cost per click divided by the break-even CPA.

Profit after 5,000 of ad spend by conversion rate, at a 40% gross margin (2,000 clicks; illustrative numbers)
Conversion rateOrdersRevenueGross profitCPAProfit after ads
3.00%609,0003,60083.33-1,400
4.00% (the example)8012,0004,80062.50-200
5.00%10015,0006,00050.00+1,000
6.00%12018,0007,20041.67+2,200

Margin moves the same line from the other side. Here is the 150 product again at different costs, with what each margin lets the store pay for an order:

What each gross margin allows on a 150 order (arithmetic, not benchmarks)
Gross marginCostBreak-even CPABreak-even ROASConversion rate needed at a 2.50 cost per click
20%12030.005.008.33%
30%10545.003.335.56%
40% (the example)9060.002.504.17%
50%7575.002.003.33%
60%6090.001.672.78%

Work out your own lines with the ROAS calculator and the CPA formula and calculator, and your current rate with the conversion rate calculator. The guide to ecommerce metrics shows where gross margin sits among the other numbers a store tracks. To find what is holding your conversion rate down, Convertica's free CRO audit checks the page your ads send people to and ranks the fixes by likely impact.

How does a discount change your margin?

A discount comes straight out of profit, because the cost does not fall with the price. Take 10% off a 150 product that costs 90 and the price drops to 135, the profit from 60 to 45 and the margin from 40% to 33.33%. It then takes 33.3% more orders to earn the same gross profit.

Margin after a discount on a 150 product that costs 90 (illustrative numbers)
DiscountPriceProfit per orderMarginExtra orders needed for the same gross profit
None150.0060.0040.00%0.0%
5%142.5052.5036.84%+14.3%
10%135.0045.0033.33%+33.3%
15%127.5037.5029.41%+60.0%
20%120.0030.0025.00%+100.0%
25%112.5022.5020.00%+166.7%
30%105.0015.0014.29%+300.0%

This is how a sale can lift the conversion rate and still earn less. Before you run one, compare the extra orders you expect with the last column. A change to the page that lifts the conversion rate at full price has no such hurdle: every extra order keeps the whole margin.

How to calculate margin in Excel or Google Sheets

To calculate margin in Excel or Google Sheets, put the cost in A2 and the selling price in B2, enter =(B2-A2)/B2 in another cell and format it as a percentage. The same formulas work in both programs. In the table, C2 holds a margin and D2 a markup, each formatted as a percentage.

Margin formulas for a spreadsheet (cost in A2, selling price in B2, margin in C2, markup in D2)
To getFormulaNote
Margin=(B2-A2)/B2Format the cell as a percentage
Margin, with empty rows left blank=IF(B2=0,"",(B2-A2)/B2)Avoids a divide-by-zero error where there is no price
Profit=B2-A2An amount, not a percentage
Markup=(B2-A2)/A2Divides by the cost, not the price
Price for a target margin=A2/(1-C2)With 90 in A2 and 40% in C2, returns 150
Markup from margin=C2/(1-C2)40% returns 66.67%
Margin from markup=D2/(1+D2)40% entered as a markup returns 28.57%
Margin across many rows=(SUM(B2:B100)-SUM(A2:A100))/SUM(B2:B100)Total profit over total revenue

For a list of products or orders, work out the overall margin from the totals, as in the last row. Averaging the margin column treats a product that sold once the same as one that sold a thousand times, so it rarely matches the margin the business really made.

What is a good profit margin?

A good profit margin is one that covers your own overheads and the cost of winning each sale, and still leaves the profit you want. There is no universal good figure, which is why this page publishes no averages by industry: a figure averaged across businesses with different costs, prices and accounting cannot tell you what your own prices need to carry.

Your own break-even can. In the example above, operating expenses, interest and tax take 30% of revenue, so a gross margin of 30% would only break even, and the 40% the store earns leaves 10%. Find the same line for your business with the gross, operating and net margin calculator, then check each product against it.

A high margin is not a problem in itself. It becomes one when the price behind it costs more sales than it earns, so read margin next to conversion rate and revenue per visitor, never alone.

Margin is an input to most other profit numbers. Two calculators take it further: one for the return on what you spend, one for what a customer is worth over time.

See all free tools and how they fit together.

Margin calculator FAQ

How does the margin calculator work?

The margin calculator takes any two of cost, selling price, profit and margin and works out the other two, plus the markup. Change any field and it keeps the last two you changed as the known numbers. With a cost of 90 and a selling price of 150, it returns a profit of 60, a margin of 40% and a markup of 66.67%.

How do you calculate profit margin?

Subtract the cost from the selling price to get the profit, divide the profit by the selling price, and multiply by 100. For a product that costs 90 and sells for 150: 150 - 90 = 60 profit, and 60 / 150 × 100 = 40%. Divide by the price, not the cost: dividing by the cost gives the markup.

What is the gross margin formula?

Gross margin = (revenue - cost of goods sold) / revenue × 100. Revenue of 150,000 with 90,000 of cost of goods sold leaves 60,000 of gross profit, and 60,000 / 150,000 × 100 = 40%. For one product, use its selling price and its cost in place of revenue and cost of goods sold.

What is a 30% margin on 100?

It depends on what the 100 is. If 100 is the cost, a 30% margin needs a selling price of 100 / 0.70 = 142.86, a profit of 42.86. If 100 is the selling price, a 30% margin is 30 of profit on a cost of 70. Adding 30% to a cost of 100 gives 130, which is only a 23.08% margin.

How do I calculate the selling price for a 40% margin?

Divide the cost by 1 minus the margin. For a 40% margin, divide by 0.60: a cost of 90 needs a price of 150. For a 70% margin, divide by 0.30 (300); for an 80% margin, divide by 0.20 (450). The higher the target, the faster the price climbs.

What is the difference between margin and markup?

Margin is profit as a percentage of the selling price; markup is the same profit as a percentage of the cost. A product that costs 90 and sells for 150 makes 60: that is a 40% margin (60 / 150) and a 66.67% markup (60 / 90). For a profitable sale the markup is always the bigger number.

What is the difference between gross, operating and net profit margin?

Each one subtracts more costs from the same revenue. Gross margin subtracts only the cost of goods sold. Operating margin also subtracts operating expenses such as wages, rent, software and marketing. Net profit margin subtracts everything, including interest and tax. In this page's example they are 40%, 15% and 10%.

What is a good profit margin?

A good profit margin is one that covers your own overheads and the cost of winning each sale, with the profit you want left over. There is no universal figure, because costs differ from one business to the next. If overheads take 30% of revenue, as in this page's example, a gross margin of 30% only breaks even.

Can a margin be more than 100%?

No. Margin is profit divided by the selling price, and profit cannot be more than the price unless the cost is negative. A margin of exactly 100% means the cost is 0. Markup has no such limit: selling for double the cost is a 100% markup, which is a 50% margin.

How do I calculate margin in Excel or Google Sheets?

Put the cost in A2 and the selling price in B2, enter =(B2-A2)/B2 and format the cell as a percentage. To avoid an error on rows with no price, use =IF(B2=0,"",(B2-A2)/B2). For the price that gives a target margin held in C2, enter =A2/(1-C2).

How does gross margin affect break-even ROAS and CPA?

Break-even ROAS is 1 divided by gross margin, and break-even CPA is the order value multiplied by gross margin. At a 40% margin on a 150 order, ads break even at a ROAS of 2.50 and a cost per acquisition of 60.00. A lower margin raises the ROAS you need and lowers the CPA you can afford.

Find out what is costing you conversions

Enter your website and email and the audit starts right away. Watch it check your page live: eight checks, each scored out of 100, and three fixes you can make now.