Your investor deck says 85% gross margin. Your accountant's P&L says 68%. Same company, same month — and the gap is almost certainly your COGS classification, not your business. In SaaS, gross margin is the number buyers, lenders, and investors re-check first, because it answers the only question that matters at scale: of every dollar of revenue, how many cents survive the cost of delivering the product? Get the buckets wrong and you will either underprice with false confidence or talk yourself out of a fundraise you deserved.
This guide covers the formula, exactly what belongs in SaaS cost of goods sold, the benchmarks worth comparing against, and the AI inference problem that is rewriting all of them.
The SaaS gross margin formula
The formula itself is universal:
Gross margin = (Revenue − Cost of Goods Sold) / Revenue
A company with $200,000 in monthly revenue and $50,000 in COGS has $150,000 of gross profit and a 75% gross margin. Every additional revenue dollar generates about 75 cents before operating expenses. Measure it monthly, and also on trailing three- and six-month bases to smooth out lumpiness.
But the overall number alone will mislead you. A blended 60% margin could hide a stellar 90% subscription margin dragged down by negative-margin professional services — or a mediocre subscription business flattered by one good services quarter. Serious SaaS operators calculate margins by revenue stream: subscription, professional services, and usage or transaction revenue each get their own margin, computed the same way with only the revenue and COGS that belong to that stream. That split is also what makes budget conversations possible: you cannot weigh a support hiring request against forecasted margin if you do not know which stream the margin comes from.
What belongs in SaaS COGS
COGS — "cost of revenue" in SaaS P&L terminology — is the bucket of expense that directly supports your revenue streams. The single biggest calculation mistake founders make is misclassifying it. For a pure-play SaaS business, COGS typically holds four cost centers:
- DevOps and hosting. Cloud infrastructure, CDN, monitoring, data storage, SSL, and the DevOps payroll that keeps production running. This is also where R&D amortization from capitalized software lands if you capitalize development costs, plus any royalties and resold-product expense.
- Customer support. The support team's fully loaded cost — the people answering tickets and keeping customers unblocked.
- Professional services delivery. If you sell implementation, onboarding, migration, or custom work, the implementers' salaries sit here, matched against services revenue.
- Transaction and third-party costs. Payment processing fees, per-transaction vendor charges, embedded third-party APIs and data feeds that ship inside your product. If you have usage revenue, you need a matching transaction-expense bucket.
Two structural rules keep this honest. First, your COGS section is dictated by your revenue streams: no services revenue means no services cost center, but transaction revenue demands a transaction-expense department. Never commingle streams — services revenue coded to the subscription line corrupts both margins at once. Second, every COGS department must be fully burdened: wages, bonuses, payroll taxes, benefits, travel, training, and the team's internal software all land in the department that generated them. Your department leaders should be accountable for everything under their control, and G&A should never become a dumping ground for expenses that belong above the line.
The customer success question
The most debated classification in SaaS finance is customer success. The answer depends on what your CSMs actually do:
- Retention and adoption only? They belong in COGS. They are part of delivering the product's value.
- Carrying a quota, closing seat add-ons and upsells? They belong below the line in sales operating expense.
- Doing both? Allocate the cost between COGS and sales based on a defensible split of their time.
This choice moves gross margin by whole points, so document the reasoning and apply it consistently. An investor comparing you to a peer with the opposite policy is comparing two different definitions — disclose yours.
R&D amortization makes comparisons tricky
Companies that capitalize software development amortize part of R&D through COGS; companies that expense everything do not. Two otherwise identical businesses can report materially different subscription margins purely because of capitalization policy. When benchmarking, compute your recurring margin both with and without R&D amortization so you can compare yourself to either kind of peer.
What's a good SaaS gross margin?
Gross margin is one of the few metrics where an overall benchmark is genuinely useful. The long-standing targets:
- Overall gross margin: 75–80% or higher. Mature subscription businesses should clear 75%, and the best operators push past 80%.
- Subscription margin: near 90%. Pure recurring revenue with disciplined hosting and support costs should approach 90 cents on the dollar.
- Services margin: far lower. Implementation and onboarding are people-heavy by nature; mid-market SaaS with real onboarding overhead typically blends to 72–80% overall, and enterprise vendors with heavy implementation needs land around 70–78%.
The blend matters more than any single number. A company at 78% overall with a 90% subscription margin and a small, deliberate services loss is healthier than a company at 78% with an 80% subscription margin and no services at all — the first has a fixable cost problem, the second has a product cost problem. Always read the overall margin alongside the stream margins before drawing conclusions.
How AI inference is rewriting the math
Traditional SaaS earns 75–85% margins because software COGS is mostly fixed: hosting scales sub-linearly and each new customer costs nearly nothing to serve. AI inference breaks that assumption. Every LLM call, transcription job, or image generation carries a real per-use cost — tokens from a model provider or compute from your own GPUs — that scales with usage the way raw materials scale in manufacturing. Inference is variable COGS, not an R&D line item, and seat-based or flat-rate pricing on top of it can quietly destroy your margin as usage grows.
The data is stark. AI-native products averaged roughly 41% gross margins in 2024 and are projected to reach only about 52% in 2026, against 75–85% for traditional SaaS, as the best operators learn to manage inference costs. Companies bundling AI features into existing plans report 3–8 points of margin compression, and unmanaged inference bills of 10–30% of revenue are common in AI-heavy products versus 1–3% third-party API costs in classic SaaS. Analysts now describe three distinct P&L profiles: AI-augmented products targeting ~80%, AI-enabled products at 60–79%, and AI-native products at 50–60%.
If you ship AI features, four disciplines protect your margin:
- Meter and attribute inference cost per customer. You cannot price what you cannot measure. Track token and compute spend the way a manufacturer tracks materials.
- Route and cache aggressively. Sending simple queries to smaller models and caching repeated answers cuts inference spend 40–70% with minimal quality impact.
- Price for consumption. Seat-based pricing assumes near-zero marginal cost. Usage-based tiers, credits, or AI add-on fees align revenue with the cost curve.
- Report an inference line. Break the AI inference layer out of hosting in your COGS so the board sees exactly how many margin points it costs — and whether your optimizations are working.
Mistakes that corrupt the number
- Commingling revenue streams. Subscription, services, and usage revenue each need their own line. Mixed revenue makes every margin wrong simultaneously.
- Misclassifying customer success. Quota-carrying CSMs parked in COGS inflate sales efficiency and depress gross margin; retention CSMs parked in sales do the reverse. Classify by function, split when mixed.
- Ignoring R&D amortization in comparisons. Benchmark your subscription margin with and without it before concluding you are ahead of or behind a peer.
- Using G&A as a dumping ground. Team tools, travel, and training that originate in COGS departments belong there, fully burdened.
- Flat-rate pricing on variable AI cost. A per-seat plan over per-token costs is a margin time bomb — heavy users subsidize themselves on your inference budget.
- Reading only the blended margin. A 60% overall margin with a 90% subscription margin is a services problem with a known fix; without stream margins you cannot tell.
Tracking SaaS margins in your books
Margin analysis is only as good as the ledger behind it. The practical requirement is a chart of accounts with department-level COGS detail: separate accounts for hosting, support, success, services delivery, and inference, so each stream's margin falls out of the trial balance instead of a spreadsheet side-quest. A month-end close for a small SaaS might look like this in plain-text accounting:
2026-10-31 * "October subscription revenue collected"
Assets:Checking:Operating 118400.00 USD
Income:Subscriptions:MRR -120000.00 USD
Expenses:COGS:ProcessingFees 1600.00 USD
2026-10-31 * "October AWS and CDN hosting"
Assets:Checking:Operating -8200.00 USD
Expenses:COGS:Hosting 8200.00 USD
2026-10-31 * "October AI inference (model API)"
Assets:Checking:Operating -5400.00 USD
Expenses:COGS:Inference 5400.00 USD
2026-10-31 * "October support payroll, fully burdened"
Assets:Checking:Operating -14500.00 USD
Expenses:COGS:Support 14500.00 USD
2026-10-31 * "October implementation services"
Assets:Checking:Operating 18000.00 USD
Income:Services:Onboarding -18000.00 USDWith revenue and COGS booked this way, subscription margin is one query — subscription income against hosting, inference, processing, and support — and services margin is another. The docs on balancing and accounts cover the mechanics, and a dashboard view of the same ledger makes the monthly trend visible at a glance in Fava.
Your last useful step: pull this month's P&L and compute all three numbers — overall margin, subscription margin, and services margin. If you cannot produce them from the ledger in under an hour, the fix is not a better spreadsheet; it is department-level COGS accounts, set up once and coded correctly every month from now on.





