Any two of five

Margin calculator

To price for a target margin, divide the cost by (1 − margin). A $60 item needs a $100 price for a 40% margin, because $40 of profit is 40% of $100; the same sale is a 66.7% markup on cost.

Profit Margin Calc editorial teamUpdated 7 sources

Calculator 02

Margin solver

Pick what you know; the rest is calculated

Try:
I know the

Inputs

$
%
Selling price$100.00
Cost$60.00
Profit$40.00price − cost
Margin40.00%profit ÷ price
Markup66.67%profit ÷ cost

Selling at $100.00 with a $60.00 cost earns $40.00 per item: a 40.00% margin and a 66.67% markup.

A 40.00% margin is the same sale as a 66.67% markup: the profit is $40.00 either way, divided by the price for margin and by the cost for markup.

Formula. Price = cost ÷ (1 − margin). Cost = price × (1 − margin). Margin = (price − cost) ÷ price. Markup = (price − cost) ÷ cost. Price = cost × (1 + markup).

How to calculate margin

Margin is profit divided by the selling price, so a sale with a $40 profit on a $100 price has a 40% margin.[1] Four rearrangements of that one formula cover every pricing question:

Margin=Price − CostPrice
Price=Cost1 − MarginUse this to set a price that hits a target margin.
Cost=Price × (1 − Margin)Use this to find the most you can pay a supplier and still earn your margin at a fixed retail price.

The second formula is the one people get wrong most often. Adding 40% to a $60 cost gives $84, which is a 40% markup but only a 28.6% margin. To earn a 40% margin the price has to be $60 ÷ 0.60 = $100.

Margin calculator examples

Each row starts from a different pair of known numbers, the way the solver above does.

You knowExampleYou getAnswer
Cost and price$75 cost, $100 priceMargin, markup and profit$100.00 price · $75.00 cost · 25.0% margin · 33.3% markup
Cost and target margin$60 cost, 40% marginSelling price$100.00 price · $60.00 cost · 40.0% margin · 66.7% markup
Price and margin$80 price, 35% marginMost you can pay (cost)$80.00 price · $52.00 cost · 35.0% margin · 53.8% markup
Cost and markup$40 cost, 50% markupSelling price$60.00 price · $40.00 cost · 33.3% margin · 50.0% markup
Margin and profit wanted20% margin, $10 profitPrice and cost$50.00 price · $40.00 cost · 20.0% margin · 25.0% markup

Margin percentage vs percentage points

A change in margin is measured in percentage points, not percent: moving from a 30% margin to a 33% margin is a rise of 3 points, which is a 10% improvement in the margin itself. Mixing the two makes a small change sound large or a large change sound small, so price lists and reports should say which one they mean.

Margins also do not add up across products. A 50% margin on a $10 item and a 20% margin on a $90 item do not average to 35%; weighted by revenue they give a 23% blended margin ($5 + $18 = $23 of profit on $100). The gross margin calculator blends up to three product lines correctly.

Margin after selling fees

Selling fees come straight out of the margin: a 40% margin on a $100 sale of a $60 item falls to 26.0% on eBay, because the marketplace fee is charged on the price, not on the profit.[7] Payment processors take less, but still two to four points.[4][5][6]

$60 cost, $100 price, 40% margin before fees (U.S. rates, no shipping or tax)
Where you get paidFeeProfit leftMargin after fees
Cash, check or bank transfer$0.00$40.0040.0%
Stripe, online card payment$3.20$36.8036.8%
Square online checkout (Free plan)$3.60$36.4036.4%
PayPal Checkout or invoice$3.98$36.0236.0%
eBay, most categories, no Store$14.00$26.0026.0%

To keep a full 40% after the fee, build the fee into the price with the selling price calculator, or use the "what to charge" mode of the eBay fee calculator or the PayPal fee calculator.

Margin formulas for Excel and Google Sheets

Every mode of the solver is a one-cell spreadsheet formula. Put the cost in column A, the price in B, the margin in C and the markup in D, and format the margin and markup cells as percentages so 40% is stored as 0.4.

You knowYou wantFormula (row 2)
Cost + priceMargin=(B2-A2)/B2
Cost + marginPrice=A2/(1-C2)
Price + marginMost you can pay=B2*(1-C2)
Cost + markupPrice=A2*(1+D2)
Price + markupCost=B2/(1+D2)
MarginMatching markup=C2/(1-C2)
MarkupMatching margin=D2/(1+D2)

The formulas work the same in Excel, Google Sheets and Numbers. Wrap a result in =ROUND(…, 2) before you print a price list, and guard against a zero price with =IF(B2=0, "", (B2-A2)/B2) so empty rows do not show a divide-by-zero error. For blended margins across a product list, rounding prices and fee-inclusive prices, see the full margin formula Excel guide.

Which costs go into the margin?

For a product margin, use the cost of the goods themselves: purchase price or materials, direct labor and inbound freight, which is what U.S. tax rules count as cost of goods sold.[3] Rent, software and advertising are overhead; they reduce net profit, not the gross margin on each unit. Costs that rise with every sale, such as marketplace commissions, card fees and outbound shipping, are variable costs: the contribution margin calculator subtracts them per unit before fixed costs.[2]

Frequently asked questions

What is the formula for margin?

Margin = (selling price − cost) ÷ selling price. Multiply by 100 for a percentage.

How do I calculate the selling price from cost and margin?

Divide the cost by one minus the margin as a decimal. For a $60 cost and a 40% margin: 60 ÷ 0.60 = $100.

Is a 50% margin the same as doubling the cost?

Yes. Doubling the cost is a 100% markup, and a 100% markup always produces a 50% margin: a $20 item sold for $40 keeps $20, half of the price.

Why is my margin lower than my markup?

Both use the same profit, but margin divides it by the larger number (the price) and markup by the smaller one (the cost). Margin is therefore always the smaller percentage when the sale is profitable.

Is this a trading or forex margin calculator?

No. This calculator measures profit margin on a sale. Margin in trading means the collateral a broker requires to open a leveraged position, which is a different calculation.

Sources

  1. Principles of Marketing, 18.3 Retailing Strategy Decisions (markup and gross margin) · OpenStax, Rice University, 2023
  2. Principles of Accounting, Volume 2: Managerial Accounting, 3.1 Contribution margin per unit, ratio and total · OpenStax, Rice University, 2019
  3. Publication 334, Tax Guide for Small Business (chapters 6 and 7: cost of goods sold and gross profit) · Internal Revenue Service, reviewed April 30, 2026
  4. Pricing and fees (U.S.) · Stripe, checked 2026-11-13
  5. Processing fees, plans and software pricing (U.S.) · Square, checked 2026-11-13
  6. Merchant and business fees (U.S.) · PayPal, November 4, 2026
  7. Selling fees · eBay Help, checked 2026-11-13