Quick answer: Given a positive direct cost and a target gross margin below 100%, the selling price is cost ÷ (1 − target margin), where the margin is written as a decimal.
Test the result: Enter cost and the proposed selling price in the free Profit Margin Calculator.
Start with the profit margin formula
Gross margin is (selling price − cost) ÷ selling price. Rearranging to solve for the unknown selling price produces selling price = cost ÷ (1 − margin). This is a gross-margin arithmetic calculation, not a complete pricing model.
Example: a 40% target
Suppose an item has a direct cost of $18 and the desired gross margin is 40%. Convert 40% to 0.40. Then $18 ÷ (1 − 0.40) = $18 ÷ 0.60 = $30. Gross profit is $12, exactly 40% of the $30 selling price.
Compare a few targets
| Cost | Target margin | Unrounded price | Illustrative rounded price |
|---|---|---|---|
| $20 | 20% | $25.00 | $25.00 |
| $20 | 35% | $30.7692… | $30.77 |
| $20 | 50% | $40.00 | $40.00 |
As the target margin rises, the selling price increases nonlinearly. A 50% margin requires the selling price to be twice the stated cost. It does not mean adding 50% to cost.
Rounding and verification
For the $20 / 35% example, the rounded price is $30.77. The achieved margin is ($30.77 − $20) ÷ $30.77 ≈ 35.00%. When your result isn't a neat number, check the achieved margin after rounding the final price.
When the formula cannot be used normally
At a target margin of exactly 100%, the denominator becomes zero; there is no finite positive price for a positive cost. For margins above 100%, the model no longer describes the normal case of positive selling price and non-negative cost. If the cost is zero, check the actual meaning of “gross margin” rather than applying the examples mechanically.
Spreadsheet formula
If cost is in A2 and target margin as a percentage-formatted value is in B2, use =IF(OR(B2>=1,A2<=0),"Check inputs",A2/(1-B2)). This checks two common input issues but does not replace review of the cost basis.
Related reading
What markup gives a 30% margin? demonstrates one practical target. See margin versus markup for the denominator differences.
BuzBolt provides general educational tools and explanations. Check your inputs and confirm any legal, tax, accounting or workplace-specific requirements independently where relevant.