Online Receipt Generator
Create & Price

Margin Calculator

Find your gross margin from cost and price — or the price you need to hit a target margin.

Result

Profit

$30.00

Markup

30%

Gross margin

23.08%

Embed this calculator on your site

Copy this code and paste it into your page's HTML. The calculator is free to use and resizes itself to fit.

How it's calculated

Margin = (price − cost) ÷ price. To reach a target margin, price = cost ÷ (1 − margin). The equivalent markup, (price − cost) ÷ cost, is shown too.

This margin calculator has two modes. Enter cost and selling price to find the gross margin. Or enter cost and a target margin to find the price you need. Both modes also show the profit and the equivalent markup.

The formula

margin %  = (price - cost) / price x 100
markup %  = (price - cost) / cost x 100
profit    = price - cost

Price for a target margin:
price     = cost / (1 - target margin)

If the target margin is 100% or more, the price result is 0.

Worked example

Mode: find the price. Inputs: cost $100, target margin 40%.

  • Selling price: $166.67
  • Profit: $66.67
  • Gross margin: 40%
  • Markup: 66.67%

In the other mode, a cost of $100 and a price of $130 give $30 profit, 23.08% margin and 30% markup.

How to read the result

Margin shows how many cents of each dollar of sales you keep before overheads. A higher margin gives more room for rent, tools and unpaid time.

  • To reach a 40 percent margin you need a 66.7 percent markup, not 40.
  • Compare margins only within the same kind of business. Software, retail and trades differ widely.
  • Include every direct cost in the cost field, such as materials, fees and subcontractors.
  • Check that your margin still covers your overheads after discounts.

Use the markup calculator when your supplier or team works with markup.

Related tools

Frequently asked questions

How do I calculate gross margin?
Subtract the cost from the selling price, then divide the result by the selling price. A cost of $100 and a price of $130 leave $30 profit, which is a 23.1 percent margin.
How do I find the price for a target margin?
Divide the cost by one minus the target margin. For a 40 percent margin on a $100 cost, divide 100 by 0.6. The price is $166.67.
Why is a 100 percent margin not possible?
A 100 percent margin means the cost is zero. The price formula would divide by zero. The calculator accepts targets up to 99.99 percent and returns zero at 100 or above.
Is margin the same as markup?
No. Margin divides profit by the selling price. Markup divides profit by the cost. For the same sale, markup is always the larger number. This tool shows both.
Is gross margin the same as net profit?
No. Gross margin only subtracts the direct cost of the item or service. Overheads, tax and your own time are not included. Net profit comes after those costs.