Gross Margin Calculator
Working
Enter revenue and the cost of goods sold and this gross margin calculator works out your gross profit, your gross margin percentage and your markup percentage. It also runs the other direction: give it a unit cost and the margin you want, and it sets the selling price; or give it a selling price and a target margin, and it works out the most you can afford to pay for the goods.

What this calculator does
Gross margin is the share of each sales dollar left after paying for the goods themselves. If you sell $10,000 worth of goods that cost you $6,000, you keep $4,000 before rent, wages, marketing and everything else — a 40% gross margin. That number is the first checkpoint in any business: it tells you whether the pricing and the costs work at all, before overhead enters the picture.
This calculator covers the three questions owners actually ask. The first is a check on the past: given the revenue and the cost of goods sold, what margin did the business earn, and what markup does that equal? The second is a pricing question: if a unit costs $12 and you want a 40% margin, what price gets you there? The third is a buying question: if the price is fixed at $25 and you need a 40% margin, what is the most you can pay for the goods? Each mode uses the same two formulas, run in a different direction.
All three modes work at any scale. Use totals for a month or a year to check the business, or use per-unit numbers to price a single product. The math is identical; only the scope changes. What changes with scope is what the result means: a 40% margin on one product is a pricing fact, while a 40% margin across the whole business is a statement about the business model.
How this is calculated
Gross profit is revenue minus the cost of goods sold: gross profit = revenue − COGS. Gross margin is gross profit as a share of revenue: margin = gross profit ÷ revenue × 100. Markup is gross profit as a share of cost: markup = gross profit ÷ COGS × 100. The two percentages describe the same profit with different denominators, which is why they are never the same number.
The pricing modes rearrange the margin formula. To find the selling price for a target margin, divide the unit cost by one minus the margin: price = cost ÷ (1 − margin). A $12 unit cost with a 40% target margin gives $12 ÷ 0.60 = $20.00. To find the highest cost a fixed price allows, multiply the price by one minus the margin: cost = price × (1 − margin). A $25 price with a 40% target margin allows a cost of $25 × 0.60 = $15.00.
Source
These are the standard accounting definitions of gross profit, gross margin and markup: gross profit is revenue less cost of goods sold, and margin and markup are that profit expressed against revenue and cost. No external data is used — every figure comes from the numbers you enter. The U.S. Small Business Administration publishes general guidance on pricing and managing a small business.
Limitations
Gross margin says nothing about overhead. A business can run a healthy gross margin and still lose money once rent, wages, insurance and marketing are counted — that is what net margin measures, and this calculator does not attempt it. The result is also only as honest as the cost figure: leaving freight, packaging or direct labor out of COGS inflates the margin and hides the real cost of selling. Sales tax is not handled here; enter revenue and cost on the same tax basis.
What each input means
Revenue. The money from sales over the period you are measuring, before any costs are taken out. Use net revenue — after returns, refunds and discounts — so the margin reflects what the business actually kept. If you are pricing one product, revenue is the selling price of one unit.
Cost of goods sold (COGS). The direct cost of what was sold: materials, wholesale purchase cost, direct labor to make or prepare the goods, and freight to bring goods to you. It does not include rent, office salaries, advertising or insurance. Those are operating expenses, and they sit below the gross margin line.
Target gross margin. The margin you want to earn, as a percentage of the selling price. It must be below 100%: at 100% the cost would have to be zero, and above 100% the price formula breaks down entirely. A target of 0% means selling at cost, with no gross profit at all.
Cost per unit / selling price per unit. The two ends of the pricing modes. Cost per unit is what one unit costs you to buy or make; selling price per unit is what one unit sells for. Keep both in the same currency and the same unit — per item, per hour, per kilogram — or the answer will be wrong in a way that looks right.
Margin vs markup: the confusion that costs money
Margin and markup get mixed up constantly, and the mix-up is expensive. A business that wants a 40% margin but marks its goods up 40% ends up with a margin of about 28.6% — the profit is $4 on a $14 price, not $4 on $10 of cost. The gap grows as the numbers get bigger: a 100% markup sounds like doubling your money, but it is only a 50% margin, because the profit is half of the $20 selling price, not all of it.
The rule is simple once the denominator is clear. Markup divides by cost, so it can run past 100% without anything strange happening. Margin divides by price, so it can never reach 100% while the cost is above zero. When a supplier or a competitor quotes a percentage, ask which one it is before comparing it with your own numbers — a 60% markup and a 60% margin are two very different businesses.
To convert between them: margin = markup ÷ (1 + markup), and markup = margin ÷ (1 − margin), with both written as decimals. A 50% markup becomes 0.50 ÷ 1.50 = 33.3% margin. A 40% margin becomes 0.40 ÷ 0.60 = 66.7% markup. This calculator shows both figures for every calculation, so the conversion is done for you.
How to read your result
Start with the margin, because it is the number that has to carry the business. Every dollar of revenue keeps that share after the goods are paid for, and everything else — rent, wages, marketing, tax — comes out of it. If the margin is 20% and overhead runs 25% of revenue, the business loses money on every sale no matter how much volume grows. Volume does not fix a margin that is too thin; it multiplies the loss.
Next, look at the markup alongside it, because that is the number suppliers and trade pricing usually speak in. If your markup is far below what others in your line charge, either your costs are high or your prices are low, and the margin tells you which side of that gap matters more. A low margin with a normal markup points at costs; a low margin with a low markup points at prices.
A negative margin is a warning, not a curiosity. It means the goods cost more than they sell for, before any overhead. That sometimes happens deliberately — a loss leader that brings customers in to buy other things — but it should be a decision with a reason and a limit, not an accident discovered at the end of the quarter. If the calculator shows a negative margin on a product you thought was profitable, check the cost figure first: freight, packaging and direct labor are the items most often left out.
Worked example
A shop sells $10,000 of goods in a month. The goods cost $6,000 to buy, including freight. Gross profit is $10,000 − $6,000 = $4,000. Gross margin is $4,000 ÷ $10,000 × 100 = 40%. Markup is $4,000 ÷ $6,000 × 100 = 66.7%. The same $4,000 of profit reads as 40% against the price and 66.7% against the cost.
Now the pricing direction. A single item costs $12 to buy, and the owner wants a 40% margin on it. The price is $12 ÷ (1 − 0.40) = $12 ÷ 0.60 = $20.00, and the profit per unit is $20.00 − $12.00 = $8.00. Check it: $8.00 ÷ $20.00 = 40%, as required. If the owner had instead marked the item up 40%, the price would be $12 × 1.40 = $16.80, and the margin would be $4.80 ÷ $16.80 = 28.6% — the classic mix-up, worth $3.20 a unit.
And the buying direction. A competitor sells a similar item for $25, and the owner wants to match that price while keeping a 40% margin. The most the goods can cost is $25 × (1 − 0.40) = $25 × 0.60 = $15.00. Any supplier charging more than $15.00 a unit breaks the target at that price.
Common questions
What is a gross profit margin calculator?
A gross profit margin calculator works out the profit left after the cost of goods sold and expresses it as a percentage of revenue. Enter revenue and cost of goods sold and it shows gross profit, the margin percentage, and the markup percentage — the same three figures this tool calculates.
What is the difference between gross margin and markup?
Margin is profit as a share of the selling price; markup is profit as a share of the cost. They describe the same sale with a different denominator, so the numbers are never equal: a 50% markup on cost is a 33.3% margin on price.
What is a good gross margin?
There is no single number that counts as good. Margins vary widely by industry and by product, so compare your margin with similar businesses and check that it covers your operating costs with room left over. A margin that looks strong on paper is not enough if rent, wages and other overhead eat all of it.
How do I calculate gross margin from revenue and cost?
Subtract the cost of goods sold from revenue to get gross profit, then divide gross profit by revenue and multiply by 100. For revenue of $10,000 and cost of $6,000, gross profit is $4,000 and the margin is 40%.
Can gross margin be negative?
Yes. When the cost of goods sold is higher than revenue, gross profit is negative and so is the margin. That means each sale loses money before any overhead is counted, which is a pricing or cost problem that needs fixing, not a rounding issue.
What counts as cost of goods sold?
The direct costs of what you sold: materials, direct labor, manufacturing or wholesale purchase costs, and freight to get goods to you. Rent, office salaries, marketing and other overhead are operating expenses, not cost of goods sold, so they do not belong in this calculation.