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

How to calculate margin

Learn how to calculate margin, tell gross from net profit margin, and work out both with simple formulas.

October 2023 | Published by Xero

Published Thursday 23 July 2026

Table of contents

Key takeaways

  • Margin is your profit divided by your revenue, times 100, shown as a percentage.
  • Gross profit margin looks at revenue minus the cost of goods sold, while net profit margin factors in all your other expenses and taxes too.
  • Margin and markup aren't the same thing: margin is a share of your selling price, markup is a share of your cost.
  • A good margin varies by industry and business stage, so the most useful comparison is against your own past results and similar businesses.

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 your profit divided by your revenue, times 100, expressed as a percentage. It tells you how many cents of every dollar you keep as profit after costs.

There are two main types of margin small business owners track. Each one answers a slightly different question about your profitability:

  • Gross profit margin: profit left after the cost of goods sold
  • Net profit margin: profit left after all expenses and taxes
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 gross profit margin

Gross profit margin shows how much you keep from each sale after covering the cost of goods sold. Gross profit is your revenue minus the cost of goods sold, and the margin turns that figure into a percentage.

Here's the formula in plain text:

Gross profit margin = (revenue − cost of goods sold) / revenue x 100

Say a small business earns $200,000 in revenue and spends $120,000 on the cost of goods sold. That leaves $80,000 in gross profit. Divide $80,000 by $200,000 and multiply by 100, and you get a 40% gross profit margin.

How to calculate net profit margin

Net profit margin shows how much you keep once every cost is accounted for, not just the cost of goods sold. Net profit is your revenue minus all expenses and taxes, so it's a fuller picture of what the business actually makes.

Here's the formula in plain text:

Net profit margin = net profit / revenue x 100, where net profit is revenue minus all expenses and taxes

Take the same business with $80,000 in gross profit. Subtract $50,000 in other operating expenses and $8,000 in tax, and you're left with $22,000 in net profit. Divide $22,000 by $200,000 and multiply by 100, and you get an 11% net profit margin.

Margin vs markup

Margin and markup use the same numbers, but they measure different things, so it's easy to mix them up. Margin is your profit as a percentage of the selling price, while markup is your profit as a percentage of the cost.

That difference changes the percentage you get from the same sale, so it pays to know which one you're using. For a fuller breakdown, read the Xero glossary entry on the difference between margin and markup.

What is a good profit margin?

There's no single number that counts as a good profit margin, because it depends on your industry and your stage of growth. A healthy margin for a service business can look very different from one in retail or hospitality.

The most useful comparison is against your own past periods and against similar businesses in your field. Tracking your margin over time shows whether your profitability is improving, holding steady, or slipping.

How to improve your profit margin

Improving your margin comes down to earning more from each sale or spending less to make it. A few practical levers can move the number in the right direction.

  • Review your pricing to make sure it reflects the value you deliver
  • Reduce the cost of goods sold by negotiating with suppliers or cutting waste
  • Trim overheads that don't add value to the business
  • Focus on higher-margin products or services

Keep track of your margins with Xero

Keeping an eye on your margins is far easier when your revenue and costs sit in one place. Xero accounting software brings your income and expenses together, so you can see how each sale contributes to your profit.

With clear reports and real-time figures, you can spot when a margin is slipping and act before it affects your cash flow. Try Xero accounting software today and get one month free.

FAQs on calculating margin

Here are answers to some frequently asked questions about calculating margin.

What is the margin formula?

The margin formula is profit divided by revenue, times 100. The result is a percentage that shows how much of each dollar of revenue you keep as profit.

What is the difference between gross and net profit margin?

Gross profit margin only subtracts the cost of goods sold from revenue. Net profit margin goes further and subtracts every expense and tax, so it lands on a lower percentage.

Is margin the same as markup?

No, they measure profit against different figures. Margin is a percentage of your selling price, while markup is a percentage of your cost.

What is a good profit margin?

It depends on your industry and how established your business is, so there's no universal figure. Comparing your margin to your own past results and to similar businesses gives you the clearest read.

Learn more about calculating 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.