If you need to know how to calculate margin, start with one rule: margin is profit divided by selling price, not profit divided by cost.
Subtract cost from the price. Divide that profit by the price. Multiply by 100. That percentage is your margin. On a $40 item that costs $25, profit is $15 and margin is 37.5%.
The same idea works for a whole month of sales. Which costs you subtract decides whether you are looking at gross margin, operating margin, or net margin. This article walks through each formula, shows worked examples, and flags the markup mix-up that causes most pricing errors.
How to Calculate Margin
The Basic Margin Formula
Margin (as a percent) is:
In dollars, profit is simply:
Use net selling price: what the customer actually paid after discounts. Use the cost that matches the question you are asking. For a single product, that is usually what you paid to buy or make that unit, plus costs that hitch a ride on the unit, such as inbound freight.
Example:
- Price: $40.00
- Cost: $25.00
- Profit: $15.00
- Margin: $15.00 ÷ $40.00 = 0.375, or 37.5%
You keep 37.5 cents of each dollar of that sale, before overhead that is not in the $25 cost.
If you sell 200 units at the same price and cost, revenue is $8,000, cost is $5,000, profit is $3,000, and the margin is still 37.5%. Volume changes the dollars. It does not change the percentage if the price and unit cost stay the same.
How to Calculate Margin Step by Step
- Write down the selling price or the period’s net sales.
- Write down the matching cost.
- Subtract cost from price (or sales) to get profit.
- Divide profit by price (or sales).
- Multiply by 100 to get the percent.
That is the entire calculation. The hard part is choosing the right cost and the right sales figure.
Use this checklist before you divide:
- Did you subtract returns and discounts from sales?
- Did you leave sales tax collected for the state out of revenue?
- Does the cost belong to those same sales, not last season’s leftover inventory purchases mixed in at random?
- Are you calculating one item, one job, or the whole company? Do not mix those layers in one percentage and then compare them as if they were the same thing.
Gross, Operating, and Net Margin
“Margin” on a product sheet usually means gross margin. “Margin” on a year-end review often means net margin. Name the type.
Gross margin
Gross margin uses only the direct cost of what you sold (COGS).
It tells you whether the product or job itself throws off enough money to fund the rest of the business.
Operating margin
Operating margin starts after COGS, then subtracts operating expenses such as rent, salaries, utilities, insurance, and marketing. It leaves out interest and income tax.
It tells you whether the day-to-day business works after overhead.
Net margin
Net margin uses net income, after interest, taxes, and other remaining items.
It tells you what share of sales is left at the bottom.
Quick company example for one quarter:
- Revenue: $120,000
- COGS: $66,000
- Operating expenses: $36,000
- Interest and tax: $4,800
Gross profit is $54,000 (45% margin).
Operating profit is $18,000 (15% margin).
Net profit is $13,200 (11% margin).
All three are correct. They measure different depths of cost.
Margin vs. Markup
Markup uses cost as the base:
On the $40 price and $25 cost:
- Margin = 37.5%
- Markup = $15 ÷ $25 = 60%
Same $15 profit. Different denominators. Markup is always the larger percent when the sale is profitable, because cost is smaller than price.
This is the usual mistake: someone wants a 40% margin, then adds 40% to cost. That is a 40% markup, which produces a lower margin.
If cost is $25 and you add 40%:
- Price = $35
- Profit = $10
- Actual margin = $10 ÷ $35 ≈ 28.6%
To hit a target margin, set price from cost this way. Use the margin as a decimal (40% is 0.40):
$25 ÷ (1 − 0.40) = $25 ÷ 0.60 ≈ $41.67.
Profit = $16.67.
$16.67 ÷ $41.67 = 40%.
Convert one percent to the other with these (use decimals):
A 50% markup is a 33.3% margin. A 100% markup (double the cost) is a 50% margin. Margin cannot reach 100% unless cost is $0.
How to Calculate Margin on a Job or Service
The formula does not change. The cost list does.
Say a plumber bills $480 for a service call. Variable job costs are $190 for parts, $85 for a helper’s hours, and $25 for truck costs tied to that call. Direct cost is $300. Profit is $180. Job margin is $180 ÷ $480 = 37.5%.
That 37.5% still has to cover dispatch software, shop rent, insurance, and unpaid drive time that you did not put in the $300. If those fixed costs are large, a “good” job margin can still leave a thin operating margin for the month.
For professional services billed by the hour, calculate margin on the invoice, not on the clock rate alone. Write-offs, discounted hours, and unpaid admin time lower the real selling price.
How to Calculate Margin From an Income Statement
You do not need unit prices if you already have totals.
- Find net sales for the period.
- Find the profit line you care about (gross profit, operating income, or net income).
- Divide that profit by net sales.
- Multiply by 100.
If gross profit is $54,000 and net sales are $120,000, gross margin is 45%. You can skip reconstructing every invoice.
Match the period. A trailing-twelve-month margin and a single holiday week are not comparable. Seasonal businesses should compare the same month or quarter year over year.
What Counts as Cost
Wrong costs produce a precise, useless margin.
Often included in product or job cost:
- Merchandise or raw materials
- Inbound freight
- Packaging that goes with the unit
- Direct labor that tracks the unit or job
Often left out of gross margin, then picked up later:
- Rent
- Salaried office staff
- Most software subscriptions
- General advertising
- Interest
- Income tax
Gray areas depend on how you run the business. Payment-processing fees and sales commissions rise with each sale. Some owners put them in a product-level margin so they do not kid themselves. Others leave them in operating expenses and watch operating margin instead. Pick one method and stay consistent, or month-to-month changes will be noise.
Do not put owner draws that never hit the books into the formula and then call the result net margin. If the household lives on that cash, the real leftover is smaller than the spreadsheet.
Common Mistakes
Dividing by cost when you meant margin – That gives markup.
Using the sticker price after you discounted the order – Margin follows the cash you actually collected.
Comparing a product’s gross margin with the company’s net margin – One ignores overhead. The other does not.
Ignoring fees that sit on the selling price – A 3% card fee on a $40 sale is $1.20. If cost is $25, profit is $13.80 and margin is 34.5%, not 37.5%.
Calling any leftover “profit margin” after only materials – Labor, freight, and waste still belong somewhere.
Assuming more volume repairs a negative margin – If price is below the costs that move with each unit, extra sales widen the hole.
Other Meanings of “Margin”
People use the same word for different math.
Contribution margin subtracts all variable costs, including variable selling costs, then uses what remains to cover fixed costs and profit. It is the figure behind break-even math.
Gross margin follows financial-statement COGS, which can include some fixed production costs in a manufacturing setting.
Margin loan is borrowed money in a brokerage account. That is a loan-to-value and maintenance-requirement problem, not a product-pricing percent.
If a search or a coworker says “what’s the margin,” ask which one. The formulas are not interchangeable.
What to Do After You Calculate It
Once you have a margin, decide what it is for.
For pricing, set the target as a true margin and solve for price with cost ÷ (1 − margin). Then test whether that price can sell.
For a catalog, rank items by margin and by dollars of profit. A high-margin item that rarely sells may contribute less than a mid-margin staple.
For the company, track gross and net margin each month next to dollar profit. If gross margin holds and net margin falls, look at overhead and financing. If gross margin falls, look at discounts, suppliers, waste, and mix.
Recalculate when costs or fees change. A margin you computed last spring is not current after a freight increase.
FAQs About How to Calculate Margin
Is margin the same as profit?
No. Profit is the dollar difference between price and cost (or between sales and expenses). Margin is that profit as a percent of the selling price or of revenue.
Can margin be negative?
Yes. If cost is higher than the selling price, profit is negative and so is margin. That can happen on a discounted order, a job that runs long, or a product whose fees were ignored.
How do I calculate margin in Excel?
If price is in A2 and cost is in B2, use =(A2-B2)/A2. Format the cell as a percentage, or multiply by 100. For a target price from cost and a 40% margin, use =B2/(1-0.4).
What is the difference between 25% margin and 25% markup?
A 25% margin means profit is a quarter of the selling price. A 25% markup means profit is a quarter of cost. On a $100 cost, 25% markup prices the item at $125 (20% margin). A true 25% margin on that $100 cost needs a $133.33 price.
Conclusion
To calculate margin, subtract cost from selling price, then divide by selling price. Use net sales and matching costs. Say whether the result is gross, operating, or net margin, because each one subtracts a different layer.
Keep markup off the same worksheet unless you label it. Markup divides by cost and will not match the margin percent. Once the formula is right, use it to set prices, compare products, and see which layer of cost is squeezing the business.
Disclaimer
This article is general educational information about calculating margin for US readers. It is not accounting, tax, legal, or financial advice. The right costs and the right type of margin depend on your business, accounting method, and purpose. Confirm figures with your records and a qualified professional before you change prices or report results.