Margin calculator
Enter cost and selling price and this margin calculator shows gross profit, margin (as a share of the price), markup (as a share of the cost) and the price multiplier. You can also work out the selling price for a target margin or markup, or the highest cost you can pay for a given price. Use prices before sales tax or VAT.
Source: OpenStax Contemporary Mathematics, 6.2 Discounts, Markups, and Sales Tax (Rice University). Updated: .
How it is calculated
Profit margin formula
Margin % = (price − cost) ÷ price × 100. The difference between selling price and cost is the gross profit (accountants call net sales minus cost of goods sold the gross margin). As a percentage, margin is always measured against the selling price. Example: you buy for 800 and sell for 1,000 – gross profit 200, margin 200 ÷ 1,000 = 20%.
How to calculate profit margin
- Under “What do you want to calculate?”, choose the task, e.g. margin from cost and selling price, or selling price from a target margin.
- Enter the prices, or the target margin or markup.
- Read profit, margin, markup and multiplier.
Margin vs. markup
Markup measures the same profit against the cost: Markup % = (price − cost) ÷ cost × 100, so retail price = cost × (1 + markup). In the example that is 200 ÷ 800 = 25%. A 20% margin and a 25% markup describe exactly the same sale; markup is always the larger number because the cost is smaller than the price.
Converting with m = margin and a = markup (as decimals):
m = a ÷ (1 + a) and a = m ÷ (1 − m)
| Margin | equals markup | Multiplier |
|---|---|---|
| 20% | 25% | 1.25 |
| 25% | 33.33% | 1.33 |
| 30% | 42.86% | 1.43 |
| 50% | 100% | 2.00 |
The classic mistake: using the margin as a markup
If you want a 40% margin and simply add 40% to a 60 cost, you get 84 – which is only 24 ÷ 84 = 28.57% margin. The correct formula is price = cost ÷ (1 − margin): 60 ÷ 0.6 = 100. The other way round: to hit a 30% margin at a 49.90 price point, the item may cost at most 49.90 × 0.7 = 34.93.
Leave sales tax out
Sales tax (or VAT outside the US) is collected for the government and is not revenue. Calculate margin with prices before tax. To build a price that also covers shipping, packaging and marketplace fees, use the selling price calculator.
More pricing calculators: set prices including fees and tax with the selling price calculator, find your break-even point with the break-even calculator, and plan bulk pricing with the volume discount calculator.
Enter any two values – plus quantity and price breaks
Under “What do you want to calculate?” you choose which two figures you know: cost and selling price, one price with a margin or markup, or one price with the profit per unit. The calculator fills in the rest – profit, margin, markup, price multiplier and the missing price. With a quantity above 1 you also get the totals: revenue, cost of goods and gross profit for the whole order. In quantity price breaks, enter one quantity per line with the unit price you charge from that quantity on; the table shows margin, markup, profit per unit and total gross profit for every tier – so you see at once where a volume discount makes the margin too thin.
Frequently asked questions
How do I calculate profit margin?
Subtract cost from price, divide by price and multiply by 100: cost 800, price 1,000 → 200 ÷ 1,000 = 20%.
What is the difference between margin and markup?
Margin divides profit by the selling price, markup divides it by the cost. The same sale (800 → 1,000) has a 20% margin but a 25% markup.
How do I convert margin to markup?
Markup = margin ÷ (1 − margin). A 30% margin is 0.3 ÷ 0.7 = 42.86% markup. Back again: margin = markup ÷ (1 + markup).
How do I find the selling price from cost and margin?
Price = cost ÷ (1 − margin). For a 40% margin on a 60 cost: 60 ÷ 0.6 = 100. Adding 40% (84) would only give a 28.57% margin.
What is the margin formula in Excel?
With cost in A2 and price in B2: margin =(B2-A2)/B2, markup =(B2-A2)/A2, price for a target margin in C2 =A2/(1-C2). Format the results as percentages.
Sources and legal basis
- OpenStax Contemporary Mathematics, 6.2 Discounts, Markups, and Sales Tax (Rice University)
- OpenStax Principles of Accounting, Vol. 1, 6.1 – gross margin (Rice University)
As of: · Editorial policy
Related tools
- Selling price calculatorWork out the selling price of a product from cost, shipping, packaging, percentage selling fees and your target margin – fees are solved correctly.
- Break-even calculatorBreak-even point calculator for small businesses: units and sales revenue to break even from fixed costs, price and variable cost, plus a target profit.
- Discount calculatorPercent off calculator: sale price and savings for any discount, stacked discounts like 20% + 10%, the percent off between two prices and the original price.
- Percentage CalculatorFree percentage calculator: find X% of a number, what percent one number is of another, percentage change, increase and discount – with formula and steps.
- German VAT calculatorGerman VAT calculator: add VAT to a net price or remove it from a gross price at 19%, 7% or a custom rate – rounded to the cent, with formulas.
- Freight Class Calculator (density-based)Freight class calculator: enter the dimensions and weight of a pallet or crate to get its density in lb/ft³ and the LTL freight class on the 13-step NMFC scale.
- UK VAT Calculator: add or remove VATAdd or remove UK VAT at 20%, 5% or 0% in one step. Works from the net price, the gross price or the VAT amount, with the 1/6 VAT fraction shown.
- Sales Tax CalculatorSales tax calculator: enter a price and your state and local rate to get tax and total – or work backwards from a receipt total to the price before tax.
- Meta Tag GeneratorMeta tag generator: create the title, meta description, canonical, Open Graph and X card tags for your page head – ready to copy, with a check of the lengths.