Margin Calculator
Gross margin from cost and price, or the price that hits a target margin.
- Profit margin
- 40%
- Profit per sale
- 40.00
- Selling price
- 100.00
- Markup on cost
- 66.67%Same profit, measured against cost
- Profit100.00 − 60.00= 40.00
- Margin (profit ÷ price)40.00 ÷ 100.00= 40%
- Markup (profit ÷ cost)40.00 ÷ 60.00= 66.67%
Formula
margin = (price − cost) ÷ price
price for a target margin = cost ÷ (1 − margin)
markup = margin ÷ (1 − margin)Your numbers are worked out in this tab and aren’t sent to our servers.
Related tools
Comparing two prices as a percent change? Use the Percentage Calculator on browserutils
How to use Margin Calculator
- Choose "Cost and price" to find the margin you make, or "Cost and the margin I want" to find the price to charge.
- Enter the cost of one unit: what you paid the supplier, or materials and direct labour.
- Enter the selling price before sales tax or VAT, or the target margin.
- Read the margin, the profit per sale and the same profit expressed as a markup on cost.
- Open the working to see each division, and copy the link to share the price with a colleague.
Margin Calculator formula
margin = (price − cost) ÷ price
price for a target margin = cost ÷ (1 − margin)
markup = margin ÷ (1 − margin)Features
- Both directions: margin from a price, and price from a target margin using price = cost ÷ (1 − margin).
- Shows the matching markup next to every margin, so you can talk to suppliers who quote in markup.
- Warns when the price is below cost and shows the loss per sale.
- Caps a target margin below 100%, where the price formula would divide by zero.
- Every result has the arithmetic written out with your numbers.
About Margin Calculator
Gross profit margin is profit as a share of the selling price: margin = (price − cost) ÷ price. A product that costs 60 and sells for 100 makes 40 profit and a 40% margin. Margin can never reach 100% unless the cost is zero, and it’s the number accountants, investors and most pricing benchmarks use, because it shows how much of each sale you keep.
To price for a margin, divide the cost by one minus the margin. For a 40% margin on a 60 cost, 60 ÷ 0.6 = 100. A common mistake is to add 40% to the cost (60 × 1.4 = 84), which is a 40% markup and only a 28.6% margin. The markup calculator covers that direction and has a conversion table.
This is gross margin on a single unit: it doesn’t include overheads such as rent, salaries or marketing, which are what net margin subtracts. Enter prices without sales tax or VAT; if your prices include VAT, take it out with the VAT calculator first, or your margin will look bigger than it is.
Margin Calculator specs
- Runs
- In this browser tab
- Built on
- Plain JavaScript arithmetic in the page; money is rounded to the cent only where the steps say so
- Cost
- Free, no account needed
- Browsers
- Current Chrome, Edge, Firefox and Safari
- Last updated
- November 27, 2026
- Part of
- 18 free tools on calcutils.dev