Profit Margin Calculator

Gross margin = (revenue - cost) / revenue x 100: revenue of 250 with a cost of 150 gives 100 / 250 x 100 = 40%. Markup divides profit by cost instead, so the same sale is 100 / 150 = 66.67%. To price for a 40% margin, divide cost by (1 - 0.40): 150 / 0.60 = 250.

Profit margin and markup are often used as if they meant the same thing. They do not: margin divides profit by the selling price, while markup divides it by cost. That single choice of denominator changes both the number and the price you should set. This calculator works with the margin convention throughout and shows the markup equivalent beside it, so you can check which figure a supplier or a spreadsheet is actually quoting. Pick a mode below.

Gross margin = (revenue - cost) / revenue x 100: revenue of 250 with a cost of 150 gives 100 / 250 x 100 = 40%. Markup divides the same 100 by cost instead, giving 100 / 150 = 66.67%.

What is my gross margin?

Enter revenue (selling price) and the cost of the goods sold.

How is gross margin worked out?

Subtract cost from revenue to get gross profit, then divide that profit by revenue. The revenue is the denominator because margin answers "what share of the money coming in is profit". On revenue of 250 and cost of 150, gross profit is 100, so margin is 100 / 250 = 0.40, or 40%. The markup on the same sale is 100 / 150 = 66.67%, a much larger-looking number that describes the same 100 of profit.

Worked example: one sale, three ways

A product costs 150 to buy and sells for 250. The table shows what each mode returns and why the pricing mode does not simply add the margin to cost.

QuantityFormulaResult
Gross profit250 - 150100
Gross margin100 / 250 x 10040.00%
Markup100 / 150 x 10066.67%
Price for a 40% margin150 / (1 - 0.40)250
40% margin as a markup0.40 / (1 - 0.40)66.67%

Check the pricing direction by reversing it: a price of 250 with cost 150 leaves 100 of profit, and 100 / 250 is 0.40, so the 40% target is met. If you had instead computed 150 x 1.40 = 210, the profit would be 60 and 60 / 210 = 28.57%, well below target. Dividing by (1 - margin) is the step that keeps the target intact.

Why is this different from reversing a percentage?

The [reverse percentage calculator](/tools/reverse-percentage-calculator/) works backwards from a total that already contains a tax or markup rate applied to cost, using total / (1 + rate). Here the rate is a share of revenue, not of cost, so the pricing formula is cost / (1 - margin) instead. Both are division, but the bases differ. Use the reverse tool to strip a known rate out of a total; use this one to size a margin or to translate between the two conventions.

What are the edge cases and limits?

Revenue must be greater than zero, because it is the denominator of the margin. Cost cannot be negative. If cost exceeds revenue, gross profit is negative and the margin is reported as a negative percentage — a loss, not an error. A target margin must be at least 0% and strictly below 100%; at 100% the divisor (1 - margin) becomes zero, so no finite price exists. A markup rate must be greater than -100% for the same reason. Results are shown to two decimals while the underlying arithmetic keeps full precision, and no currency symbol is assumed, so any currency works. This tool covers gross margin only: overheads, tax, returns, shipping and net profit are outside its scope, and it gives no financial, accounting or pricing advice.

In short: margin is profit divided by revenue, markup is profit divided by cost. Divide cost by (1 - margin) to price for a target, and convert between the two with markup = margin / (1 - margin) — then check the result forward before using it.

Frequently asked questions

What is the difference between margin and markup?

They use the same profit but different denominators. Margin divides gross profit by revenue (the selling price); markup divides it by cost. On revenue of 250 and cost of 150, profit is 100, so margin is 100 / 250 = 40% while markup is 100 / 150 = 66.67%. Margin can never exceed 100%, but markup has no upper bound.

How do I convert between margin and markup?

Use markup = margin / (1 - margin) and margin = markup / (1 + markup), with both rates written as decimals. A 40% margin equals 0.40 / 0.60 = 0.6667, a 66.67% markup. A 25% markup equals 0.25 / 1.25 = 0.20, a 20% margin. The conversion assumes the same revenue and cost in both cases.

Why do I divide cost by (1 - margin) to set a selling price?

Because margin is a share of the selling price, not of cost. If cost is 150 and you want a 40% margin, profit must be 40% of the price, so cost is the remaining 60%. Price = 150 / 0.60 = 250. Using cost x (1 + margin) would give 210, which is only a 28.57% margin — a common and costly pricing error.

Can margin be negative or above 100%?

A negative margin means cost exceeded revenue, that is, a loss on the sale. The calculator reports it as a negative percentage rather than rejecting it. Margin above 100% is impossible with non-negative cost, because profit cannot exceed revenue; a target margin of 100% or more would require dividing by zero or less.

Does this include tax, overheads, discounts or shipping?

No. It computes gross margin from the two numbers you enter: revenue and cost. It does not model overhead allocation, tax, returns, discounts, shipping, or net profit after expenses. Enter your own cost basis. This is arithmetic only, not accounting or pricing advice.

Is the result rounded or are my numbers stored?

Percentages are displayed to two decimals and currency-like values to two decimals, but the calculation keeps the full precision of your input. Everything runs in your browser with JavaScript; nothing is sent to a server, saved, or used for advertising. Reloading the page clears all fields.

Last updated: November 27, 2026