Use this free margin calculator to work out gross profit, profit margin and markup from revenue and cost. Enter your revenue and cost to see gross profit, margin percent and markup percent side by side.
Margin Calculator
Get gross profit, margin on revenue and markup on cost in one run — so you never price with the wrong ratio again.
Enter your values
Fill in the fields below — the result appears with every step shown.
Your result will appear here
Enter your values above, then press Calculate — or press Enter in any field.TinyExe · Margin Result
Calculated locally in your browser
—
Name
—
Revenue (selling price / sales)
—
Cost (COGS)
—
Result
—
How this was calculated
What to do next
TinyExe PDF & PNG exports carry the TinyExe logo and tinyexe.com header & footer.
Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.
The short answer
Profit margin is gross profit divided by revenue, times one hundred. If an item sells for 1,000 and costs 600, gross profit is 400 and the margin is 400 divided by 1,000, which is 40 percent. The markup on the same item is 400 divided by 600, or 66.67 percent, a different figure.
- Margin = (revenue - cost) / revenue x 100
- Markup = (revenue - cost) / cost x 100
- Price for a target margin = cost / (1 - margin/100)
- Margin is capped at 100%; markup is not
Margin needed for a target markup, and typical gross margins
Reference values for this calculator.
| Sector (illustrative) | Typical gross margin | Note |
|---|---|---|
| Grocery retail | 20-30% | High volume, thin margin |
| Restaurants | 55-70% | On food cost before labour and rent |
| Software (SaaS) | 70-85% | Low marginal cost per user |
| Clothing retail | 45-55% | Before markdowns |
| Construction | 15-25% | Varies sharply by contract type |
The formula
The exact formula this calculator uses — every variable in it is explained in the card below.
The formula
Ideas enhancement: the old generic flat-percentage kernel is replaced by the real margin model — it returns gross profit, margin on revenue AND markup on cost side by side, because confusing those two ratios is the single most common pricing error in small business.
Worked examples
Worked examples with the full working shown — try them in the calculator to check.
Example 1
Standard product line
Revenue 1,000, cost 600
| Calculation | Steps |
|---|---|
| Profit = 1,000 - 600 = 400. Margin = 400 / 1,000 x 100 = 40%. Markup = 400 / 600 x 100 = 66.67%. | Gross margin 40%, gross profit 400. |
Result
Example 2
Thin retail margin
Revenue 250, cost 200
| Calculation | Steps |
|---|---|
| Profit = 250 - 200 = 50. Margin = 50 / 250 x 100 = 20%. Markup = 50 / 200 x 100 = 25%. | Gross margin 20%. |
Result
Example 3
Decimal till prices
Revenue 99.99, cost 33.33
| Calculation | Steps |
|---|---|
| Profit = 99.99 - 33.33 = 66.66. Margin = 66.66 / 99.99 x 100 = 66.67% after rounding. Markup = 66.66 / 33.33 x 100 = 200%. | Gross margin 66.67% with a 200% markup — a vivid margin-versus-markup contrast. |
Result
How to use this calculator
Step 1
Enter the revenue — the selling price of one item or total sales for a period.
Step 2
Enter the matching cost of goods sold for exactly the same item or period.
Step 3
Read the gross margin percentage in the result card.
Step 4
Compare it with the markup figure shown alongside so you do not mix the two ratios.
Step 5
To hit a target margin instead, rearrange: price = cost / (1 - margin/100).
Frequently asked questions
What is the difference between margin and markup?
Margin divides profit by the selling price (revenue); markup divides profit by the cost. A 40% margin on a 1,000 sale with 600 cost is a 66.67% markup on the same deal. Margin can never exceed 100%; markup can.
How do I price an item for a 40% margin?
Divide the cost by (1 - 0.40). A cost of 600 needs a price of 600 / 0.6 = 1,000. Adding 40% to the cost instead (600 x 1.40 = 840) only gives a 28.6% margin — the classic mistake this calculator guards against.
Is gross margin the same as net margin?
No. Gross margin only subtracts cost of goods sold. Net margin also subtracts operating expenses, interest and tax, so it is always lower. This calculator computes gross margin.
Can margin be negative?
Yes — if cost exceeds revenue you are selling at a gross loss and the margin is negative. The calculator returns the negative percentage rather than hiding it.
What is a good profit margin?
It depends entirely on the sector: grocery survives on 20-30% gross margins at huge volume while software runs at 70-85%. Compare against your own industry's benchmarks, not a universal number.
About this calculator
A margin calculator works out gross profit margin: the percentage of revenue a business keeps after paying the direct cost of what it sold. Give it revenue and cost of goods sold and it returns the gross profit, the margin percentage, and — because the two are constantly confused — the markup percentage on cost as well.
Margin and markup describe the same profit through two different denominators. Margin looks down from the price: profit divided by revenue. Markup looks up from the cost: profit divided by cost. Because revenue is bigger than cost, the margin percentage is always the smaller of the two for the same deal — 400 of profit is 40% of a 1,000 price but 66.67% of a 600 cost. Quoting one while your listener hears the other is how profitable-looking jobs turn into losses.
The practical trap is pricing by adding a percentage to cost and calling it margin. To earn a true 40% margin on a 600 cost you must charge 600 / (1 - 0.40) = 1,000. Adding '40%' to cost gives 840, and the margin on 840 is only (840-600)/840 = 28.6%. Whole product ranges have been underpriced by exactly this error, which is why this calculator always shows both ratios together.
Gross margin is a starting point, not the bottom line. It ignores rent, wages, marketing, interest and tax, so a healthy 40% gross margin can still end as a net loss. Use it to compare products and prices against each other and against sector norms — grocery thrives near 25%, software near 80% — and use a full P&L for the final verdict.
Use it when setting or checking prices, comparing product lines, quoting a job, reviewing a supplier price rise, or reading a P&L. It is the right tool whenever the question is 'of every pound or dollar we take, how much survives the direct cost of the sale?'
How to calculate it yourself
Step 1
Write down the revenue and the cost of goods sold for the same item or the same period — mixing periods invalidates the result.
Step 2
Subtract cost from revenue to get gross profit.
Step 3
Divide gross profit by revenue and multiply by 100: that is the margin percentage.
Step 4
For comparison, divide gross profit by cost and multiply by 100: that is markup.
Step 5
To price from a target margin, divide cost by (1 - target/100) instead of adding the percentage to cost.
Real-life examples
A café reprices a sandwich
A café sells a sandwich for 8.50; ingredients and packaging cost 3.40. The owner wants to know the food margin before deciding whether a supplier's 10% price rise can be absorbed.
Profit = 8.50 - 3.40 = 5.10. Margin = 5.10 / 8.50 x 100 = 60%. If costs rise 10% to 3.74, margin becomes (8.50 - 3.74) / 8.50 = 56% — still inside the café's 55-70% food-margin band, so the rise can be absorbed without a price change.
60% food margin now, 56% after the rise — absorb it, no reprice needed.
A builder quotes a job
A builder's materials and subcontractors for a job cost 18,000 and he wants a 25% gross margin on the quote, not a 25% markup.
Price = cost / (1 - 0.25) = 18,000 / 0.75 = 24,000. Check with the calculator: profit = 24,000 - 18,000 = 6,000, margin = 6,000 / 24,000 = 25%. Had he added 25% to cost he would have quoted 22,500 and earned only a 20% margin.
Quote 24,000 for a true 25% margin — 1,500 more than the markup mistake would have quoted.
Ideas & use cases
- Supplier-rise drill: re-run your top five products with costs raised 5% and 10% to see which margins break first and which prices must move.
- Margin ladder: rank products by margin percentage, then by profit per unit — the two rankings rarely match, and the conversation that follows is the useful part.
- Quote check: before sending any quote built as 'cost plus X%', run it here and read the true margin; if X was meant to be the margin, reprice with cost / (1 - X/100).
Limitations & sources
- Gross margin only: it excludes operating expenses, salaries, rent, interest and tax, so it is not net profit. Sector benchmark rows are illustrative ranges, not audited industry statistics.
Sources: Standard managerial accounting definitions of gross margin and markup (e.g. Horngren, Cost Accounting; Corporate Finance Institute margin guide cross-checked)
