Margin Calculator (Gross Profit Margin and Price for a Target Margin)
Gross profit margin from cost and selling price, or the price that gives a target margin — with the markup that margin equals and the working.
Inputs
- Gross profit per sale
- 40.00
- Working
- (100.00 − 60.00) ÷ 100.00 = 0.4000
- Markup on cost
- 66.67%
Use this calculator on your own site
Free embed
- Two lines of HTML, unlimited views
- Shows a small CalculateEveryday bar, with a credit link under the calculator
What each Margin input means
- Work out
- Margin from a known cost and price, or the price that hits a margin you choose.
- Cost
- What one item costs you to buy or make — the cost of goods sold per unit. Leave out overheads such as rent; those come out of gross profit later.
- Selling price
- The selling price, before sales tax.
- Target gross margin
- The gross margin you want, as a share of the price. Must be below 100%.
Margin formula
Gross margin = (price − cost) ÷ price · price for a target margin = cost ÷ (1 − margin) · markup = (price − cost) ÷ cost
Gross margin is profit as a share of the selling price: what is left of each sale after the cost of the goods, divided by the price. Accountants write it as the gross profit margin ratio, (net sales − cost of goods sold) ÷ net sales, which is the same thing for a whole business. It is easy to confuse with markup, which divides the same profit by the cost instead, so a 40% margin is a 66.67% markup; the page always shows both. Run the other way, the page answers the question pricing usually starts from: what price gives the margin I want? Because margin is measured on the price, you cannot simply add the margin percentage to the cost — the price is the cost divided by (1 − margin), so a 40% margin on a 45 cost needs a price of 75, not 63. A margin can never reach 100%, which would need a cost of zero, and a price below cost gives a negative margin, which the page flags as a loss on every sale before any overheads.
Formula last checked against OpenStax Principles of Accounting, Vol. 1 §6.6 (gross profit margin ratio = (net sales − cost of goods sold) ÷ net sales) on 2 October 2026. Built and maintained by Suman Kumar · How we check
Margin worked example
An item that costs $60 and sells for $100 leaves $40. That is a 40% margin (40 ÷ 100) but a 66.67% markup (40 ÷ 60) — the same profit, two different percentages.
More Margin examples
To earn a 40% margin on something that costs 45, the price is 45 ÷ (1 − 0.40) = 45 ÷ 0.60 = 75.00. The profit of 30.00 is 40% of the price — and a 66.67% markup on the cost. Adding 40% to the cost would give only 63, a 28.57% margin.
Where the Margin calculator can give the wrong answer
- This is gross margin, before operating costs. Net margin subtracts rent, wages, marketing and tax as well, and is always lower.
- Margin is capped below 100%; a 100% margin would mean the item cost nothing.
- Discounts come off the price, so they cut margin faster than they cut revenue: a 20% discount on an item with a 40% margin halves the profit per sale.
- Sales tax collected for the government is not revenue; enter prices before tax.
- Results are shown to two decimal places in whatever currency you are working in; the page applies no currency symbol.
Spotted a mistake? Tell us
Margin reference table
| Gross margin | Markup on cost | Price for a cost of 100 |
|---|---|---|
| 10% | 11.11% | 111.11 |
| 20% | 25.00% | 125.00 |
| 25% | 33.33% | 133.33 |
| 33.33% | 50.00% | 150.00 |
| 40% | 66.67% | 166.67 |
| 50% | 100.00% | 200.00 |
| 60% | 150.00% | 250.00 |
Margin FAQ
- Subtract the cost from the price and divide by the price. Cost 30, price 50: (50 − 30) ÷ 50 = 0.40, a 40% gross margin. For a whole business, use total sales and total cost of goods sold.
- Divide the cost by 1 minus the margin: cost ÷ 0.70. On a cost of 70 that is 100; check: 30 ÷ 100 = 30%. Choose 'Price, for a target margin' above.
- Both use the same profit, but margin divides it by the price and markup by the cost. A 50 profit on a 100 cost sold at 150 is a 33.33% margin and a 50% markup. Margin is always the smaller number.
- It depends on the trade. Grocery and fuel retail often run on margins under 25%, many retailers 25–50%, and software or digital products much higher. Compare with businesses like yours, and remember overheads still have to come out of it.
- No. Margin is profit as a share of the price, and profit can never exceed the price unless the cost is negative. Markup, measured on cost, can be any size — a 300% markup is a 75% margin.
- Use totals for a period: (revenue − cost of goods sold) ÷ revenue. Sales of 500,000 with goods costing 320,000 give 180,000 of gross profit, a 36% gross margin. Enter the totals as cost and price above.