How the calculation works
unitContribution = sellingPrice - unitCost
marginPct = unitContribution / sellingPrice * 100
markupPct = unitContribution / unitCost * 100
priceForTargetMargin = unitCost / (1 - targetMarginPct / 100)
priceForTargetMarkup = unitCost * (1 + targetMarkupPct / 100)
Choose your cost definition consistently. A product gross margin excludes costs that a contribution margin might include.
A worked example
At a €100 selling price and €60 cost, contribution is €40, margin is 40% and markup is 66.67%. Applying a 40% markup to €60 gives a price of €84 and a 28.57% margin. A 40% margin requires a €100 price.
Use it carefully
- Selling price must be positive. At zero cost, markup and a price for a target markup are undefined; show 'Not defined' instead of Infinity or zero. A target margin below 100% has no positive-price solution at zero cost.
- A target margin must be below 100%. Negative achieved margins are valid when selling below cost.
- The same arithmetic can be used with COGS or a broader variable-cost figure, but label the resulting margin accordingly.
- Use net-of-tax prices and costs when tax is collected on behalf of a tax authority.
Common questions
How do I convert markup to margin?
Using fractions rather than percentages, margin = markup / (1 + markup). A 100% markup gives a 50% margin.
How do I convert margin to markup?
Using fractions, markup = margin / (1 - margin). A 40% margin gives a 66.67% markup.
Related calculations
Further context: Shopify: how product prices and margins are calculated. Equations and examples were independently prepared for this calculator.
Bring a CSV to the MarginTrial workbench for contribution bridges, scenarios, and report exports.