Command Palette

Search for a command to run...

Profit Margin Calculator: Margin, Markup, and the Price You Should Charge

Profit Margin Calculator: Margin, Markup, and the Price You Should Charge

T
Toolz Team
|Aug 23, 2026|18 min read

Part of the Calculators collection

The first time I priced a product I mixed up margin and markup, and it cost me for a year. I was selling a small license add-on, worked out that I wanted "40% profit," multiplied the cost by 1.4, and shipped it. Only when I reconciled the year's numbers did I realise a 40% markup had given me a 28.6% margin, not the 40% I thought I was banking. The gap was small on one sale and large across a thousand. Since then I have never priced anything without running the numbers first, and the Profit Margin Calculator on toolz.dev is the tool I built so I would never make that mistake again. This guide explains what margin and markup actually mean, why they diverge, and how to price from the right one.

TL;DR: Margin is profit as a share of the selling price; markup is profit as a share of the cost. They describe the same profit but are not equal, and the gap grows as prices rise. Give the Profit Margin Calculator any two of cost, price, and margin and it returns the rest, showing margin and markup side by side. Everything runs in your browser with nothing uploaded.

What is a profit margin calculator?

A profit margin calculator works out the relationship between what an item costs you, what you sell it for, and how much of that sale is profit. Those quantities are tied together by simple arithmetic: profit is the selling price minus the cost, gross margin is that profit divided by the selling price, and markup is the same profit divided by the cost. Because the three values are locked together, knowing any two fixes the rest, which is why the tool can start from cost and price, cost and a target margin, cost and a markup, or price and a margin.

The reason a dedicated tool earns its place, rather than a quick mental multiply, is that margin and markup are two different views of the same profit, and they are constantly confused. A product that costs 40 and sells for 100 makes 60 in profit. That 60 is 60% of the 100 selling price, so the margin is 60%. The same 60 is 150% of the 40 cost, so the markup is 150%. Both numbers are correct, they describe the identical transaction, and they are wildly different. Price from the wrong one and you quietly leave money on the table on every unit you sell.

On toolz.dev the flow is deliberately short. You pick which pair of numbers you already know, type them in, and the result appears with gross margin, markup, profit per unit, and the selling price all together. An optional quantity field multiplies everything into batch totals, so a quote for 500 units is one field away. Currency symbols and thousands separators are stripped automatically, so pasting "$1,299.00" from an invoice works without cleanup.

What is the difference between margin and markup?

Margin measures profit against the selling price; markup measures the same profit against the cost. That single distinction is the whole source of the confusion, because the selling price is always larger than the cost, so dividing the same profit by the larger number (the price) gives a smaller percentage than dividing it by the smaller number (the cost). Margin can therefore never exceed 100%, since profit can never be more than the whole selling price, but markup has no ceiling at all.

The practical trap is treating a markup target as if it were a margin target. Retailers, wholesalers, and suppliers often quote in markup because it is how they mark up from a known cost, while accountants and investors think in margin because it maps to the income statement. If your supplier says "we work on a 50% markup" and you assume that means a 50% margin, your whole pricing model is off from the start. A 50% markup is only a 33.3% margin, a 17-point gap that widens further at higher markups.

Here is the relationship laid out, which is the table I wish I had seen before that first pricing mistake:

Markup Equivalent margin Example: cost 100
20% 16.7% sells for 120
33.3% 25% sells for 133.33
50% 33.3% sells for 150
100% 50% sells for 200
150% 60% sells for 250
300% 75% sells for 400

The calculator reports both figures on every result, so whichever number your supplier, spreadsheet, or accountant uses, you can read across to the other without doing this conversion in your head. If you deal in the underlying percentages a lot, the general-purpose percentage calculator handles the raw "what is X% of Y" arithmetic that sits underneath all of this.

How do you calculate profit margin?

Gross profit margin is profit divided by revenue, expressed as a percentage. First subtract the cost from the selling price to get the profit in currency, then divide that profit by the selling price, then multiply by 100. For an item that costs 40 and sells for 100, the profit is 60, and 60 divided by 100 is 0.6, so the gross margin is 60%. That is the entire calculation, and it is worth internalising because it is the version that maps directly to how a business reports its performance.

The subtlety that trips people up is which figure sits in the denominator. Margin always divides by the selling price, never the cost, and getting that backwards turns a margin calculation into a markup calculation without you noticing. The two calculations use the identical numerator, the profit, and differ only in the denominator, which is exactly why they are so easy to mix up and why the answers diverge so sharply.

The calculator removes the ambiguity by asking what you know up front and labelling every output. Enter cost and price in the first mode and it computes both margin and markup so you can see them side by side. There is no way to accidentally read a markup as a margin, because both are on screen with their own labels, and that single design choice is the reason I trust it for real pricing decisions rather than a scratchpad multiplication.

How do I calculate the selling price from a target margin?

To find the price that hits a target margin, divide the cost by one minus the margin expressed as a decimal. If a product costs 30 and you want a 40% margin, the price is 30 divided by (1 minus 0.40), which is 30 divided by 0.60, which is 50. Selling at 50 gives a 20 profit, and 20 divided by the 50 price is 40%, exactly the target. This is the calculation people reach for most often, because in practice you usually know your cost and your desired margin and need to work forward to a price.

The instinctive but wrong approach is to multiply the cost by one plus the margin: 30 times 1.40, which gives 42. Sell at 42 and your profit is 12, which is only 28.6% of the 42 price, well short of the 40% you wanted. That multiply-by-one-plus-the-percentage move is the markup formula, and using it when you meant margin is the precise error that cost me across that first year. The difference between 42 and 50 is not rounding; it is the entire gap between the margin you planned and the margin you actually earned.

Set the calculator to "Cost and target margin" mode and it does the division for you, returning the exact price to charge along with the markup that price implies. Because it also shows the markup, you can hand that number to a supplier or a channel partner who prices in markup terms without having to translate it yourself. For longer-horizon pricing where the money grows or compounds over time, such as subscription revenue, the compound interest calculator covers the time-value side that a single-transaction margin calculation does not.

Is this gross margin or net margin?

This tool calculates gross margin, which is based only on the direct cost of the product and its selling price. Gross margin answers a focused question: for this specific item, after paying for the item itself, how much is left. It deliberately ignores everything else, which makes it the right number for a pricing decision on a single product, because pricing is fundamentally about the relationship between one item's cost and its price.

Net margin is a different and broader figure. It starts from the same revenue but subtracts not just the direct cost of goods but also operating expenses, salaries, rent, marketing, taxes, and every other cost of running the business. Net margin is therefore always lower than gross margin, sometimes dramatically so, and it answers a company-wide question about overall profitability rather than a product-level question about pricing. A business can have a healthy 60% gross margin and still run at a net loss if its overhead is too high.

The reason to keep them separate is that they inform different decisions. You use gross margin to set prices and compare products, and you use net margin to judge whether the whole operation is viable. This calculator stays firmly in the gross-margin lane because that is where pricing lives, and mixing overhead into a per-item price calculation would obscure the very relationship you are trying to set. When I plan the finances behind a project, I keep the two in different columns for exactly this reason, a habit I described in the developer productivity tools guide.

How do discounts affect my margin?

A discount comes straight off your margin, and it comes off faster than most people expect, because the discount is a percentage of the price while your margin is only a slice of that price. If you sell at a 40% margin and then offer a 20% discount, you are not giving away 20% of your profit; you are giving away 20% of the whole price, which can be half your profit or more. A product costing 60 and selling for 100 has a 40 profit, but discount the price to 80 and the profit collapses to 20, halving your margin from 40% to 25%.

This is why discounting needs to be modelled, not eyeballed. The temptation to match a competitor's sale or clear old stock with "just 15% off" can wipe out a larger share of profit than the headline percentage suggests, and on thin-margin products a modest discount can push a sale below cost entirely. The safe habit is to recalculate the margin at the discounted price before committing to the promotion, so you know exactly what profit remains at the sale price.

To model this, run the margin calculation twice, once at full price and once at the discounted price, and compare the profit that survives. The dedicated discount calculator works out the sale price and the amount saved from a percentage off, and feeding that discounted price back into the margin calculator shows you the true cost of the promotion. Pairing the two is how I decide whether a sale is worth running or whether it just donates profit to buyers who would have paid full price.

When would I actually use this?

Setting a launch price is the primary case. When I add a paid tier or a new product, I start from the fully loaded cost per unit, decide the margin I need to sustain the work, and let the calculator return the price. Working forward from cost and margin to a price, rather than picking a price that "feels right" and hoping the margin works out, is the difference between a pricing model and a guess. The quantity field then scales it to a bulk quote in one step when someone asks for volume.

Reviewing an existing product is the mirror image. You already know the cost and the price, so you enter both and read the margin and markup to check whether a product is pulling its weight. I do this periodically across a catalogue, because supplier costs drift upward while prices often stay put, and a margin that looked fine at launch can quietly erode. Spotting the products whose margins have thinned tells you where to raise a price or renegotiate a cost before the slippage compounds.

Bigger financial decisions round it out. Comparing the margin on two products tells you which to promote; checking the margin at a proposed wholesale price tells you whether a distribution deal is viable; and modelling a discount tells you what a promotion really costs. For the financing side of a larger purchase or expansion, the loan calculator covers the repayment math that sits alongside these margin questions. The whole cluster of small financial tools is the kind of quiet, browser-based kit I make the case for in the web developer toolkit guide.

Is my pricing data private?

Yes. Every calculation runs in JavaScript inside your browser. Your costs, prices, and margins are never transmitted, logged, or stored, and the tool keeps working with no network connection once the page has loaded. This matters more than it might seem, because pricing and cost data are among the most commercially sensitive numbers a business has. Your margin structure is exactly the thing you would not want flowing through a third-party server, and with a client-side tool it never does.

Because the work happens locally, you can model prices on a plane, in a supplier meeting with no signal, or anywhere else, and nothing about your cost base leaves the device. That local-first approach is the same one behind every tool on toolz.dev, and for financial figures in particular it is not a nice-to-have but the whole reason to prefer a browser tool over a hosted spreadsheet. The broader argument for keeping sensitive data off other people's servers is one I make in the data privacy in online tools guide.

FAQ

How do you calculate profit margin?

Gross profit margin is profit divided by revenue, times 100. Subtract the cost from the selling price to get the profit, then divide that profit by the selling price. A product that costs 40 and sells for 100 makes 60 profit, and 60 divided by 100 is 0.6, so the gross margin is 60%. The calculator does this and also shows the markup so you never confuse the two.

What is the difference between margin and markup?

Margin measures profit against the selling price, while markup measures the same profit against the cost. A 40 item sold for 100 has a 60% margin (60 divided by 100) but a 150% markup (60 divided by 40). Margin can never exceed 100%, but markup has no upper limit, which is why the two numbers diverge as prices rise.

How do I calculate the selling price from a target margin?

Divide the cost by one minus the margin as a decimal. To hit a 40% margin on a 30 cost, calculate 30 divided by (1 minus 0.40), which is 30 divided by 0.60, or 50. Set the calculator to "Cost and target margin" mode to get this automatically. Do not multiply cost by one plus the margin, as that gives a markup, not a margin.

Why is a 50% markup not a 50% margin?

Markup is based on cost and margin is based on price, and the price is always larger than the cost, so the same profit is a smaller share of the price. A 10 cost marked up 50% sells for 15; that 5 profit is 33.3% of the 15 price, giving a 33.3% margin from a 50% markup. The two only match when profit is zero.

Is this gross margin or net margin?

This tool calculates gross margin, based only on the direct cost of the product and its selling price. Net margin also subtracts operating expenses, taxes, and overhead, so it is always lower. Use gross margin for pricing individual products and net margin to judge the overall profitability of the whole business.

How do discounts affect my margin?

A discount comes off the whole selling price, so it eats a larger share of profit than the discount percentage suggests. A product costing 60 and selling for 100 has a 40 profit, but a 20% discount to 80 cuts the profit to 20, halving the margin from 40% to 25%. Always recalculate the margin at the discounted price before running a promotion.

Can I calculate margin on multiple units at once?

Yes. Enter a quantity and the calculator multiplies the per-unit cost, revenue, and profit into batch totals. The margin and markup percentages stay the same regardless of quantity, since they are ratios, but the total profit figure scales with the number of units, which is what you need for a bulk quote.

Is my pricing data private?

Yes. Every calculation runs in your browser in plain JavaScript. Nothing you enter is uploaded, logged, or stored, and the tool keeps working with no internet connection once the page has loaded. Because pricing and cost data are commercially sensitive, keeping them on your own device rather than a server is the whole point of a client-side tool.


Price your next product with the free Profit Margin Calculator. Enter any two of cost, price, and margin to get profit, gross margin, and markup together, entirely in your browser, with nothing uploaded.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!