How to use the profit margin calculator
- Select From cost and revenue to find your margin, or From cost and margin % to find the required selling price.
- Enter your cost (what you paid to produce or acquire the item).
- Enter either the revenue (selling price) or the target margin percentage.
- The profit margin calculator updates instantly with your gross profit, margin percentage or required price.
How profit margin is calculated
Gross profit margin measures what portion of each dollar of revenue remains after covering the direct cost of goods sold. The formula used by this margin calculator is:
Margin = (Revenue - Cost) / Revenue x 100
For example, if you buy a product for $40 and sell it for $100, your gross profit is $60. Dividing $60 by $100 gives 0.60, or a 60% profit margin.
When you know the cost and want a specific margin, the required revenue is found by rearranging the formula:
Revenue = Cost / (1 - Margin / 100)
If your cost is $25 and you need a 60% margin, the calculation is 25 / (1 - 0.60) = 25 / 0.40 = $62.50. Selling at $62.50 yields exactly $37.50 in gross profit, which is 60% of the revenue.
Margin versus markup
A very common mistake is confusing margin with markup. They use the same two numbers but divide by different bases.
- Margin divides profit by revenue:
(Revenue - Cost) / Revenue - Markup divides profit by cost:
(Revenue - Cost) / Cost
In the $40 cost and $100 revenue example, the margin is 60% but the markup is 150%. Margin can never reach 100% unless the cost is zero, while markup has no upper limit. If you need to work with markup instead, use the markup calculator.
Common margin benchmarks
What counts as a good profit margin depends heavily on the industry. Here are rough benchmarks for gross profit margins across several sectors:
| Industry | Typical gross margin |
|---|---|
| Software (SaaS) | 70% to 85% |
| Retail clothing | 40% to 55% |
| Grocery stores | 20% to 30% |
| Restaurants | 60% to 70% |
| Electronics retail | 10% to 25% |
| Consulting services | 50% to 70% |
These figures represent gross margin only. Net profit margins, which account for rent, payroll, taxes and other operating expenses, are significantly lower. You can estimate overall returns using the ROI calculator or project growth over time with the compound interest calculator.
Using the cost and margin mode
The second mode of this gross margin calculator works backwards. Instead of telling you the margin on an existing price, it tells you what price you must charge to hit a target margin.
This is especially useful when setting prices for new products. Enter your total unit cost (materials, labor, shipping) and your desired margin percentage. The tool outputs the minimum selling price and the resulting gross profit per unit.
Keep in mind that a 100% margin is mathematically impossible with a positive cost, because it would require dividing by zero. The calculator limits input to below 100% to prevent this error.
Handling losses and negative margins
If your revenue is lower than your cost, the profit margin calculator will show a negative margin. For instance, buying at $120 and selling at $100 produces a gross profit of -$20.00 and a margin of -20%.
Negative margins happen during clearance sales, introductory pricing or when costs spike unexpectedly. While sometimes strategic, sustained negative gross margins mean the core business model loses money on every unit sold before overhead is even considered.
Worked examples
Each result below was produced by the same code the tool runs, so you can check your own numbers against them.
| Example | Input | Result |
|---|---|---|
| Retail product | Calculation mode: cr; Cost: 40; Revenue (selling price): 100 | Gross profit: $60.00; Profit margin: 60%; Cost: $40.00; Revenue: $100.00 |
| Target 60% margin | Calculation mode: cm; Cost: 25; Target margin (%): 60 | Required revenue: $62.50; Gross profit: $37.50; Cost: $25.00; Profit margin: 60% |
| Low margin item | Calculation mode: cr; Cost: 85; Revenue (selling price): 100 | Gross profit: $15.00; Profit margin: 15%; Cost: $85.00; Revenue: $100.00 |
| Service pricing | Calculation mode: cm; Cost: 120; Target margin (%): 40 | Required revenue: $200.00; Gross profit: $80.00; Cost: $120.00; Profit margin: 40% |
FAQ
What is the difference between gross margin and net margin?
Gross margin only subtracts the direct cost of producing or purchasing the goods. Net margin also deducts operating expenses, interest, taxes and all other costs. This tool calculates gross margin.
Can profit margin be more than 100%?
No. Gross profit margin is capped at 100%, which would only occur if the cost were exactly zero. Markup, however, can exceed 100%.
Why does my margin look low even though I doubled the cost?
Doubling the cost means a 100% markup, but the margin is only 50%. Margin divides profit by the selling price, not the cost, so it always produces a smaller percentage than markup for the same numbers.
Does this profit margin calculator include sales tax?
No. Enter your revenue exclusive of sales tax, because tax collected is not part of your income. If you need to add tax to a final price, use the sales tax calculator.
Is my financial data sent to a server?
No. All calculations run locally in your browser. Nothing you type into the cost or revenue fields is transmitted anywhere.
How do I calculate margin for a service business?
Use the direct labor and material costs as your cost, and the fee charged to the client as your revenue. Overhead like office rent should be excluded from gross margin and accounted for separately in net margin.