How the margin calculator works
Margin, markup, and price are three views of the same simple relationship: what an item costs you, what you sell it for, and the profit in between. This tool moves between them in three modes so you can start from whatever numbers you already have.
The gap between price and cost is your gross profit:
- Gross profit = selling price − cost
Everything else on this page is that same profit expressed as a percentage of either the price (margin) or the cost (markup).
Gross margin formula
Gross margin expresses profit as a percentage of the selling price:
- Gross margin % = (price − cost) ÷ price × 100
Buy an item for $40 and sell it for $50, and the profit is $10. That $10 is 20% of the $50 price, so the gross margin is 10 ÷ 50 = 0.20, or 20%. Margin answers the question “of every dollar a customer pays me, how much do I keep?”
Markup formula
Markup expresses the same profit as a percentage of the cost:
- Markup % = (price − cost) ÷ cost × 100
For the same $40 item sold at $50, the $10 profit is 10 ÷ 40 = 0.25, or a 25% markup. Markup answers a different question: “how much did I add on top of what I paid?”
Margin vs markup: the distinction that trips people up
The $40 to $50 example shows why these two numbers must never be confused: the exact same sale is a 20% margin and a 25% markup. They describe one $10 profit against two different bases.
- Margin uses price as the base, so it can never reach 100%.
- Markup uses cost as the base, so it has no upper limit.
Because cost is always smaller than price, the markup percentage is always larger than the margin percentage for the same sale. Mixing them up is a common and expensive mistake. If you mean to earn a 40% margin but instead add a 40% markup, you will under-price and keep less than you planned.
Pricing to hit a target margin
If you know your cost and the margin you want to keep, work backwards to the price:
- Price = cost ÷ (1 − margin ÷ 100)
To earn a 20% margin on a $40 item, the price is $40 ÷ (1 − 0.20) = $40 ÷ 0.80 = $50.00. Note that you cannot simply add 20% of the cost ($8, giving $48), because that would be a 20% markup and would leave you with a margin of only about 16.7%.
To price from a markup instead, add the markup to the cost:
- Price = cost × (1 + markup ÷ 100)
A 25% markup on $40 is $40 × 1.25 = $50.00, which happens to be the same price as a 20% margin. That is the whole point of keeping the two straight.
A note on gross vs net
The figures here are gross margin and markup: they only account for the direct cost of the item. They do not include overheads like rent, wages, payment processing fees, shipping, returns, or taxes. Your net profit after those costs will be lower. Use gross margin to set prices and compare products, then track net profit separately to see whether the business as a whole is making money. These results are estimates for planning, not accounting or professional financial advice.