Margin is the percentage of profit based on sales price while mark-up is the percentage gain based on cost. A 25% mark-up results in a 20% margin. For example, an item costs $80. You mark it up 25% (80 x 1.25) and you selling price is $100. A profit of $20 is 20% of $100 so you have a 20% margin.
Similarly, a 50% mark-up will result in a 33% margin.
To calculate the selling price at a given margin, you have the correct formula. You divide the cost by 1 minus the margin percentage. So, if you want a 25% margin, your cost will be 75% of the selling price. So you take cost divided by .75 to arrive at the price.
If you want a 30% margin, divide your cost by .7 which is (1 - .3).