Reverse Margin Calculator
Work backward from a selling price and target gross margin to find the highest unit cost that fits, or start with cost to find the required price. The result also converts margin to markup so the two percentages are not confused.
Interactive calculator · Method REVERSE_MARGIN-2.0 · Last reviewed: 2026-11-04
Calculate cost, price, margin, and markup
Choose the direction of the calculation. All amounts are per unit, but the same formula works for a project, order, or service package when cost and price use the same basis.
Your inputs
Default worked example. Edit the inputs to calculate your scenario.
Default worked example
At $100.00, a 30% target gross margin allows a maximum whole-cent unit cost of $70.00. The shown amounts yield 30% gross margin.
How to use the calculator
Choose allowable cost from price and target margin, required price from cost and target margin, or measurement from cost and price. Only the two active inputs are used; other values are retained when switching modes. Enter USD amounts in whole cents on the same tax and cost basis. Targets run from 0% to 99.9% in 0.1% increments.
What the result means
At USD 100.05 and a 30% target, maximum unit cost is USD 70.03. A USD 70.10 cost needs a minimum USD 100.15 price at that target. The solved amounts meet the target even when an unrounded solution falls between cents. Percentages round independently to two decimals; scientific notation retains tiny nonzero ratios and very large ratios.
Formula and units
Gross profit = shown price − shown cost. Gross margin = profit / price × 100; markup = profit / cost × 100. Maximum allowable cost = floor to cents(price × (1 − target/100)). Minimum required price = ceiling to cents(cost / (1 − target/100)). All supporting ratios use those actual cent amounts.
Worked examples
$100 price at 30% target margin: Selling price: 100 USD; Unit cost: 70 USD; Target gross margin: 30 %; What do you want to find?: priceMargin.
Example result: Allowable unit cost: $70.00; Gross profit per unit: $30.00; Selling price: $100.00; Gross margin: 30%; Equivalent markup: 42.86%; Cost share of price: 70%.
Selling price: 150 USD; Unit cost: 105 USD: Selling price: 150 USD; Unit cost: 105 USD; Target gross margin: 45 %; What do you want to find?: costMargin.
Example result: Unit cost: $105.00; Gross profit per unit: $85.91; Selling price: $190.91; Gross margin: 45%; Equivalent markup: 81.82%; Cost share of price: 55%.
Limitations and common mistakes
The result includes only the cost basis you enter. No tax, fee, return allowance or overhead is automatically added. This is gross margin per unit, rather than net profit or a pricing recommendation. Price must be positive. Cost may be zero when measuring cost and price; markup is then undefined. A positive cost is required to derive a positive price. Inputs and required prices must remain within the supported finite USD range.
Do not confuse margin, which divides by price, with markup, which divides by cost. Do not round a required price down or an allowable cost up: that can miss the target. Match the cost and price tax basis and include the relevant costs yourself.
Sources and assumptions
The margin identities are mathematical and use entered USD amounts on the same cost and price basis. Only the two inputs needed by the selected mode are used. Taxes, fees and channel costs are included only if entered in the cost basis; units sold and net profit are outside the model.
Method REVERSE_MARGIN-2.0; last formula review 2026-11-04. Sources and their supported claims. Calculation methodology.
Shopify: gross profit margin definition. Whole-cent target boundaries follow the displayed inequality and arithmetic policy.