How to calculate SaaS gross margin
Gross margin is the share of revenue you keep after the costs of serving customers. It feeds LTV, break-even and runway, so it's worth getting right. The example company below is made up so the math is easy to follow.
The example
A small SaaS makes $10,000 MRR. Each month it pays $800 for hosting, $300 in payment fees, $900 for customer support and $500 for third-party APIs its product calls.
The formula
Cost of revenue = the costs of delivering the product to paying customers. $800 + $300 + $900 + $500 = $2,500.
Gross margin = (revenue − cost of revenue) ÷ revenue. ($10,000 − $2,500) ÷ $10,000 = 75%.
What counts as cost of revenue
- Counts: hosting and infrastructure, payment processing fees, customer support, onboarding, and APIs or licenses used to serve customers.
- Doesn't count: marketing, sales, building new features, rent and general admin. Those are operating expenses, and they show up in burn rate instead.
When one person does both support and building, split their cost by rough time spent. Pick a rule and keep it the same every month so the trend means something.
Why it matters
LTV uses gross margin: LTV = ARPU × gross margin ÷ monthly churn. At $50 ARPU and 4% churn, a 75% margin gives $50 × 0.75 ÷ 0.04 = $937.50. At 85% it's $1,062.50. More on that: how to calculate LTV.
Break-even revenue is fixed costs ÷ gross margin. With $6,000 of fixed costs, a 75% margin needs $8,000 MRR, and an 85% margin needs about $7,059. See the SaaS break-even point.
Ways to improve it
- Review your hosting bill for unused servers and oversized plans.
- Cache or batch expensive API calls, especially AI model calls, which can grow with every user.
- Add help docs so common questions don't need a support reply.
- Raise prices, or move heavy users to a plan that covers what they cost you.
Every formula in one place: SaaS metrics formulas.
Want the full model?
The Founder Unit Economics Pack ($39) is an Excel and Google Sheets workbook that uses your gross margin to work out LTV:CAC, payback, break-even and runway, with side-by-side scenarios.