Margin calculator does one simple thing - lets you calculate any of the main variables in the sales process - cost of goods sold (how much you paid for the stuff that you sell), profit margin, revenue (how much you sell it for) and profit. In general, your profit margin determines how healthy your company is - with low margins you're dancing on thin ice and any change for the worse may result in big troubles. High margins mean there's a lot of room for errors and bad luck.
There are a few calculators that are similar in nature - please see margin with VAT (or sales tax), margin with discount or a very similar markup calculator. You might find VAT calculator and sales tax calculator convenient, too.
$50 - $30 = $20
$20 / $50 = 0.4.
0.4 * 100 = 40%.
The formula for gross margin percentage is as follows:
gross_margin = 100 * profit / revenue (when expressed as a percentage). The profit equation is:
profit = revenue - costs, so an alternative margin formula is:
margin = 100 * (revenue - costs) / revenue.
Now that you know how to calculate profit margin, here's the formula for revenue:
revenue = 100 * profit / margin.
And finally, to calculate how much you can pay, given your margin and revenue (or profit), do:
costs = revenue - margin * revenue / 100
All the terms (margin, profit margin, gross margin, gross profit margin) are a bit blurry and everyone uses them in a bit different context. For example, costs may or may not include expenses other than COGS - usually they don't. I'll be using these terms interchangeably and forgive me if it's not in line with some definitions - what's important to us is what these terms mean to people and for this simple calculation the differences don't really matter.
The difference between gross margin and markup is small, but important. The former is a ratio of profit to the sale price and the latter is a ratio of profit to the purchase price (Cost of Goods Sold). In the common language, the profit is also called either markup or margin when we're dealing with raw numbers, not percentages.