Quick answer
Gross margin is profit divided by revenue and markup is profit divided by cost, so the same sale has two different percentages. With a cost of $80 and a selling price of $100 the profit is $20, the margin is 20% and the markup is 25%.
Use margin to see what share of the price is profit and markup to see how much you add on top of cost. Mixing them up is a common pricing error: a 50% markup is only a 33.3% margin.
Related tools: Markup Calculator: Selling price from cost and markup percentage. Break-Even Calculator: Units and revenue needed to cover fixed and variable costs. Contribution Margin Calculator: Per-unit contribution and contribution margin ratio.
How to use the Margin Calculator
- Enter cost ($) (0 or more).
- Enter revenue (selling price) ($) (above 0).
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Cost | A number, in $ | ≥ 0 |
| Revenue (selling price) | A number, in $ | > 0 |
Formula and method
Formula
profit = revenue − cost; margin = profit ÷ revenue; markup = profit ÷ cost
IEEE-754 double precision; money shown to cents, rates to 4 decimals. Results are estimates, not financial advice.
Margin is relative to revenue; markup is relative to cost.
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: Cost = 80; Revenue (selling price) = 100.
| Result | Value |
|---|---|
| Gross margin | 20% |
| Profit | $20.00 |
| Markup | 25% |
Example 2
Inputs: Cost = 120; Revenue (selling price) = 100.
| Result | Value |
|---|---|
| Gross margin | -20% |
| Profit | -$20.00 |
| Markup | -16.6667% |
The first line is the headline result (gross margin). Below it the margin Calculator lists profit and markup, which describe the same case from other angles. IEEE-754 double precision; money shown to cents, rates to 4 decimals. Results are estimates, not financial advice.
Margin and markup for the same sale
A margin m corresponds to a markup of m ÷ (1 − m), and a markup k to a margin of k ÷ (1 + k). A 25% markup equals a 20% margin, and a 50% markup equals a 33.3% margin. Margin can approach but never reach 100%; markup has no upper limit.
To price from a target margin, divide the cost by (1 − margin): a $60 item with a 40% target margin sells for $60 ÷ 0.6 = $100. To price from a markup, multiply the cost by (1 + markup).
A $80 cost at different selling prices
Every figure in this table comes from running this calculator, so it matches what the form returns.
| Selling price | Gross margin | Profit | Markup |
|---|---|---|---|
| 90 | 11.1111% | $10.00 | 12.5% |
| 100 | 20% | $20.00 | 25% |
| 120 | 33.3333% | $40.00 | 50% |
| 160 | 50% | $80.00 | 100% |
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- Revenue (selling price): entering "0" shows "Revenue (selling price) must be greater than 0." beside that field and no result.
Choosing between the Margin Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [Markup Calculator](/business/markup-calculator/) | cost and markup | Selling price |
| [Break-Even Calculator](/business/break-even/) | fixed costs, price per unit and variable cost per unit | Break-even units |
| [Contribution Margin Calculator](/business/contribution-margin-calculator/) | selling price per unit and variable cost per unit | Contribution per unit |
| [ROI Calculator](/business/roi-calculator/) | amount invested and final value | ROI |
| [EBITDA Margin Calculator](/business/ebitda-margin-calculator/) | revenue and eBITDA | EBITDA Margin |
Background: business metrics
Business ratios depend on exactly which costs and revenues you include, so read each page's definition. Two common checks: break-even units = fixed costs ÷ (price − variable cost per unit), so $50,000 of fixed costs with a $10 price and $5 variable cost breaks even at 10,000 units; and net profit margin = net profit ÷ revenue, so $20,000 profit on $100,000 revenue is 20%.
Return on investment ignores time: 20% over five years is far less impressive than 20% in one, so compare returns over the same period.
Assumptions and limitations
- Revenue must be positive
- Markup undefined when cost is 0
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for revenue (selling price) to confirm this.
Frequently asked questions
What is the difference between margin and markup?
Margin is profit as a share of the selling price; markup is profit as a share of cost. For the same sale the markup is always the larger percentage.
What does the Margin Calculator calculate?
Profit, gross margin and markup from cost and revenue. It returns Gross margin, Profit and Markup.
What formula does the Margin Calculator use?
profit = revenue − cost; margin = profit ÷ revenue; markup = profit ÷ cost. Margin is relative to revenue; markup is relative to cost.
What do I need to enter in the margin Calculator?
You enter Cost ($) and Revenue (selling price) ($).
How is the result rounded or limited?
IEEE-754 double precision; money shown to cents, rates to 4 decimals. Results are estimates, not financial advice. Revenue must be positive.
What are the limits of this calculator?
Revenue must be positive. Markup undefined when cost is 0.
What is an example of a margin result?
With cost 80 and revenue (selling price) 100, the gross margin is 20%.
Related calculators
- Markup Calculator — Selling price from cost and markup percentage.
- Break-Even Calculator — Units and revenue needed to cover fixed and variable costs.
- Contribution Margin Calculator — Per-unit contribution and contribution margin ratio.
- ROI Calculator — Return on investment, with optional annualized return.
- EBITDA Margin Calculator — EBITDA as a share of revenue.
- Operating Margin Calculator — Operating income as a share of revenue.
- Payback Period Calculator — Time to recover an investment from steady cash flow.
- Net Profit Margin Calculator — Net profit as a share of revenue.
Sources
- Standard time-value-of-money relations (e.g. Brealey, Myers & Allen, Principles of Corporate Finance)
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.