# Profit Margin Calculator

Profit margin is a ratio of profit to revenue expressed as a percentage (profit being the difference between revenue and cost). Example situation: a shopkeeper buys a huge bar of chocolate (what else?) from his delivery guy for `\$80` and sells it to a customer for `\$100`. The profit is `\$100 - \$80 = \$20`. The ratio of profit to revenue is `\$20 / \$100`, or, in other words, `20%`.

## How to calculate profit margin?

The formula for profit margin: `profit margin = 100 * profit / revenue`. The `100` is there, because we express profit margin as a percentage (1 hundredth parts) and not as a fraction - (`20%` is the same as `0.2` or `1/5` or `20/100`).

When you only have cost and revenue, and not the profit, substitute it with `revenue - cost`, like so: `profit margin = 100 * (revenue - cost) / revenue`.

## Profit margin vs. markup

It is easy to confuse profit margin with markup. Markup is a ratio of profit to cost as opposed to profit margin's ratio of profit to revenue. With markup, you compare your profit to the purchase price, not the selling price. In the huge bar of chocolate example, we would compare \$20 to \$80, so markup is 25%.