How to calculate margin
Learn the formulas for gross, operating, and net profit margin with worked examples.
October 2023 | Published by Xero
Published Thursday 23 July 2026
Table of contents
Key takeaways
- Profit margin measures how much of your revenue you keep as profit, expressed as a percentage. The 3 main types are gross, operating, and net profit margin.
- To calculate gross profit margin, subtract your cost of goods sold (COGS) from revenue, divide by revenue, and multiply by 100. Net profit margin uses the same formula but subtracts all expenses, not just COGS.
- Margin and markup are different calculations. Margin is based on revenue, while markup is based on cost. Confusing the 2 can lead to pricing mistakes that cut into your profits.
- Tracking your margins regularly helps you spot trends, set smarter prices, and make confident decisions about where to cut costs or invest in growth.
What is margin?

How to calculate gross profit margin
Margin, also called profit margin, is the percentage of your revenue that turns into profit after expenses. It's one of the most important numbers for understanding how well your business is really doing.
Here's the basic idea: you sell a product or service for a certain price, and it costs you money to deliver it. The difference between what you earn and what you spend is your profit. Margin takes that profit and expresses it as a percentage of your revenue, so you can compare performance over time or across different parts of your business.
For small business owners, keeping a close eye on margins helps you answer critical questions. Are your prices high enough to cover costs and leave room for growth? Which products or services are most profitable? Where are you spending too much? Without tracking margins, you're making financial decisions without the full picture.

How to calculate net profit margin
Types of profit margins
There are 3 main types of profit margins, and each one tells you something different about your business's financial health. Together, they give you a complete view of where your money goes.
Gross profit margin
Gross profit margin shows how much revenue is left after you subtract the direct costs of producing your goods or services, known as cost of goods sold (COGS). This includes materials, labor directly tied to production, and manufacturing costs.
A healthy gross margin means you're charging enough to cover production costs with room to spare. If your gross profit margin is low, you'll find it harder to pay for other expenses like rent and utilities, which reduces your chances of making a net profit.
Understanding your margins is especially important in a challenging economy. According to Xero Small Business Insights, US small business sales growth averaged just 2.4% year-over-year in 2025, less than half the long-term average of 5.5%. With slower revenue growth, maintaining healthy margins becomes even more critical for covering operating costs.
Operating profit margin
Operating profit margin takes things a step further. It measures what's left after you subtract both COGS and your operating expenses, such as rent, salaries, insurance, and marketing costs.
This metric shows how efficiently your day-to-day business runs, separate from taxes, interest payments, or one-off costs. A strong operating margin means your core operations are profitable, regardless of how your business is financed or taxed.
Net profit margin
Net profit margin is the bottom line. It shows what percentage of your revenue is actual profit after all expenses are deducted, including COGS, operating costs, interest, and taxes.
This number shows how efficient your business is at turning income into profit. This efficiency matters more than ever: Xero Small Business Insights data shows that while the US economy grew at 5.1% in 2025, small businesses saw only 2.4% sales growth, highlighting a gap between Main Street and Wall Street that makes tracking net profitability essential.
How to calculate margin
Calculating margin is straightforward once you know the formula. Below are step-by-step instructions and worked examples for each type of profit margin. You can also use the Xero margin calculator to run these numbers quickly.
Gross profit margin formula and example
The formula for gross profit margin is:
Gross profit margin = ((Revenue - COGS) / Revenue) x 100
Here's how to calculate it step by step:
- Find your total revenue for the period. Say your bakery earned $50,000 in monthly sales.
- Calculate your COGS. Your ingredients, packaging, and direct labor cost $20,000.
- Subtract COGS from revenue: $50,000 - $20,000 = $30,000 (this is your gross profit).
- Divide gross profit by revenue: $30,000 / $50,000 = 0.6.
- Multiply by 100 to get your percentage: 0.6 x 100 = 60%.
In this example, your gross profit margin is 60%. That means for every dollar of revenue, you keep $0.60 after covering direct production costs.
Net profit margin formula and example
The formula for net profit margin is:
Net profit margin = (Net profit / Revenue) x 100
Using the same bakery example:
- Start with your revenue: $50,000.
- Add up all expenses, including COGS ($20,000), rent ($5,000), salaries ($10,000), marketing ($2,000), insurance ($1,000), interest ($500), and taxes ($2,500). Total expenses: $41,000.
- Subtract total expenses from revenue: $50,000 - $41,000 = $9,000 (this is your net profit).
- Divide net profit by revenue: $9,000 / $50,000 = 0.18.
- Multiply by 100: 0.18 x 100 = 18%.
Your net profit margin is 18%. After paying every bill and tax, you keep $0.18 of each revenue dollar as profit.
Operating profit margin formula and example
The formula for operating profit margin is:
Operating profit margin = (Operating profit / Revenue) x 100
Continuing with the bakery:
- Start with your revenue: $50,000.
- Subtract COGS ($20,000) and operating expenses like rent ($5,000), salaries ($10,000), marketing ($2,000), and insurance ($1,000). Total: $38,000.
- Calculate operating profit: $50,000 - $38,000 = $12,000.
- Divide by revenue: $12,000 / $50,000 = 0.24.
- Multiply by 100: 0.24 x 100 = 24%.
Your operating profit margin is 24%. This tells you that your core business operations are profitable before interest and taxes come into play.
Margin vs. markup
Margin and markup are related but they're not the same thing. Confusing the 2 is one of the most common pricing mistakes small businesses make.
Here's the difference:
- Margin is the percentage of your selling price that's profit. It's calculated from revenue.
- Markup is the percentage you add on top of your cost to set your selling price. It's calculated from cost.
Let's say you buy a product for $40 and sell it for $100.
- Your margin is 60%: ($100 - $40) / $100 x 100 = 60%.
- Your markup is 150%: ($100 - $40) / $40 x 100 = 150%.
Notice how the same transaction gives you very different percentages depending on which formula you use. If you set a "60% markup" thinking it's the same as a "60% margin," you'd price the product at only $64 instead of $100, leaving $36 on the table.
As a rule of thumb, margin is always a smaller number than markup for the same transaction. When setting prices, be clear about which formula you're using to avoid underpricing your products or services.
What is a good profit margin?
A "good" profit margin depends on your industry, business model, and stage of growth. What's healthy for a software company won't be the same as what's expected for a restaurant or retail store.
Here are some general benchmarks for net profit margins by industry:
- Professional services (consulting, accounting): 15-25%
- Software and technology: 15-30%
- Retail: 3-5%
- Restaurants and food service: 3-9%
- Construction: 5-10%
- Manufacturing: 5-10%
Rather than chasing a specific number, focus on tracking your own margins over time. Are they trending up or down? How do they compare to last quarter or last year? Consistent improvement matters more than hitting an industry average.
If your margins are thin, that doesn't necessarily mean something is wrong. Some industries naturally run on lower margins but make up for it with higher volume. The key is understanding what's normal for your business and taking action when margins start to slip.
How to improve your profit margin
Improving your margins comes down to 2 levers: increasing revenue or reducing costs. Learning to measure profitability accurately is the starting point for both. Here are practical strategies that work for small businesses.
Review your pricing. Many small business owners underprice their products or services. If your costs have gone up but your prices haven't, your margins are shrinking. Research what competitors charge and consider whether a price increase is overdue.
Reduce your cost of goods sold. Negotiate better rates with suppliers, buy in bulk where it makes sense, or find alternative suppliers. Even small reductions in COGS can have a big impact on gross margin.
Cut unnecessary operating expenses. Review your subscriptions, software tools, and recurring costs. Cancel anything you're not actively using. Look for more cost-effective alternatives for services like insurance or utilities.
Automate repetitive tasks. Manual bookkeeping, invoice chasing, and data entry eat into your time and your bottom line. Accounting software like Xero can automate bank reconciliation, send invoice reminders, and give you real-time visibility into your finances, so you spend less time on admin and more time growing your business.
Focus on your most profitable products or services. Not everything you sell generates the same margin. Identify your highest-margin offerings and find ways to sell more of them, whether through upselling, bundling, or targeted marketing.
Simplify your margin tracking with Xero
Knowing how to calculate margin is the first step. Tracking it consistently is what helps you make smarter business decisions. With the right tools, you don't have to crunch numbers manually or dig through spreadsheets to understand your profitability.
Xero's accounting software gives you real-time financial reports, so you can check your margins any time and spot trends before they become problems. From automated bank feeds to customizable profit and loss reports, Xero helps you stay on top of the numbers that matter most. Get one month free.
FAQs on calculating margin
Here are some frequently asked questions about calculating margin.
How do you calculate gross profit margin?
Subtract your cost of goods sold from your total revenue, divide the result by revenue, and multiply by 100. For example, if you earn $100,000 in revenue and your COGS is $60,000, your gross profit margin is 40%.
What is the difference between margin and markup?
Margin is calculated as a percentage of your selling price, while markup is calculated as a percentage of your cost. The same transaction will always show a lower margin percentage than markup percentage.
What is a good profit margin for a small business?
It varies by industry. Net profit margins of 5-10% are common for retail and food service, while professional services and tech businesses often see 15-25%. Track your own margins over time rather than focusing only on industry averages.
Can you have a negative profit margin?
Yes. A negative profit margin means your costs exceed your revenue, so your business is operating at a loss. This can happen during early growth stages or periods of heavy investment, but it's not sustainable long term.
How often should you calculate your profit margin?
Review your margins at least monthly. More frequent tracking helps you catch problems early and respond quickly to changes in costs or revenue. Accounting software like Xero can automate this by generating real-time profit and loss reports.
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.