Margin Calculator

About this calculator

This margin calculator solves the profit margin equation from any two known values: cost, revenue, margin or profit. It returns the missing numbers along with markup, so you can see how much of each sale you keep.

Two extra tabs cover trading: the cash a stock purchase needs under a margin requirement, and the deposit a leveraged currency position needs.

$
Fill in any two of the four fields; leave the rest blank.
$
%
$
$
%
Price of one unit of the base currency in the quote currency.
Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

Margin versus markup

Margin and markup both describe profit, but they measure it against different bases. Margin is profit as a share of what the customer pays. Markup is profit as a share of what the item cost you. Because revenue is always larger than cost for a profitable sale, markup is always the bigger percentage. Mixing the two up is one of the most common pricing mistakes: a business that wants a 40% margin but adds a 40% markup ends up with only a 28.6% margin.

Profit = Revenue - Cost
Margin = Profit / Revenue
Markup = Profit / Cost

Solving from any two values

The profit margin tab accepts any two of cost, revenue, margin and profit. Each pair determines the other two:

  • Cost and revenue: profit is the difference.
  • Cost and margin: revenue = cost / (1 - margin).
  • Cost and profit: revenue = cost + profit.
  • Revenue and margin: profit = revenue x margin.
  • Revenue and profit: cost = revenue - profit.
  • Margin and profit: revenue = profit / margin.

Worked example

A retailer pays $120 for an item and sells it for $160. Profit is $40. Margin is 40 / 160 = 25%. Markup is 40 / 120 = 33.33%. If the retailer instead wants a 40% margin on the same $120 cost, revenue must be 120 / (1 - 0.40) = $200, a markup of 66.67%.

MarginEquivalent markup
10%11.11%
20%25.00%
25%33.33%
30%42.86%
40%66.67%
50%100.00%

The conversion is markup = margin / (1 - margin), and margin = markup / (1 + markup).

Stock trading margin

Buying on margin means borrowing part of the purchase price from your broker. The margin requirement is the percentage of the position you must pay with your own cash. The amount required is stock price x shares x requirement. In the United States, the initial requirement under Federal Reserve Regulation T is 50%, so a $5,000 position needs $2,500 of your own money. Brokers also set a maintenance margin, often 25% to 40% of the position value. If your equity falls below it, you receive a margin call and must add cash or sell holdings.

Margin magnifies both gains and losses. A 10% drop in a position bought with 50% margin is a 20% loss on your own capital, and you still owe interest on the loan.

Currency exchange margin

Forex brokers quote leverage as a ratio. A 50:1 ratio means a 2% margin requirement: to control 10,000 units you deposit one fiftieth of the position value. The position value is units x exchange rate, expressed in the quote currency, and the deposit is that value divided by the ratio. At a rate of 1.22 with 10,000 units, the position is 12,200 and the deposit at 50:1 is 244.

Using margin in pricing

Gross margin ignores overhead, so it is the starting point rather than the final answer. Compare it with your fixed costs, discounts and payment fees before setting prices. Retail typically runs 30% to 50% gross margin, software far higher, grocery much lower. Track the number monthly so that supplier increases do not quietly erode it.

Frequently asked questions

What is the difference between margin and markup?

Margin divides profit by revenue, markup divides profit by cost. A 25% margin equals a 33.33% markup.

How do I calculate profit margin?

Subtract cost from revenue to get profit, then divide profit by revenue and multiply by 100. For revenue of $160 and cost of $120 the margin is 25%.

How do I find the selling price for a target margin?

Divide your cost by one minus the margin. For a $120 cost and a 40% margin the price is $200.

How much cash do I need to buy stock on margin?

Multiply the share price by the number of shares, then by the margin requirement. At 50% a $10,000 purchase needs $5,000 of your own cash.

What does 50:1 leverage mean in forex?

You can control a position 50 times larger than your deposit, which is a 2% margin requirement.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.