Stock Margin Calculator

How much of your selling price do you actually keep?

Enter your cost and selling price to instantly see gross margin percentage, markup, and profit per unit. Know exactly how much you keep from every sale before committing to a price.

Updated July 2026 · How this works

Example calculation — edit any field to use your own numbers

Worth knowing
How It Works
The formula, explained simply

Every sale has two numbers competing for the same dollar: what you paid to get the product, and what your customer paid to take it. Gross margin is the fraction of the selling price that survives after the first number is subtracted. A 60% margin means sixty cents of every dollar in revenue stays with the business before any other cost is paid. The other forty cents goes straight back to the supplier or manufacturer.

The formula is deceptively simple: subtract cost from price, then divide by price. But the denominator is what trips people up. Margin always divides by the selling price. Markup always divides by the cost. Both give you a percentage of the same profit, but they are different percentages. A business quoting margins and a supplier quoting markups can be describing identical economics while appearing to disagree — the numbers look completely different.

Where this matters in practice is when setting prices backward from a target. If you need a 50% margin and you add 50% to your cost, you will be short. Adding 50% to a $20 cost gives $30 — but $10 profit on $30 revenue is only 33.3% margin, not 50%. To hit a 50% margin target, you divide the cost by 0.50, giving $40. The target margin field in this calculator does that division automatically.

When To Use This
Right tool, right situation

Use this calculator when you are setting a price for a new product and need to confirm the margin before committing. Use it when a supplier raises costs and you need to know whether your existing price still works, or how much you need to raise it to preserve margin. Use it when quoting wholesale prices and the buyer wants a specific margin — the target margin field gives you the minimum price you can offer.

Use it at the product level, not the business level. This tool answers one question: does the gap between what you paid and what you charge cover its share of the business? The answer is only valid for one product at one price point. If you sell a mix of products, each one needs its own calculation, and your blended margin is what matters for the P&L.

Do not use this calculator to assess overall business profitability. It does not account for returns, discounts, volume rebates, or any overhead. A 60% gross margin business can still fail if the cost of acquiring customers and running operations exceeds that margin. This tool is the first filter, not the final answer.

Common Mistakes
Why results sometimes look wrong

The most common mistake is confusing margin with markup when setting prices. A buyer asks for a 40% margin and the seller adds 40% to their cost — which produces a 28.6% margin, not 40%. The business ships product, invoices correctly, and only discovers the error when the financials come back short. Always calculate the target selling price from cost using the margin formula, never by multiplying cost by one plus the target percentage.

The second mistake is calculating margin on a cost that does not include all direct costs. If freight, packaging, customs duties, or payment processing fees are real costs of getting the product to the customer, they belong in the cost figure. Leaving them out inflates the apparent margin. A product that shows 50% margin before a 4% payment fee and 8% freight actually has 38% margin — a full twelve points lower.

The third mistake is treating gross margin as net profit. Gross margin only subtracts cost of goods. It does not touch rent, salaries, marketing, software, or any fixed operating cost. A business running 45% gross margin with 50% operating expenses is losing money on every sale at scale. Gross margin is the ceiling, not the floor — your net profit will always be lower.

The Math
Worked examples and deeper derivation

Gross margin percentage = ((Selling Price - Cost) / Selling Price) x 100

Markup percentage = ((Selling Price - Cost) / Cost) x 100

To find the selling price required for a target margin: Selling Price = Cost / (1 - Target Margin)

Where Target Margin is expressed as a decimal — so 60% becomes 0.60.

For example: cost $14.50, selling price $34.99. Profit per unit = $34.99 - $14.50 = $20.49. Gross margin = ($20.49 / $34.99) x 100 = 58.56%. Markup = ($20.49 / $14.50) x 100 = 141.31%.

To hit a 65% margin with the same cost: $14.50 / (1 - 0.65) = $14.50 / 0.35 = $41.43 required selling price.

Note that margin and markup converge only when profit is zero — at that point both are 0%. As margin approaches 100%, markup approaches infinity. You cannot have a 100% margin on a product with any non-zero cost.

Retail product: clothing item
Cost $18.00, selling price $44.99, 300 units per month
Gross margin is 59.99%, meaning you keep about $0.60 of every dollar of revenue after cost of goods. Total monthly profit on cost of goods alone is $8,097 — but this does not include rent, staff, or shipping, so you need to know what fixed costs that profit has to absorb.
Edge case: very low-margin commodity resale
Cost $98.50, selling price $102.00
Gross margin comes out at 3.43% and markup is just 3.55%. At this level, a single unforeseen cost — a return, a freight surcharge, a payment processing fee — can wipe out the entire profit. The calculator flags a warning below 10%, which is the practical signal to revisit the pricing or supplier negotiation.
Freelancer pricing a service package
Cost $150 (direct time and tools), selling price $450, target margin 70%
The gross margin is 66.67% and the markup is 200%. The target margin field shows that to hit 70% margin, the package would need to be priced at $500. The difference — just $50 — is a useful anchor for the next client conversation about pricing.
Expert Unlock
The thing most explanations skip

The margin formula assumes price and cost are independent and static — neither is true in practice. Volume pricing changes cost at different order quantities, and competitive pressure changes the ceiling on price. The real practitioner question is not what is my margin at this price, but what is my margin at each price tier and each cost bracket. Running this calculation at two or three cost and price combinations gives you the margin sensitivity — how much margin changes per dollar of price movement or cost reduction. That sensitivity number tells you whether effort is better spent on supplier negotiation or price optimisation.

Why is my margin percentage different from my markup?

What is the difference between margin and markup?
Margin is profit as a percentage of the selling price. Markup is profit as a percentage of the cost. A product that costs $10 and sells for $20 has a 50% margin but a 100% markup. They measure the same profit from different reference points — margin tells you how much of each dollar of revenue you keep, markup tells you how much you added to cost.
What is a good gross margin for a product business?
It depends heavily on the category. Physical retail typically runs 40% to 60% gross margin. Software and digital products often exceed 70% or 80%. Wholesale and commodity distribution can be 10% to 20%. The key is whether gross margin is enough to cover your operating costs and still leave net profit — a 50% gross margin with 60% operating expenses still loses money.
How do I find the selling price to hit a target margin?
Divide your cost by one minus your target margin expressed as a decimal. For a 60% margin target on a $15 cost: $15 divided by (1 minus 0.60) equals $37.50. This is not the same as adding 60% to the cost — that would give you a 37.5% margin, not 60%. Use the target margin field in this calculator to avoid that common error.

Need something this doesn't cover?

Suggest a tool — we'll build it →