How to calculate margin
Learn the margin formula and see worked examples for gross, operating and net profit margin.
October 2023 | Published by Xero
Published Thursday 6 August 2026
Table of contents
Key takeaways
- Margin measures the percentage of revenue that remains as profit, calculated by dividing profit by revenue and multiplying by 100.
- Gross profit margin uses gross profit (revenue minus cost of goods sold), while net profit margin accounts for all operating expenses and taxes.
- Margin and markup are different calculations: margin is profit as a percentage of revenue, whereas markup is profit as a percentage of cost.
- A healthy margin varies by industry and margin type, so compare your figures against sector benchmarks rather than fixed targets.
What is margin?

How to calculate gross profit margin
Margin is profit divided by revenue, multiplied by 100, and expressed as a percentage. It shows how much of each dollar you earn actually stays in the business after covering costs.
There are several margin types, but the two most common are gross profit margin and net profit margin. Gross profit margin measures profit after subtracting the direct costs of producing goods or services, while net profit margin reflects what remains after all expenses, including operating costs and taxes.
How to calculate margin

How to calculate net profit margin
Calculating margin helps you measure profitability at a glance. Follow these steps to work out your margin percentage.
- Find your profit by subtracting costs from revenue.
- Divide profit by revenue.
- Multiply the result by 100 to convert it to a percentage.
For example, if your revenue is HK$20,000 and your costs total HK$15,000, your profit is HK$5,000. Dividing HK$5,000 by HK$20,000 gives 0.25, and multiplying by 100 produces a 25% margin.
How to calculate gross profit margin
Gross profit margin tells you how much revenue remains after covering the direct costs of producing your products or services. It's useful for understanding production efficiency before other overheads come into play.
The formula is: gross profit ÷ revenue × 100. Gross profit equals revenue minus cost of goods sold.
Using the same example, if revenue is HK$20,000 and cost of goods sold is HK$8,000, gross profit is HK$12,000. Dividing HK$12,000 by HK$20,000 and multiplying by 100 gives a gross profit margin of 60%.
How to calculate net profit margin
Net profit margin shows the percentage of revenue left after all expenses have been deducted, including operating costs, interest and taxes. It's the clearest indicator of overall profitability.
The formula is: net profit ÷ revenue × 100. Net profit equals gross profit minus all other operating expenses and taxes.
Continuing the example, gross profit is HK$12,000. Operating expenses are HK$3,000, and taxes and interest total HK$4,000, leaving a net profit of HK$5,000. Dividing HK$5,000 by HK$20,000 and multiplying by 100 gives a net profit margin of 25%.
Operating profit margin
Operating profit margin sits between gross and net margins. It measures how much revenue remains after covering both direct costs and day-to-day operating expenses, but before interest and taxes.
The formula is: operating profit ÷ revenue × 100. Operating profit equals gross profit minus operating expenses.
In the example, gross profit is HK$12,000 and operating expenses are HK$3,000, so operating profit is HK$9,000. Dividing HK$9,000 by HK$20,000 and multiplying by 100 gives an operating profit margin of 45%. For more detail on how each margin relates to overall performance, see the guide on profit margin.
Margin vs markup
Margin and markup both describe profit, but they use different bases for the calculation. Margin expresses profit as a percentage of the selling price (revenue), while markup expresses profit as a percentage of the cost price.
Consider a product you buy for HK$60 and sell for HK$100. The profit is HK$40. Margin is HK$40 ÷ HK$100 × 100 = 40%. Markup is HK$40 ÷ HK$60 × 100 = about 66.7%. The same profit figure produces a lower margin percentage and a higher markup percentage because the denominators differ.
What is a good margin?
A good margin depends on your industry and the type of margin you're measuring. What counts as healthy for a retailer may look weak for a consulting firm, and vice versa.
As a general guide, gross margins of roughly 25%–50% and net margins of roughly 5%–20% are common across many sectors. Service businesses tend to sit at the higher end because they carry fewer direct costs, while retail and manufacturing often sit lower due to higher cost of goods sold. Compare your figures against profitability ratios in your specific industry for a clearer picture.
How to improve your margin
Improving your margin means either increasing revenue, reducing costs, or both. Here are practical tactics to increase profits over time.
- Raise prices strategically where the market will support it.
- Reduce cost of goods sold by negotiating with suppliers or sourcing more efficiently.
- Cut operating expenses by reviewing subscriptions, utilities and overheads.
- Increase sales volume to spread fixed costs across more units.
Track your margins in real time with Xero
Monitoring margins regularly helps you spot trends before they become problems. Xero's reporting tools pull your revenue and expense data together so you can see gross, operating and net margins at a glance.
Ready to simplify your financial tracking? You can get one month free and see how real-time insights support smarter decisions.
FAQs on how to calculate margin
Below are answers to common questions about margin calculations.
What is the margin formula?
The basic margin formula is profit ÷ revenue × 100. The result is a percentage showing how much of each dollar earned converts into profit.
What's the difference between margin and markup?
Margin uses the selling price as its base, while markup uses the cost price. For the same profit amount, margin will always be a smaller percentage than markup.
Is gross margin the same as gross profit?
No. Gross profit is a dollar figure (revenue minus cost of goods sold), whereas gross margin is that figure expressed as a percentage of revenue.
What is a good profit margin?
It varies widely. A net margin of 10% might be excellent in retail but modest in software. Always compare against industry averages rather than a single universal benchmark.
Should I use gross or net margin?
Use gross margin to assess production efficiency and pricing power. Use net margin to understand overall profitability after all expenses.
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.