Margin Calculator
Computes gross margin, markup, gross profit and selling price from any two of cost, selling price and margin. Gross margin is price minus cost, divided by price, times 100; markup divides the same profit by cost instead. A target margin converts to a selling price as cost divided by one minus the margin fraction, and a known price and margin return the cost the same way in reverse. Negative margins appear when the price sits below cost.
Enter any two of cost, selling price and gross margin, and the calculator solves for the rest: gross margin as a share of the price, markup as a share of the cost, the gross profit, and the selling price. The control at the top sets the direction: cost and price give both percentages, cost and a target margin give the price to charge, and a price with its margin recovers the cost it implies. All four results appear in every mode, and when the price sits below the cost the margin and markup are shown negative rather than clipped at zero.
How margin and markup are calculated
Margin and markup start from the same quantity, the gross profit, which is simply the selling price minus the cost. The two percentages then divide that profit by different bases:
margin = (price − cost) ÷ price × 100
markup = (price − cost) ÷ cost × 100
Only the denominator differs. Margin asks what share of the money coming in is profit; markup asks how far the price has been raised above cost. On a profitable sale the price exceeds the cost, so the margin is always the smaller percentage, and the two meet only when the profit is zero.
The other two modes rearrange the margin formula. Fixing a target margin and solving for the price gives a division, not a multiplication:
price = cost ÷ (1 − margin ÷ 100)
and fixing the price along with its margin recovers the cost by the mirror-image step:
cost = price × (1 − margin ÷ 100)
The bracketed factor is the share of the price left for cost: a 40% margin leaves 0.60 of each unit of revenue.
The default numbers worked in all three directions
The defaults describe one sale three ways. Start from a cost of 60 and a price of 100: the gross profit is 100 − 60 = 40, the margin is 40 ÷ 100 × 100 = 40%, and the markup is 40 ÷ 60 × 100 = 66.67%. In the second mode, cost 60 with a target margin of 40% gives a price of 60 ÷ (1 − 0.40) = 60 ÷ 0.60 = 100. The third mode closes the loop: a price of 100 carrying a 40% margin implies a cost of 100 × 0.60 = 60, a profit of 40 and a markup of 66.67% once again. Whichever two numbers are held fixed, the rest are forced.
Why margin and markup get confused
A shop that buys an item for 100 and applies a 50% markup puts it on the shelf at 150. The margin on that sale is not 50%: the profit is 50, the price is 150, and 50 ÷ 150 × 100 = 33.33%, more than sixteen points lower. The confusion survives because both figures are usually quoted bare, with nothing to say which base was meant, and because at small percentages the gap is easy to miss: a 25% markup is a 20% margin.
The two convert directly: margin equals markup ÷ (100 + markup) × 100, and markup equals margin ÷ (100 − margin) × 100. A few paired values show how quickly they pull apart:
| Markup | Margin |
|---|---|
| 25% | 20% |
| 50% | 33.33% |
| 100% | 50% |
| 150% | 60% |
| 300% | 75% |
Markup grows without limit — a price of ten times cost is a 900% markup — while margin only creeps toward 100% and never reaches it while the item costs anything. A figure above 100% that someone calls a margin is a markup that lost its label.
Where the two percentages come from
The gross profit that both percentages describe is older than either of them. Luca Pacioli's Summa de arithmetica, geometria, proportioni et proportionalita, printed in Venice in 1494, contains the first printed description of double-entry bookkeeping, in a section titled Particularis de computis et scripturis, details of calculation and recording. Pacioli did not invent the method: he set down the practice already in use among Venetian merchants, and Benedetto Cotrugli had described the same system in a manuscript of 1458 that was still unprinted when the Summa appeared. Double-entry supplied a paired record of what goods cost and what they sold for, from which a merchant could strike a profit-and-loss balance; read that way, the gross-profit line is its descendant, and margin is that line expressed as a share of revenue.
Markup has a humbler pedigree, in shop practice rather than print. The 100% row of the table, doubling the cost for a 50% margin, is what the retail trade calls keystone pricing. It became the conventional rule of thumb in pre-computer stores because working out an optimal price by hand was more effort than most shops could spare, and doubling left room to absorb coupons, theft, returns and the other costs that eat into a margin. The word itself has no settled origin. The usual explanation in pricing guides ties it to the keystone of an arch, the central stone that locks the structure together; in the jewelry trade, where keystone has long meant double the wholesale price, one veteran of the trade press recalls it as the magazines' discreet code for that doubling, and one industry account traces the word to an 1896 jewelry magazine called The Keystone. None of these rests on a primary source. Keystone today is a starting point rather than a rule: it suits new products with no sales history, retailers with data usually move away from it, and on big-ticket items with slow turnover and high shipping costs a plain doubling can leave the margin thinner than it looks.
Gross margin is not net margin
Every figure on this page is gross: the only cost subtracted from the price is the direct cost you enter. Net margin subtracts everything else as well — rent, wages, shipping, card fees, advertising — before dividing by revenue, and it is always the smaller number. A product selling for 100 at a cost of 60 carries a 40% gross margin, but if the other expenses of the business average 45 per unit sold, each sale actually nets minus 5; a catalog can show a comfortable gross margin on every line and the company can still lose money. Gross margin is the tool for comparing products and setting prices; judging whether the business works needs the net figure. What you count as cost also matters: a reseller might enter the landed unit cost, a maker might include materials and direct labor, and a comparison across products only holds if the same convention is applied to each.
Pricing to the wrong number
The most expensive version of the confusion is using markup arithmetic to hit a margin target. Aim for a 40% margin on a cost of 60 and apply a 40% markup instead: the price comes out at 60 × 1.40 = 84, the profit is 24, and the margin is 24 ÷ 84 × 100 = 28.57% — more than eleven points short of the target. The correct move divides, 60 ÷ 0.60 = 100. The shortfall grows with the target. At a 20% goal the markup shortcut prices at 72 instead of 75 and delivers a 16.67% margin, about three points short; at a 60% goal it prices at 96 instead of 150 and delivers 37.5%, missing by more than twenty-two points.
Margins also make discounting sharper than it looks. At the default sale a 10% discount drops the price from 100 to 90 and the profit from 40 to 30: the price fell by a tenth, the profit by a quarter. At a 20% margin, cost 80 against the same price, the identical discount halves the profit from 20 to 10.
Assumptions and edge cases
Cost and price are treated as one consistent unit — per item, per order, per billable hour — and the calculator never asks which, so both inputs must describe the same thing. The currency selector changes the displayed symbol only; no conversion is applied. Handle tax the same way in both money figures, because dividing a tax-inclusive price by a tax-free cost overstates the profit. The margin field accepts values up to 99.9, and the computation refuses 100 or more outright, since the price formula would then divide by zero or by a negative number. Negative computed margins are legitimate and shown as negative. Amounts are capped at one trillion, and both cost and price must be greater than zero, because a zero cost makes markup a division by zero and a zero price does the same to margin. Percentages are displayed to two decimal places and money to the cent, while the computation keeps full floating-point precision, so a rounded figure on screen may carry hidden fractions.
Frequently asked questions
What is the difference between margin and markup?
Both start from the same gross profit, price minus cost, but divide it by different bases. Margin divides the profit by the price, markup divides it by the cost. Selling at 100 what cost 60 gives a profit of 40, which is a 40% margin and a 66.67% markup. On any profitable sale the markup is always the larger of the two numbers.
How do I calculate selling price from cost and margin?
Divide the cost by one minus the margin written as a fraction. For a 40% margin on a cost of 60, divide 60 by 0.60 to get 100. Multiplying the cost by 1.40 instead gives 84, which carries only a 28.57% margin, so the division is the step that cannot be replaced by a multiplication.
Is a 50 percent markup the same as a 50 percent margin?
No. A 50% markup on a cost of 100 gives a price of 150 and a profit of 50, and 50 divided by 150 works out to a margin of 33.33%. Reaching a 50% margin on that same cost needs a price of 200, which is a 100% markup. The two percentages describe the same sale from different bases and agree only when the profit is zero.
Can a profit margin be more than 100 percent?
Gross margin cannot reach 100% while the item costs anything, because profit divided by price only approaches one as the cost approaches zero. Markup has no such ceiling: selling for 100 what cost 20 is a 400% markup, yet the margin on that sale is 80%. A quoted margin above 100% is almost always a markup wearing the wrong name.
What does a negative margin mean?
The selling price is below the cost, so every sale loses money before any other expense is counted. Selling for 60 what cost 80 gives a gross profit of minus 20, a margin of minus 33.33% and a markup of minus 25%. The calculator displays the negative figures rather than clipping them at zero.
What is the difference between gross margin and net margin?
Gross margin, the figure this calculator computes, subtracts only the direct cost of the item from its price. Net margin also subtracts everything else the business pays, such as rent, wages, shipping and fees, before dividing by revenue. A product can carry a 40% gross margin while the business overall runs at a loss, so the two figures answer different questions.