How to calculate margin
Learn how to calculate margin, with the formula, worked examples, and how it differs from markup.
October 2023 | Published by Xero
Published Monday 17 August 2026
Table of contents
Key takeaways
- Margin is profit expressed as a percentage of revenue, calculated using the formula: profit ÷ revenue × 100.
- The two main types are gross profit margin (revenue minus cost of goods sold) and net profit margin (revenue minus all expenses).
- Margin and markup are different: margin is profit as a percentage of selling price, while markup is profit as a percentage of cost.
- A good profit margin depends on your industry, with benchmarks ranging from around 2–5% in retail to 15–30% in professional services.
What is margin?

How to calculate gross profit margin
Understanding your margin helps you see how much profit you keep from each sale. It's one of the most important figures for tracking business performance.
Margin is profit shown as a percentage of revenue. You calculate it using the formula: profit ÷ revenue × 100. The two main types are gross profit margin and net profit margin, which measure different levels of profitability.
How to calculate margin

How to calculate net profit margin
Working out your margin takes just a few steps. Once you know the formula, you can apply it to any product or your business overall.
- Work out your profit by subtracting your costs from your revenue.
- Divide your profit by your revenue.
- Multiply the result by 100 to get your margin percentage.
For example, if your revenue is €100 and your costs are €60, your profit is €40. Divide €40 by €100 to get 0.4, then multiply by 100. Your margin is 40%. You can also use Xero's margin calculator to work this out instantly.
Gross profit margin
Gross profit margin tells you how efficiently you produce or source your products. It's useful for understanding the profitability of your core business activities before other expenses.
Gross profit margin is the percentage of revenue left after subtracting the cost of goods sold (COGS). The formula is: (gross profit ÷ revenue) × 100, where gross profit equals revenue minus COGS.
For example, if your revenue is €500 and your COGS is €300, your gross profit is €200. Divide €200 by €500 to get 0.4, then multiply by 100. Your gross profit margin is 40%.
Net profit margin
Net profit margin gives you the full picture of your profitability. It accounts for every cost involved in running your business.
Net profit margin is the percentage of revenue left after all expenses, including operating expenses, interest and taxes. Net profit can be quoted before or after tax depending on the context. The formula is: (net profit ÷ revenue) × 100.
For example, if your revenue is €500 and your total expenses (COGS, operating costs, interest and taxes) are €450, your net profit is €50. Divide €50 by €500 to get 0.1, then multiply by 100. Your net profit margin is 10%. For more detail on tracking your bottom line, see how to measure profitability.
Margin vs markup
Margin and markup are related but not the same. Mixing them up can lead to pricing errors that hurt your profits.
Margin is profit as a percentage of the selling price. Markup is profit as a percentage of the cost. Using the same numbers shows the difference clearly.
For example, if a product costs €60 and sells for €100, the profit is €40. The margin is €40 ÷ €100 × 100 = 40%. The markup is €40 ÷ €60 × 100 = 66.7%. Same profit, different percentages.
What is a good profit margin?
There's no single answer to what counts as a good profit margin. It depends on your industry and business model.
Benchmarks vary widely by sector, from around 2–5% in retail to 15–30% in professional services, according to Xero's guide to profit margin. Compare your margins to similar businesses in your sector to see where you stand.
Calculate your margins with Xero
Xero's reporting tools help small businesses track margins in real time. You can view profit and loss reports, monitor gross and net margins, and spot trends as they happen. Start seeing your numbers clearly when you get one month free.
FAQs on margin
Here are answers to common questions about calculating and understanding margin.
What is the margin formula?
The margin formula is profit ÷ revenue × 100. This gives you the percentage of each euro of revenue that remains as profit after costs.
Is margin the same as profit?
No, margin and profit are different. Profit is an absolute amount in euros, while margin expresses that profit as a percentage of revenue.
What is a good margin percentage?
A good margin varies by industry. Retailers might aim for 2–5%, while service businesses often target 15–30% or higher.
How do I convert markup to margin?
To convert markup to margin, divide the markup percentage by (100 + markup percentage), then multiply by 100. For example, a 50% markup converts to a 33.3% margin.
Related terms
Learn more about margin
Handy resources
Advisor directory
You can search for experts in our advisor directory
Explore our guides
Find guides with expert advice and tools to help manage and grow your business
Financial reporting
Keep track of your performance with accounting reports
Disclaimer
This glossary is for small business owners. The definitions are written with their requirements in mind. More detailed definitions can be found in accounting textbooks or from an accounting professional. Xero does not provide accounting, tax, business or legal advice.