Margin Calculator
A margin calculator is a business finance utility that computes gross profit margin, markup percentage, cost of goods sold, and selling price. It uses financial formulas that define profit margin as the difference between revenue and cost divided by revenue. The calculator allows business owners, sales managers, and retail operators to input any two variables to instantly solve for the remaining values. It is a critical tool for setting retail prices, determining product profitability, analyzing cost structures, and ensuring business operations achieve target profit levels.
Pick a mode, enter your cost and revenue (or a target margin), and the calculator returns the profit, the margin percentage, and the markup for comparison. The multi-tier mode also splits a P and L into gross, operating, and net margins.
Quick Answer
Calculate your profit margins and markup percentages. Enter your item cost and target selling price to find your profit margins, markup rates, and gross profit.
Mode
Cost of goods sold for this sale. · e.g. 50
What the customer pays. · e.g. 80
Profit margin
37.5%
Profit $30.00 · markup 60%
Examples
Mode 1 · $50 cost, $80 revenue
Profit $30 · margin 37.5% · markup 60%
Mode 2 · $50 cost, 40% target margin
Selling price ≈ $83.33 · profit ≈ $33.33 · markup ≈ 66.67%
Mode 3 · $100 revenue, 40% margin
Maximum cost $60 · profit $40 · markup 66.67%
Mode 4 · $1,000 rev / $400 COGS / $200 opex / $100 other
Gross 60% · operating 40% · net 30%
How it works
Formula · margin % = (revenue − cost) ÷ revenue × 100
All four modes share the same simple identity: profit equals revenue minus cost, margin is profit divided by revenue, markup is profit divided by cost. The differences between modes are which numbers you start with.
Profit
profit = revenue − cost
Margin
margin % = profit ÷ revenue × 100
Markup
markup % = profit ÷ cost × 100
Selling price from a target margin
selling price = cost ÷ (1 − margin)
Maximum cost from a target margin
cost = revenue × (1 − margin)
Gross / operating / net margin
- gross profit = revenue − COGS
- operating profit = gross profit − operating expenses
- net profit = operating profit − other expenses and taxes
- each margin = corresponding profit ÷ revenue × 100
What the calculator does
The margin calculator answers the four most common margin questions in one place: what margin a sale produces, what selling price a target margin requires, what cost ceiling a target margin allows, and how a single revenue line splits into gross, operating, and net margin once you account for cost of goods sold, operating expenses, and other costs.
Cost and revenue to margin
Mode 1 takes the cost of a sale and the revenue (or selling price) and returns the dollar profit, the margin percent, and the markup percent. This is the most common margin question. If revenue is below cost, the profit is negative and the margin is reported as negative; the calculator labels the result so the loss is clear.
Cost and target margin to selling price
Mode 2 starts from cost and the margin you want, and returns the selling price that produces it. The formula is selling price = cost ÷ (1 − margin). The calculator also reports the implied markup. A target margin of 100% is impossible at any positive cost; the calculator flags values at or above 100% with a clear validation message.
Revenue and margin to cost
Mode 3 starts from revenue and a target margin and returns the maximum cost that fits the target. The formula is cost = revenue × (1 − margin). Useful when you know what the market will pay and need to back into the cost ceiling.
Gross, operating, and net margin
Mode 4 takes revenue and three expense buckets (cost of goods sold, operating expenses, other expenses and taxes) and returns gross profit, operating profit, and net profit along with the three corresponding margin percentages. The result panel reports net margin as the headline number, with gross and operating shown alongside for context.
Gross margin says how much each dollar of revenue is left after paying for the product. Operating margin says how much is left after running the business. Net margin says how much is actually left over after everything.
Margin vs markup
Margin and markup describe the same dollar profit with different denominators:
- Margin = profit ÷ revenue. It tells you what share of the selling price is profit.
- Markup = profit ÷ cost. It tells you what share of the cost was added on to get the selling price.
A $30 profit on a $50 cost and an $80 sale is a 37.5% margin and a 60% markup. The two numbers describe the same sale. Margin is usually the more honest comparison across businesses; markup is how most retailers actually price at the register. The markup calculator flips the framing if you want to enter markup first.
Conversion between the two: markup = margin ÷ (1 − margin), and margin = markup ÷ (1 + markup). A 40% margin is a 66.67% markup; a 100% markup is a 50% margin.
By hand, one line at a time
Take a $50 cost and an $80 sale. Nothing here needs a calculator, and doing it once by hand is the fastest way to see why the two percentages differ.
- Find the profit. 80 − 50 = $30. This one number is the whole story; both percentages describe it.
- Divide by revenue for margin. 30 ÷ 80 = 0.375, so the margin is 37.5%.
- Divide the same $30 by cost for markup. 30 ÷ 50 = 0.60, so the markup is 60%.
- Check it. Cost plus markup should return the sale price: 50 × 1.60 = $80. It does.
The two numbers are far apart because the denominators are far apart. Revenue is bigger than cost on any profitable sale, so dividing by revenue always gives the smaller percentage. That is the entire difference, and it is why margin can never pass 100% while markup routinely does.
Edge cases, and what the tool will not do
- Revenue of zero. There is no margin to report, because the denominator is zero. The calculator says so rather than printing a number.
- Selling at a loss. If cost is above revenue the profit is negative and so is the margin. A $60 cost on a $50 sale is a loss of $10 and a margin of −20%. The result is labelled, not hidden.
- A target margin of 100%. Solving for price divides by one minus the margin, and at 100% that is division by zero. It would mean selling at any price for zero cost, which is not a pricing question.
- Negative inputs. A negative cost or revenue is rejected. There is no reading of a negative selling price that this tool could answer honestly.
- Cost of zero. Margin is 100%, which is real. Markup is undefined, because it divides by cost. This is the one case where markup has no answer and margin does.
Where these formulas come from
Nowhere, in the sense that matters for a citation. Margin and markup are definitions, not measured values: margin is defined as profit over revenue and markup as profit over cost, and the conversion between them follows from the two definitions by algebra. There is no outside standard body publishing a number this page could cite, so it cites none rather than dressing an identity in a reference it does not need.
The gross, operating and net split is different in kind. That ordering, subtracting cost of goods sold first, then operating expenses, then everything else, is ordinary income statement convention rather than arithmetic. This page follows it and does not claim any particular accounting standard requires the labels in the way a given business uses them.
Your figures stay in the page
Every amount you enter is processed by this page in your browser. Your costs, prices, margins and expense lines are not sent to a server, not stored after you close the tab, and not visible to anyone else. There is no account and nothing to sign up for. Pricing is commercially sensitive, and this page treats it that way.
Worked examples
- Mode 1: cost $50, revenue $80. Profit $30, margin 37.5%, markup 60%.
- Mode 2: cost $50, target margin 40%. Selling price ≈ $83.33, profit ≈ $33.33, markup ≈ 66.67%.
- Mode 3: revenue $100, margin 40%. Maximum cost $60, profit $40, markup 66.67%.
- Mode 4: revenue $1,000, COGS $400, opex $200, other $100. Gross 60%, operating 40%, net 30%.
Common mistakes
- Confusing margin with markup. They use different denominators (revenue vs cost). A 40% margin is a 66.67% markup, not 40%.
- Comparing your gross margin to a competitor's net margin. Make sure you are comparing the same tier.
- Excluding fees, shipping, packaging, or returns from cost. The margin you compute is only as honest as the cost number you feed in.
- Targeting a margin above 100%. Mathematically impossible at any positive cost. Use markup if you want growth ratios above 100%.
- Forgetting that operating expenses scale with volume differently than COGS. Margins computed from a single sale may look different from period-level margins.
Related tools
- Markup calculator for the markup-first framing (cost + markup → selling price).
- Percentage calculator for generic percent math (X% of Y, X is what % of Y, X is Y% of what).
- Discount calculator for applying a percent off a price.
- Sales tax calculator for the tax portion of any amount.
- All money calculators.
Note. The calculator uses standard margin formulas. Real-world accounting can split costs and expenses many different ways, so the gross / operating / net split depends entirely on how you allocate them in the input fields. It is not accounting or tax advice.
Related Calculators
More tools from Money



