Get 80% off your plan for your first 3 months*

How to calculate margin

Learn how to calculate margin to measure profitability and set prices that keep your business sustainable.

October 2023 | Published by Xero

Published Wednesday 12 August 2026

Table of contents

Key takeaways

  • Margin shows what percentage of your revenue remains as profit after costs, helping you understand whether your pricing covers expenses and supports growth.
  • Gross, operating and net profit margins each measure profitability at different stages, from production costs through to all business expenses and taxes.
  • Margin and markup are related but different: margin is profit as a percentage of selling price, while markup is profit as a percentage of cost.
  • No single margin is universally good; compare your margins to similar businesses in your industry and use them to guide pricing and cost decisions.

What is margin?

Gross profit margin formula shows gross profit divided by sales revenue, times 100, equals gross profit margin.

How to calculate gross profit margin

Margin is the percentage of revenue that remains as profit after you subtract costs. It tells you how much of each rand you earn actually stays in your business.

Margin = (profit ÷ revenue) × 100

Margin is always shown as a percentage.

Formula for net profit margin shows that net profit divided by revenue, times 100, equals net profit margin.

How to calculate net profit margin

How to calculate margin

You can calculate margin at different levels depending on which costs you include. The three main types are gross profit margin, operating profit margin and net profit margin.

Gross profit margin

Gross profit is your revenue minus cost of goods sold (COGS). This margin shows how much you keep after covering direct production or purchase costs.

Example: Your business earns R100,000 in revenue and has COGS of R60,000. Gross profit = R100,000 − R60,000 = R40,000. Gross profit margin = 40,000 ÷ 100,000 × 100 = 40%.

To skip the maths, you can also work this out with Xero's gross margin calculator.

Operating profit margin

Operating profit is gross profit minus operating expenses such as rent, salaries and utilities, before interest and tax. It measures profitability from core business operations.

Continuing the example: operating expenses are R20,000. Operating profit = R40,000 − R20,000 = R20,000. Operating profit margin = 20,000 ÷ 100,000 × 100 = 20%.

Net profit margin

Net profit is revenue minus all costs, including operating expenses, interest and taxes. This is the final profit your business keeps.

Continuing the example: tax is R5,000. Net profit = R20,000 − R5,000 = R15,000. Net profit margin = 15,000 ÷ 100,000 × 100 = 15%. You will find each of these figures on your profit and loss statement.

Margin vs markup

Both margin and markup measure profit, but they use different bases. Margin expresses profit as a percentage of the selling price, while markup expresses profit as a percentage of the cost price.

Example: You buy a product for R60 and sell it for R100, making R40 profit. Margin = 40 ÷ 100 = 40%. Markup = 40 ÷ 60 = 67%. The same rand profit gives different percentages depending on which base you use.

How to work out selling price and cost price from a margin

If you know your target margin and cost, you can calculate the selling price. If you know your margin and selling price, you can work backwards to find the cost.

Selling price = cost ÷ (1 − margin). For a 40% margin on a R60 cost: selling price = 60 ÷ 0.6 = R100.

Cost price = selling price × (1 − margin). For a 40% margin on R100 selling price: cost = 100 × 0.6 = R60.

What is a good margin?

There is no single good margin because profitability depends on your industry, business size and operating model. Service businesses often have higher margins than retailers, and larger businesses may operate on thinner margins due to volume.

According to Bureau of Market Research analysis of Statistics South Africa data, the average after-tax profit margin across all South African businesses in 2024 was 1.3%, with manufacturing at 1.5% and trade at 1.0%. Compare your margins against similar-sized businesses in your industry rather than general averages.

Why your margin matters and how to improve it

Understanding your margin helps you set prices that cover costs, stay competitive and leave room for reinvestment. Without healthy margins, your business may struggle to grow or handle unexpected expenses, so getting your pricing right is central to managing your finances and cash flow.

Ways to improve your margin:

  • Raise prices strategically where customers see value
  • Reduce cost of goods sold through better supplier terms or efficiency
  • Cut operating waste and unnecessary overheads
  • Focus on higher-margin products or services

Track your margins with Xero

Xero's reporting tools show your gross, operating and net profit margins in real time, so you can spot trends and act quickly. Profit and loss reports update automatically as transactions flow in, giving you a clear view of where your money goes. Start tracking your margins today and get one month free.

FAQs on calculating margin

Below are common questions about calculating and interpreting margins.

What is a good profit margin?

A good margin varies by industry and business model. Compare your margins to competitors of similar size rather than relying on a universal benchmark.

What is the difference between margin and markup?

Margin is profit divided by selling price, while markup is profit divided by cost price. They measure the same profit against different bases, so the percentages differ.

What does a 40% margin mean?

A 40% margin means 40% of your selling price is profit and 60% covers costs. On a R100 sale, R40 is profit.

Is margin the same as profit?

No. Profit is the rand amount you keep after costs, while margin is profit expressed as a percentage of revenue or selling price.

Learn more about margin

Handy resources

Advisor directory

You can search for experts in our advisor directory

Find an advisor

Explore our guides

Find guides with expert advice and tools to help manage and grow your business

Browse all guides

Financial reporting

Keep track of your performance with accounting reports

Find out more

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.