Back to Blog

How to Calculate Gross Margin (and Why It Matters More Than Revenue)

Master gross margin calculation with real-world examples across SaaS, e-commerce, and manufacturing.

March 24, 2026Calculation GuidesMetricGen Team

Revenue is vanity. Profit is sanity. Gross margin is where you see the truth.

A $10M company with 80% gross margin is stronger than a $20M company with 30% margin. Gross margin reveals your unit economics and whether you can scale profitably.

The Formula

Gross Margin = (Revenue - Cost of Goods Sold) ÷ Revenue × 100

Or:

Gross Margin = (Revenue - COGS) ÷ Revenue %

Where COGS (Cost of Goods Sold) includes only direct costs to deliver the product:

  • Materials/ingredients
  • Manufacturing labor
  • Hosting/infrastructure directly attributed to serving customers
  • Payment processing fees
  • Support/delivery labor

COGS does NOT include:

  • Salaries for non-delivery roles (marketing, sales, engineering)
  • Rent/utilities
  • Administrative overhead

Step-by-Step Calculation

Step 1: Identify total revenue for period Use revenue recognized in the period (not invoiced revenue).

Step 2: List all COGS

  • Raw materials cost
  • Manufacturing/production labor
  • Hosting costs per customer
  • Payment processor fees
  • Customer support (direct delivery)
  • Shipping/delivery costs (if applicable)

Step 3: Sum COGS

Step 4: Calculate gross profit

Gross Profit = Revenue - COGS

Step 5: Divide gross profit by revenue

Gross Margin % = (Gross Profit ÷ Revenue) × 100

Example 1: SaaS Company

Q2 Income Statement:

  • Revenue: $500,000
  • COGS (costs to deliver):
    • Cloud hosting ($50K for servers): $50,000
    • Payment processing fees (2.9% + $0.30): $15,500
    • Customer support team (30% allocation): $20,000
    • Total COGS: $85,500

Calculation:

Gross Profit = $500,000 - $85,500 = $414,500
Gross Margin = $414,500 ÷ $500,000 × 100 = 82.9%

Interpretation: For every dollar of revenue, $0.83 is profit after direct costs.

Example 2: E-commerce

Monthly:

  • Revenue: $100,000
  • COGS:
    • Product cost: $35,000
    • Packaging/shipping: $8,000
    • Payment processing: $2,900
    • Warehouse labor: $5,000
    • Total COGS: $50,900

Calculation:

Gross Profit = $100,000 - $50,900 = $49,100
Gross Margin = $49,100 ÷ $100,000 × 100 = 49.1%

Example 3: Manufacturing

Quarterly:

  • Revenue: $2,000,000
  • COGS:
    • Raw materials: $600,000
    • Manufacturing labor: $300,000
    • Factory utilities: $80,000
    • Equipment depreciation: $40,000
    • Quality assurance labor: $50,000
    • Total COGS: $1,070,000

Calculation:

Gross Margin = ($2,000,000 - $1,070,000) ÷ $2,000,000 × 100 = 46.5%

Industry Benchmarks

Healthy margins vary dramatically:

| Industry | Typical Gross Margin | |----------|---------------------| | SaaS | 70-90% | | Professional Services | 40-60% | | E-commerce | 30-50% | | Manufacturing | 30-50% | | Retail | 25-40% | | Hospitality | 60-80% |

High-margin businesses (SaaS, software) scale better than low-margin (retail, manufacturing).

Gross Margin vs. Net Margin

Don't confuse the two:

| Metric | Formula | What It Includes | |--------|---------|-----------------| | Gross Margin | (Rev - COGS) ÷ Rev | Direct product costs only | | Operating Margin | (Rev - COGS - OpEx) ÷ Rev | + Sales, marketing, overhead | | Net Margin | Net Income ÷ Rev | + Interest, taxes |

Example with all three:

  • Revenue: $1,000,000
  • COGS: $200,000
  • Gross Margin = 80%
  • Operating expenses (sales, marketing, salaries): $500,000
  • Operating Margin = 30%
  • Interest & taxes: $50,000
  • Net Margin = 25%

Gross margin shows product economics. Operating margin shows business viability. Net margin shows profitability to shareholders.

What to Include in COGS (and What NOT to)

INCLUDE in COGS:

  • Raw materials/inventory
  • Direct labor (people making/delivering the product)
  • Manufacturing overhead directly tied to production
  • Hosting/infrastructure per customer
  • Payment processing fees
  • Shipping/delivery costs
  • Packaging
  • Quality assurance labor

DO NOT INCLUDE:

  • Sales commissions (put in Operating Expenses)
  • Marketing (Operating Expenses)
  • Management salaries (Operating Expenses)
  • Rent/utilities (Operating Expenses)
  • Administrative staff (Operating Expenses)
  • R&D/engineering (Operating Expenses)
  • Depreciation of non-manufacturing assets

The rule: If you can't directly tie it to delivering the product to a customer, it's not COGS.

Gross Margin Trends

Track gross margin over time:

| Quarter | Revenue | COGS | Gross Margin | |---------|---------|------|--------------| | Q1 | $400K | $80K | 80% | | Q2 | $500K | $95K | 81% | | Q3 | $600K | $120K | 80% | | Q4 | $800K | $168K | 79% |

Declining margin (Q1: 80% → Q4: 79%) suggests:

  • Scale inefficiencies
  • Higher customer support costs
  • Increased competition (discounting)
  • Product quality changes

Investigate and fix before it gets worse.

Improving Gross Margin

1. Reduce COGS

  • Negotiate better supplier rates
  • Optimize production efficiency
  • Reduce waste
  • Automate labor-intensive processes
  • Move from manufacturing to SaaS model (if applicable)

2. Increase prices

  • Without changing COGS, higher revenue = higher margin
  • Test price increases (usually only 5-10% reduce volume)

3. Mix shift

  • Focus on high-margin products
  • Sell more high-margin vs. low-margin SKUs
  • Upsell/cross-sell to increase per-customer revenue

4. Scale benefits

  • As revenue grows, fixed COGS components spread across more revenue = higher margin

Common Mistakes

Mistake 1: Including operating expenses in COGS Sales commissions, marketing, and admin should go in Operating Expenses, not COGS.

Mistake 2: Not updating COGS allocation If you add a new product line or manufacturing process, recalculate COGS for each product. One company-wide COGS number hides problems.

Mistake 3: Ignoring gross margin by customer Some customers might have negative gross margin (costs more to serve than revenue). Identify and fix or drop them.

Mistake 4: Confusing accrual vs. cash COGS COGS should be accrued (when product is delivered), not when paid.

Tools

Spreadsheet: Monthly gross margin tracking with variance analysis. Accounting software: QuickBooks, Xero, NetSuite track COGS automatically. Analytics: Tableau, Looker show gross margin trends by product/customer.

Related Articles


Explore the full metric definition

MetricGen has chart templates, formulas, and sample data for hundreds of business metrics.

Browse Metrics

Related Guides