Gross profit margin formula: how to calculate and improve it
Learn the gross profit margin formula, follow a worked example in ringgit and find ways to lift your margin.
Written by Lena Hanna—Trusted CPA Guidance on Accounting and Tax. Read Lena's full bio
Published Tuesday 6 October 2026
Table of contents
Key takeaways
- The gross profit margin formula is (revenue − cost of goods sold) ÷ revenue × 100. Count only direct production costs, and leave operating expenses like rent out of cost of goods sold.
- Track your margin monthly or quarterly. Regular checks help you catch rising costs early and measure the effect of price changes.
- Compare your margin with businesses in your own industry. Average gross margins for US-listed companies range widely, with software at about 72% and grocery retail at about 26%.
- Lift your margin by reviewing your prices and lowering your direct costs. Focus on changes that keep your quality and market position intact.
What is gross profit margin?
Gross profit margin is the percentage of sales revenue you keep after subtracting the direct costs of producing your goods or services. It shows how efficiently your business turns sales into profit before operating expenses.

Picture a café that sells a plate of nasi lemak for RM10, with ingredients and the cook's time costing RM3. The café keeps RM7 from that sale, which is a 70% gross profit margin on the dish.
Working out this figure across your whole business shows you where your money goes. The metric helps you:
- understand how much revenue you keep after covering direct costs
- identify your most profitable products or services
- check whether your prices cover the cost of what you sell
- spot costs that are eating into your margins
A healthy gross profit margin leaves room to cover operating expenses like rent and utilities. That room improves your chances of making a net profit.
Gross profit margin vs gross profit
Gross profit is a ringgit amount. Gross profit margin is a percentage.
Gross profit shows how many ringgit remain after you subtract cost of goods sold from revenue. Gross profit margin expresses that figure as a percentage of total revenue, so you can compare performance across periods or against other businesses.
You may also hear people say "gross margin" instead of gross profit margin. The two terms mean the same thing.
Components of the gross profit margin formula
The gross profit margin formula needs two figures: revenue and cost of goods sold. Here's what belongs in each one and where to find it.
What counts as revenue
Revenue is the total income from selling your products or services, before any deductions. Include:
- sales of products and fees for services you provide
- other income that comes directly from your core business activities
Leave out income from outside your core trading, such as interest, investment returns and one-off asset sales. Use your gross revenue figure rather than net revenue, which already has deductions applied.
What goes into COGS
Cost of goods sold (COGS) is the direct cost of producing what you sell. For a product-based business, it usually includes:
- raw materials and components
- direct labour, meaning wages for staff who make the product
- manufacturing supplies
- freight and shipping to bring materials in
Service businesses have direct costs too, though they look a little different. For a service-based business, COGS may include:
- direct labour and subcontractor costs for delivering the service
- materials used to provide the service
You may see this figure called cost of sales, especially in service businesses. The margin calculation works the same way.
Keep operating expenses like rent, utilities, marketing and admin salaries out of COGS. You subtract those later when calculating operating profit.
Gross profit margin formula and how to calculate it
The gross profit margin formula is (revenue − COGS) ÷ revenue × 100. It tells you what percentage of each sale you keep after paying the direct costs of making it.
You can write the formula two ways, and both give the same answer:
Gross profit margin = (gross profit ÷ revenue) × 100

Gross profit margin = ((revenue − COGS) ÷ revenue) × 100
Each part of the formula has a plain meaning. In the formula:
- revenue is your total sales for the period, before any deductions
- COGS is the direct cost of producing the goods or services you sold
- gross profit is revenue minus COGS, shown in ringgit
- multiplying by 100 turns the decimal result into a percentage
Five steps turn your records into a finished percentage. Work through them in order for the period you're measuring.
1. Find your total revenue
Add up all sales of products and services for the period, such as a month or a quarter. Use the gross figure, before any deductions.
2. Calculate your cost of goods sold
Total the direct costs of producing what you sold in that same period. Matching the period means your costs line up with the sales they produced.
3. Subtract COGS from revenue
Take your COGS away from your revenue. The result is your gross profit in ringgit.
4. Divide gross profit by revenue


Divide your gross profit by your total revenue. This gives you a decimal, such as 0.6.
5. Multiply by 100
Multiply the decimal by 100 to turn it into a percentage. That percentage is your gross profit margin.
Here's how the five steps work with real figures from a small business.
Worked example: calculating gross profit margin step by step
Say you run an office cleaning business and want to check last month's margin. You'll follow the same five steps in order.
First, add up your invoices for the month. Your cleaning contracts brought in RM20,000 in revenue.
Next, total your direct costs. Cleaning staff wages, supplies and subcontractor fees come to RM8,000.
Then subtract those costs from revenue: RM20,000 − RM8,000 = RM12,000. That RM12,000 is your gross profit.
Now divide gross profit by revenue: RM12,000 ÷ RM20,000 = 0.6. Finally, multiply by 100: 0.6 × 100 = 60%.
Your gross profit margin is 60%, so you keep 60 sen from every ringgit of sales after direct costs. That 60 sen goes towards rent, admin and other operating expenses, and whatever remains becomes profit.
The formula also shows you how a cost change moves your margin. Say supply prices rise the following month, and your direct costs climb to RM9,000 while revenue stays at RM20,000.
Your gross profit drops to RM11,000, and RM11,000 ÷ RM20,000 × 100 gives a margin of 55%. That 5 percentage point dip is your signal to review prices or supplier costs before it reaches your bottom line.
These results are only as reliable as the figures you put in. A few common slip-ups can skew them.
Common calculation mistakes to avoid
Accurate calculations depend on getting your inputs right. Watch for these common errors:
- Counting operating expenses such as rent, utilities or office supplies as COGS
- Using net revenue instead of gross revenue
- Leaving out wages for staff who make your goods or deliver your services
- Mixing up gross profit, a ringgit amount, with gross profit margin, a percentage
If you're unsure which costs belong in your calculation, learn how to estimate your COGS accurately.
What is a good gross profit margin?
A good gross profit margin depends on your industry, business size and market conditions. Each sector has its own cost structure, so no single number suits every business.
Whatever your sector, your margin has work to do. It needs to be high enough to cover:
- operating expenses such as rent, utilities and salaries
- taxes and regulatory costs
- debt repayments
- reinvestment in growth
The more room your margin leaves above COGS, the easier it is to pay these costs and turn a net profit. Industry averages give you a useful starting point for judging that room.
Industry benchmarks for gross profit margin
Average gross margins vary widely between sectors. NYU Stern professor Aswath Damodaran's Margins by Sector (US) data, updated January 2026, reports average gross margins of:
- about 72% for system and application software
- about 33% for general retail
- about 26% for grocery and food retail
- about 10% for auto and truck manufacturing
These figures are averages for US-listed companies, so Malaysian small-business margins may differ. The gaps reflect differences in production costs, pricing power and competition within each sector.
Factors that affect what's considered good
Your own benchmark shifts with your circumstances. What counts as a healthy margin depends on:
- your industry, because each sector has its own cost structure
- your location, because a city-centre shop in Kuala Lumpur faces different costs from a rural business
- your business model, because online and physical stores carry different direct costs such as delivery and packaging
- your competition, because price pressure in crowded markets like electronics retail can squeeze margins
How to benchmark your gross profit margin
Comparing your margin with similar businesses shows how you're performing. For the closest comparison:
- match your industry by looking at businesses that sell similar products or services
- consider business size, since a sole proprietor's margins differ from those of a company with 50 employees
- account for region, since local cost structures affect what's achievable
- compare like-for-like periods, such as full financial years
Your accountant or bookkeeper can help you find benchmarks for small businesses in your sector. They can also help you set a margin target.
When to reassess your gross profit margin
Your margin can shift quickly when your business or market changes. Review it when:
- costs are rising, as supplier price increases or wage growth can erode margins quickly
- you've missed growth targets, as a declining margin may explain flat profits
- you're changing prices, so you can see whether the change helps your margin
- you're launching new products, so you can compare them with your existing margin
- market conditions shift, as economic changes or new competitors may affect your pricing power
Accounting software makes this review quicker. Xero's financial reports help you track your margin over time and spot changes early.
Analysing your gross profit margin for business insights
Analysing your gross profit margin shows how profitable each part of your business is and where you can improve. With that insight, you can make informed decisions about pricing and cost management.
Regular analysis turns a single percentage into practical direction. Margin analysis helps you:
- identify your most and least profitable products or services
- spot cost increases before they erode your profits
- set prices that balance competitiveness with profitability
- compare performance across different time periods
What your percentage means
Your margin shows how much of each ringgit of sales remains after direct costs. Here's how common percentages compare with the sector averages above:
- A 20% margin keeps 20 sen per ringgit, below the grocery and food retail average of about 26%
- A 30% margin keeps 30 sen per ringgit, close to the general retail average of about 33%
- A 50% margin keeps 50 sen per ringgit, well above retail averages but below software
- A margin above 60% keeps more than 60 sen per ringgit, closer to the software average of about 72%
What matters most is whether your margin suits your industry. It also needs to cover your operating expenses and growth goals.
Tracking gross profit margin trends
Monitoring your margin over time reveals patterns in your business performance. Regular tracking helps you:
- spot seasonal swings, as margins can dip in slower months and rise in peak seasons
- catch rising costs early, since a falling margin often signals higher supplier prices
- measure the effect of pricing changes on profitability
- compare year-on-year performance to see whether your efficiency is improving
Review your margin monthly or quarterly to catch issues early.
External and internal influences on your margin
Some forces that move your margin sit outside your control. External factors include:
- falling demand, which may push you to lower prices
- rising material or labour costs that you can't pass on to customers
- economic conditions that reduce customer spending and your pricing power
- exchange rate movements that raise the cost of imported stock
Other factors are within your reach. Internal factors include:
- your pricing strategy, since underpricing erodes margins and overpricing may cut sales volume
- your operational efficiency, since waste adds to your COGS
- your product mix, since selling more low-margin items pulls down your overall margin
- your stock control, since spoilage and damaged stock add to your COGS
Gross profit margin compared with other metrics
Gross profit margin is one of several profitability metrics. Seeing how it relates to operating and net profit margin gives you a fuller picture of your financial health.
Each type of profit margin compares a different profit figure with the same revenue total. The further down your income statement you go, the more costs you subtract.
Gross profit margin vs operating profit margin
Operating profit margin goes further than gross profit margin by also subtracting operating expenses like rent, utilities and salaries. Here's how the two formulas compare:
- Gross profit margin divides revenue minus COGS by revenue
- Operating profit margin divides revenue minus COGS and operating expenses by revenue
Use operating profit margin to see how efficiently you're running the whole business, including production.
Gross profit margin vs net profit margin
Net profit margin is your bottom line. It shows what percentage of revenue remains after all expenses, including operating costs, interest and taxes.
The two margins answer different questions:
- Gross profit margin measures production efficiency
- Net profit margin measures overall business profitability
You can have a healthy gross profit margin but a low net profit margin if your operating expenses, debt or taxes are high.
How to use each metric
Together, these profitability ratios give you a clear view of your business finances. Each one suits a different decision:
- Use gross profit margin to evaluate pricing decisions and find your most profitable products or services
- Use operating profit margin alongside gross profit margin to assess overall efficiency and guide budgeting
- Use net profit margin for long-term planning, since a consistently high net margin makes you more resilient to economic changes
How to improve gross profit margin
If your gross profit margin is lower than you'd like, you can lift it by adjusting prices, lowering direct costs or running a tighter operation. Each approach below helps you increase profits from the sales you already make.
Review and adjust your pricing
Pricing directly affects your margin. Knowing your marginal cost, the cost of producing one more unit, helps you set a sensible price floor.
From there, you can fine-tune what you charge. Consider these approaches:
- Raise prices when your costs increase so your margin holds steady
- Add value through better quality or service to support premium pricing
- Monitor competitor pricing so you stay competitive without racing to the bottom
- Test small price changes and measure the effect on sales volume and margin
Reduce your cost of goods sold
Lowering your COGS lifts your gross profit margin straight away. Try these approaches:
- Negotiate with suppliers for bulk discounts or better payment terms
- Compare supplier pricing regularly to confirm your rates are competitive
- Reduce material waste and spoilage in production
- Order stock in line with demand to keep cash free and avoid markdowns
Streamline operations to reduce waste
Efficient operations cut costs while keeping quality high. Consider these improvements:
- Automate repetitive tasks such as data entry with accounting software
- Review your processes for bottlenecks that add time or cost
- Schedule staff to match demand so direct labour hours go to productive work
- Train your team so fewer costly mistakes happen
Stock is another place to look. Managing your inventory well keeps excess stock down, which lowers storage costs.
Track your gross profit margin with Xero
Your gross profit margin shows whether your prices and direct costs are working together. Knowing the formula is the first step, and tracking it regularly turns it into better pricing and cost decisions.
Xero's financial reports bring your sales and cost figures into one place. You can track your margin over time, compare periods and see which products or services drive profitability.
Sign up today and get one month free, so you can start measuring your margins with confidence.
FAQs on gross profit margin
These answers cover common questions about the gross profit margin formula and how to apply it.
Is gross margin the same as gross profit margin?
Yes. Both terms describe gross profit as a percentage of revenue, so you use the same formula whichever name appears on a report.
What's the difference between gross profit margin and markup?
Gross profit margin divides gross profit by the selling price, while markup divides it by cost. A product with a 50% markup has a 33% gross profit margin, and you can check other figures with Xero's markup calculator.
Can gross profit margin be negative?
Yes. A negative margin means your COGS is higher than your revenue, so you lose money on each sale before operating expenses.
Should I calculate gross profit margin before or after tax?
Calculate it before income tax, which is a below-the-line cost deducted later on the way to net profit. Income tax is worked out on your overall profit, so it doesn't change the gross margin you make on each sale.
How do I calculate gross profit margin for a single product?
Subtract the product's direct cost per unit from its selling price, divide by the selling price and multiply by 100. For example, a product selling for RM50 with RM30 in direct costs has a 40% margin.
How often should I calculate my gross profit margin?
Monthly or quarterly suits most small businesses. If your costs change often, checking monthly helps you adjust prices before a slipping margin eats into profit.
Disclaimer
Xero does not provide accounting, tax, business or legal advice. This guide has been provided for information purposes only. You should consult your own professional advisors for advice directly relating to your business or before taking action in relation to any of the content provided.