To hit a target margin, divide your cost by one minus the margin written as a decimal.
TL;DR: Use the selling price calculator and enter your cost and target margin. A $100 cost at a 20% margin needs a $125 price.
The formula and a worked example
The formula is:
selling price = cost ÷ (1 − margin)
Take a product that costs you $100 and a target margin of 20%. One minus 0.20 is 0.80. Divide $100 by 0.80 and you get $125. At a $125 price, the $25 profit is exactly 20% of the $125 revenue. That is what a 20% margin means.
Why you can’t just add the margin percent
A common mistake is adding 20% to the $100 cost to reach $120. That gives a $20 profit on $120 of revenue, which is only 16.7%, not 20%. The reason is that margin is measured against the selling price, but adding a percentage to cost measures against the cost. The two bases are different, so the math does not line up.
Cost-plus pricing starts from your cost and layers on the profit you want. The clean way to do it is the formula above, not a flat add-on. If you prefer to think in markup instead, the markup calculator handles that view.
One more thing: fold every real cost into your cost figure before pricing. Payment processing fees, shipping, and packaging all eat into margin if you leave them out. If a $100 item carries $5 in fees, price against $105 so your margin survives. Run your numbers through the selling price calculator once your full cost is in.