You have revenue numbers. You have expense numbers. You need to turn them into a margin percentage — and you need to use the right formula, because there are three of them, each measuring something different.
This is the reference guide you bookmark. Every profit margin formula — gross, operating, and net — with the exact math, worked examples across three business types, Excel cell formulas, and a conversion table showing the relationship between margin and markup. No theory essays. No filler paragraphs about why profit matters. Just the formulas, the math, and the context to use them correctly.
We build financial calculators for a living — including a free profit margin calculator that runs all three formulas instantly — so accuracy in these formulas is not negotiable. Every calculation below has been verified against standard accounting methodology.
The Three Profit Margin Formulas at a Glance
Profit margin is the percentage of revenue retained as profit after subtracting costs. The three formulas differ only in which costs are subtracted. Here is the complete reference:
| Formula | Calculation | What It Measures |
|---|---|---|
| Gross Profit Margin | (Revenue − COGS) ÷ Revenue × 100 | Profitability after direct production costs |
| Operating Profit Margin | (Revenue − COGS − Operating Expenses) ÷ Revenue × 100 | Profitability after all operating costs |
| Net Profit Margin | Net Income ÷ Revenue × 100 | Profitability after ALL costs including taxes and interest |
Each formula builds on the one before it. Gross margin starts with your broadest profit. Operating margin narrows it by adding overhead. Net margin narrows it again by adding taxes and debt. The number gets smaller at each level — and the final number is the one that actually reaches your bank account.
The formula most people mean when they say “profit margin” without specifying: Net profit margin. When your accountant, your bank, or an investor asks about your margin, they almost always mean net. When you are analyzing your own product pricing, gross margin is more useful. When you are evaluating operational efficiency, operating margin is the right lens.
Gross Profit Margin Formula (Step by Step)
Gross Profit Margin = ((Revenue − Cost of Goods Sold) ÷ Revenue) × 100
Gross margin answers one question: how much money is left after paying for the thing you sell? Nothing else is subtracted yet — not rent, not salaries, not marketing, not taxes.
What counts as COGS
- Raw materials and components
- Direct manufacturing labor (workers who physically make the product)
- Packaging and shipping to your warehouse
- For service businesses: direct labor cost of delivering the service (subcontractors, billable employee time)
What does NOT count as COGS
- Rent and utilities
- Marketing and advertising
- Administrative salaries
- Software subscriptions
- Insurance, taxes, loan interest
Getting this classification wrong is the most common formula error. If you accidentally include rent in COGS, your gross margin looks lower than it actually is, and you might underprice your products to compensate.
Worked Example — Product Business (Coffee Roaster)
| Line Item | Amount |
|---|---|
| Monthly revenue | $45,000 |
| Green coffee beans | $13,500 |
| Roasting labor (direct) | $4,500 |
| Packaging materials | $2,250 |
| Shipping to warehouse | $750 |
| Total COGS | $21,000 |
Gross Profit = $45,000 − $21,000 = $24,000
Gross Profit Margin = ($24,000 ÷ $45,000) × 100 = 53.3%
Worked Example — Service Business (Web Design Agency)
| Line Item | Amount |
|---|---|
| Monthly revenue | $30,000 |
| Freelance developers (direct project cost) | $9,000 |
| Stock photography licenses | $300 |
| Total COGS | $9,300 |
Gross Profit Margin = (($30,000 − $9,300) ÷ $30,000) × 100 = 69.0%
Worked Example — E-Commerce Store
| Line Item | Amount |
|---|---|
| Monthly revenue | $80,000 |
| Wholesale product cost | $36,000 |
| Fulfillment and shipping | $8,000 |
| Marketplace fees (percentage-based) | $4,000 |
| Total COGS | $48,000 |
Gross Profit Margin = (($80,000 − $48,000) ÷ $80,000) × 100 = 40.0%
Notice how the marketplace fees are included in COGS because they are a direct, per-sale cost. Platform fees like Shopify’s monthly subscription, however, would go under operating expenses since they are fixed regardless of sales volume.
Operating Profit Margin Formula (Step by Step)
Operating Profit Margin = ((Revenue − COGS − Operating Expenses) ÷ Revenue) × 100
Operating margin reveals the efficiency of your actual business operations. Think of it this way: gross margin tells you if your product is priced right. Operating margin tells you if the business around that product is run efficiently.
What counts as operating expenses:
- Rent and utilities
- Salaries and wages (non-production staff: admin, management, marketing team)
- Marketing and advertising spend
- Software and tools (CRM, accounting, project management)
- Insurance premiums
- Office supplies and equipment
- Depreciation of business assets
Worked Example — Coffee Roaster Continued:
Revenue: $45,000. COGS: $21,000 (from above).
| Operating Expense | Amount |
|---|---|
| Rent (roastery + retail space) | $4,500 |
| Non-production salaries | $6,000 |
| Marketing (social media ads, local events) | $1,800 |
| Software (POS, accounting, email) | $450 |
| Insurance | $600 |
| Equipment depreciation | $750 |
| Total Operating Expenses | $14,100 |
Operating Profit = $45,000 − $21,000 − $14,100 = $9,900
Operating Profit Margin = ($9,900 ÷ $45,000) × 100 = 22.0%
The gross margin was 53.3%. After operating costs, it dropped to 22.0%. That 31.3-point gap is pure overhead. If the coffee roaster wants to improve profitability, this gap is where to look — not at the price of green beans.
Here is where most people miss the signal: if your gross margin is strong but your operating margin is weak, the problem is overhead, not pricing. Too many business owners respond to low overall profitability by raising prices or cutting product quality when the real fix is trimming operating expenses. The formula makes the diagnosis clear.
Net Profit Margin Formula (Step by Step)
Net Profit Margin = (Net Income ÷ Revenue) × 100
Where Net Income = Revenue − COGS − Operating Expenses − Taxes − Interest − One-Time Charges
Net margin is the bottom line. It is the percentage of every revenue dollar that the business owner actually gets to keep, reinvest, or distribute. No other margin formula gives you this number.
Worked Example — Coffee Roaster Continued:
Revenue: $45,000. COGS: $21,000. Operating Expenses: $14,100.
| Additional Expense | Amount |
|---|---|
| Estimated taxes | $2,200 |
| Loan interest | $400 |
| Total Additional | $2,600 |
Net Income = $45,000 − $21,000 − $14,100 − $2,600 = $7,300
Net Profit Margin = ($7,300 ÷ $45,000) × 100 = 16.2%
The complete margin journey for this coffee roaster:
| Margin Level | Amount | Percentage | What Was Subtracted |
|---|---|---|---|
| Revenue | $45,000 | 100% | — |
| Gross Profit | $24,000 | 53.3% | COGS ($21,000) |
| Operating Profit | $9,900 | 22.0% | Operating expenses ($14,100) |
| Net Profit | $7,300 | 16.2% | Taxes + interest ($2,600) |
This single table is the most useful financial snapshot any business owner can produce. It shows exactly where every dollar goes. The coffee roaster generates $45,000 in revenue, spends $21,000 making the product, $14,100 running the business, and $2,600 on taxes and debt — keeping $7,300.
Profit Margin Formula in Excel (Copy-Paste Ready)
Set up your spreadsheet with these cells:
| Cell | Label | Example Value |
|---|---|---|
| B1 | Revenue | 45000 |
| B2 | COGS | 21000 |
| B3 | Operating Expenses | 14100 |
| B4 | Taxes | 2200 |
| B5 | Interest | 400 |
Excel formulas:
| Margin | Excel Formula | Result |
|---|---|---|
| Gross Profit Margin | =(B1-B2)/B1*100 | 53.3% |
| Operating Profit Margin | =(B1-B2-B3)/B1*100 | 22.0% |
| Net Profit Margin | =(B1-B2-B3-B4-B5)/B1*100 | 16.2% |
Format the result cells as percentages (Home → Number → Percentage with 1 decimal). Drag the formulas down columns to calculate margins for multiple months side by side.
Pro tip: Create a separate tab for each month. In a summary tab, use formulas like =January!B6 to pull each month’s net margin into a single trend row. Then insert a line chart from that row to visualize your margin trend over 12 months. This takes 10 minutes to build and pays for itself the first time you catch a margin decline before it becomes a crisis.
Or skip the spreadsheet entirely and use our free profit margin calculator — enter your numbers and get all three margins instantly with a visual breakdown.
Profit Margin vs Markup: The Formula People Confuse
These two formulas look similar but use different denominators, which produces different percentages for the exact same transaction. Confusing them is the most expensive arithmetic mistake in business.
Profit Margin = Profit ÷ Revenue × 100 (denominator is selling price)
Markup = Profit ÷ Cost × 100 (denominator is cost)
A product costs $40 and sells for $60. Profit is $20.
- Margin: $20 ÷ $60 × 100 = 33.3%
- Markup: $20 ÷ $40 × 100 = 50.0%
Same product. Same profit. But the percentage is 33.3% or 50% depending on which formula you use.
Quick conversion reference:
| Markup % | Equivalent Margin % |
|---|---|
| 25% | 20.0% |
| 33.3% | 25.0% |
| 50% | 33.3% |
| 66.7% | 40.0% |
| 100% | 50.0% |
| 150% | 60.0% |
| 200% | 66.7% |
The rule to remember: Markup is always the bigger number. If someone tells you they have “50% margins,” that sounds great. If they actually mean 50% markup, the real margin is only 33.3%. Our markup vs margin calculator shows both numbers simultaneously so this mistake becomes impossible.
When to Use Each Formula
Not every situation calls for the same formula. Using the wrong one wastes time and produces misleading conclusions.
Use gross profit margin when:
- Setting or evaluating product pricing
- Comparing costs across suppliers or manufacturing methods
- Analyzing whether a specific product or service is worth selling
- Evaluating the impact of a price increase or discount on product-level profitability
Use operating profit margin when:
- Evaluating how efficiently the business runs day-to-day
- Comparing your operational efficiency to competitors
- Deciding whether to cut overhead or invest in growth
- Analyzing the impact of hiring decisions, office moves, or marketing budget changes
Use net profit margin when:
- Reporting overall business profitability to investors or lenders
- Preparing financial statements and tax planning
- Deciding how much the owner can take as compensation or distributions
- Comparing your business’s overall financial health year over year
Use all three together when:
- Diagnosing why the business feels less profitable than expected
- Building a financial plan or budget for the next year
- Preparing for a loan application (lenders want all three)
- Presenting to investors (they will ask about gross, operating, and net)
The complete picture only appears when you calculate all three and compare the gaps between them. A 60% gross margin that becomes a 5% net margin tells a completely different story than a 60% gross margin that becomes a 25% net margin. The formulas are identical. The insight comes from reading them together.
Frequently Asked Questions
Q: What is the profit margin formula?
A: The most common formula is: Net Profit Margin = (Net Income ÷ Revenue) × 100. There are three versions: gross margin subtracts only COGS, operating margin subtracts COGS plus operating expenses, and net margin subtracts all costs including taxes and interest. Each answers a different profitability question.
Q: How do I calculate profit margin from cost and selling price?
A: Subtract cost from selling price to get profit. Then divide profit by the selling price (not cost) and multiply by 100. A product costing $30 sold for $50: profit is $20. Margin = ($20 ÷ $50) × 100 = 40%. Dividing by cost instead gives you markup (66.7%), not margin.
Q: What is the difference between margin and markup?
A: Margin uses revenue (selling price) as the denominator. Markup uses cost as the denominator. The same $20 profit on a $60 sale produces a 33.3% margin but a 50% markup. Margin is always the smaller number. They describe the same profit from different perspectives.
Q: How do I calculate profit margin in Excel?
A: For gross margin, use the formula =(Revenue Cell – COGS Cell)/Revenue Cell and format as percentage. For operating margin, subtract operating expenses too. For net margin, subtract all costs. Example: if B1 is revenue and B2 is COGS, gross margin is =(B1-B2)/B1.
Q: What is a good profit margin?
A: It depends on your industry. Software companies average 19% to 20% net margin. Restaurants average about 10.7%. General retail averages 3.1%. Grocery averages 1.2%. Compare your margin to your specific industry benchmark, not to a universal number. See our complete good profit margin by industry guide for benchmarks across 30+ industries.
Q: Can profit margin be over 100%?
A: No. Profit margin is profit divided by revenue, and profit can never exceed revenue (you cannot keep more than you earn). If you are getting a number over 100%, you are likely calculating markup (profit divided by cost), which can exceed 100%. Margin maxes out just below 100% — and only if costs are near zero.
Your Formula Reference Card
Bookmark this section or use our profit margin calculator to skip the manual math entirely.
The three formulas:
- Gross Margin = (Revenue − COGS) ÷ Revenue × 100
- Operating Margin = (Revenue − COGS − OpEx) ÷ Revenue × 100
- Net Margin = Net Income ÷ Revenue × 100
The diagnostic framework:
- Strong gross margin + weak operating margin = overhead problem, not pricing problem
- Weak gross margin at any level = your product costs too much or your price is too low
- Strong operating margin + weak net margin = debt or tax burden is the issue
The one rule that prevents the most common mistake: Margin divides by revenue. Markup divides by cost. If you remember nothing else from this guide, remember that.


