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:
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 know | Example | You get | Answer |
|---|---|---|---|
| Cost and price | $75 cost, $100 price | Margin, markup and profit | $100.00 price · $75.00 cost · 25.0% margin · 33.3% markup |
| Cost and target margin | $60 cost, 40% margin | Selling price | $100.00 price · $60.00 cost · 40.0% margin · 66.7% markup |
| Price and margin | $80 price, 35% margin | Most you can pay (cost) | $80.00 price · $52.00 cost · 35.0% margin · 53.8% markup |
| Cost and markup | $40 cost, 50% markup | Selling price | $60.00 price · $40.00 cost · 33.3% margin · 50.0% markup |
| Margin and profit wanted | 20% margin, $10 profit | Price 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]
| Where you get paid | Fee | Profit left | Margin after fees |
|---|---|---|---|
| Cash, check or bank transfer | $0.00 | $40.00 | 40.0% |
| Stripe, online card payment | $3.20 | $36.80 | 36.8% |
| Square online checkout (Free plan) | $3.60 | $36.40 | 36.4% |
| PayPal Checkout or invoice | $3.98 | $36.02 | 36.0% |
| eBay, most categories, no Store | $14.00 | $26.00 | 26.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 know | You want | Formula (row 2) |
|---|---|---|
| Cost + price | Margin | =(B2-A2)/B2 |
| Cost + margin | Price | =A2/(1-C2) |
| Price + margin | Most you can pay | =B2*(1-C2) |
| Cost + markup | Price | =A2*(1+D2) |
| Price + markup | Cost | =B2/(1+D2) |
| Margin | Matching markup | =C2/(1-C2) |
| Markup | Matching 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]
- Selling on a marketplace? The selling price calculator builds the platform's percentage fee into the price so the margin is what you keep.
- Know your markup instead? Use the markup calculator or the conversion table on the profit margin calculator.
- Need the whole business? The net profit margin calculator works from an income statement.
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
- Principles of Marketing, 18.3 Retailing Strategy Decisions (markup and gross margin)
- Principles of Accounting, Volume 2: Managerial Accounting, 3.1 Contribution margin per unit, ratio and total
- Publication 334, Tax Guide for Small Business (chapters 6 and 7: cost of goods sold and gross profit)
- Pricing and fees (U.S.)
- Processing fees, plans and software pricing (U.S.)
- Merchant and business fees (U.S.)
- Selling fees