TeKoda Accounting is a 2025 INC Power Partner WINNER!

SaaS Gross Margin Calculation: A Practical Guide

SaaS finance team discussing gross margin reporting

For B2B SaaS founders, gross margin is more than a line in a monthly report. It helps show how much revenue remains after delivering the product, supporting customers, and maintaining the systems that keep the service running. A reliable SaaS gross margin calculation depends on defining revenue and service costs consistently from one reporting period to the next. If delivery costs move between cost of service and operating expenses without a clear policy, the resulting trend can mislead planning and growth decisions. This also happens when revenue is measured on one basis while costs are matched to another period.

Schedule a free discovery call

Before interpreting a margin percentage, establish what the calculation includes, which revenue period it uses, and how accounting judgment affects classification. That foundation makes the metric more useful for forecasting, resource decisions, and investor conversations. Start by clarifying what SaaS gross margin calculation means and how it differs from related SaaS metrics.

What Is SaaS Gross Margin Calculation?

SaaS gross margin calculation measures how much revenue remains after the direct costs required to deliver a software service. The basic calculation subtracts cost of service from revenue, then divides the result by revenue. It helps operators evaluate delivery economics without confusing service costs with sales, marketing, or general administration.

In practice, the calculation has two parts:

  • Revenue: the revenue recognized for the period being analyzed.
  • Cost of service: the direct or closely attributable costs of operating and supporting that service.

The formula is:

(Revenue - Cost of service) / Revenue = Gross margin

For example, a SaaS product may produce 200 units of monthly revenue. It may incur 50 units in serving costs. The result is (200 – 50) / 200, or 75%. This is an illustrative calculation, not a benchmark or target. The arithmetic is straightforward. The more important judgment is defining the cost pool consistently.

Potential service-delivery costs can include hosting, third-party infrastructure, DevOps, support, and the portion of customer success devoted to serving existing accounts. For an AI-heavy product, inference costs may also need consideration. These classifications depend on the company’s accounting policy, operating model, and ability to trace costs.

How Is Gross Margin Different From Other SaaS Metrics?

Gross margin is not the same as MRR. MRR describes recurring monthly revenue, while gross margin describes the share of revenue left after service-delivery costs. MRR can be an input to a period analysis, but it does not show the cost of delivering that revenue.

It is also different from CAC-to-LTV analysis. Customer acquisition cost and lifetime value address acquisition efficiency and expected customer economics. Gross margin can inform those measures, but it does not replace them. Likewise, ASC 606 concerns revenue-recognition requirements and timing. A gross margin calculation should use an appropriate revenue basis, but it is not a substitute for an ASC 606 assessment.

Once the scope is clear, the next step is to identify which revenue inputs belong in the period calculation.

Which Revenue Should You Use in the Calculation?

For a SaaS gross margin calculation, use revenue recognized for the same reporting period as the costs required to deliver the service. Cash collected is a cash-flow measure, not automatically the revenue earned in that month. Recurring-revenue measures such as ARR can provide business context, but they should not replace period revenue in the margin formula.

Start with the revenue recorded for the month, quarter, or year under the company’s accounting policy. Then match the service-delivery costs incurred for that same period. This keeps the numerator and denominator comparable. If a customer prepays an annual subscription, the cash receipt may arrive at once while the related revenue is recorded across the service period. Including the entire receipt in one month could make that month appear unusually strong and the following months artificially weak.

Refunds, credits, and material discounts should also be reflected consistently in the revenue figure. The exact treatment depends on the company’s agreements and accounting policy, so document the approach rather than changing it from one close to the next. The goal is a margin trend that reflects the economics of delivering the product, not the timing of invoices, card settlements, or unusual adjustments.

How Does Recurring Revenue Fit the Calculation?

Recurring revenue helps explain the stability and scale of a SaaS business. ARR is widely used in cloud-software discussions as a recurring-revenue measure, but ARR is annualized and forward-looking in a way that period revenue is not. Use it as a companion operating metric, then calculate gross margin from the revenue recognized in the selected reporting period.

For more context on how recurring metrics fit into the broader finance function, see this guide to SaaS bookkeeping and recurring revenue. That resource covers MRR, LTV, CAC, and ASC 606 topics. This calculation should stay focused on matching earned revenue with the cost of serving customers. A consistent policy, applied across periods, makes the resulting margin useful for operating decisions and review.

Which Costs Belong in SaaS Cost of Service?

For a SaaS gross margin calculation, cost of service should represent the costs required to deliver and support the product during the measurement period. Hosting, infrastructure, service delivery, and selected technical or customer-support costs may belong here, but the final classification depends on your accounting policy and whether you apply it consistently.

Include Costs Directly Tied to Delivery

Start with costs that scale with operating the product or serving active customers. A practical review commonly considers:

  • Cloud hosting, storage, bandwidth, and third-party infrastructure used to run the platform.
  • Support and the portion of customer success dedicated to serving existing accounts.
  • DevOps and site reliability work required to keep the service available and functioning.
  • AI inference and related usage costs when those costs are necessary to deliver an AI-heavy product.

These categories are potential cost-of-revenue items, not a universal chart of accounts. The underlying distinction is whether the expenditure supports delivery of the service rather than general business growth. Map each category to your own operations and accounting policy.

Review Judgment-Heavy Shared Costs

Some roles serve more than one purpose. Customer success may support onboarding, renewals, expansion, and account service. Engineering may build new features while also maintaining production systems. Separate the delivery-related portion only when your records and policy support a reasonable allocation. Document the method, apply it period to period, and revisit it when the operating model changes.

Separate Selling and General Operations

Sales commissions are treated as operating expenses rather than cost of goods sold under one cited SaaS reporting convention. So they should not automatically be included in cost of service. General sales and marketing, executive administration, finance, and product development also require separate consideration under the company’s policy.

The strongest process is an include, review, and exclude schedule tied to your chart of accounts. Have the controller or accountant approve the policy, record exceptions, and use the same treatment in each period. Consistency makes the resulting margin useful for operational decisions, even when reasonable classifications differ across SaaS companies.

How Do You Perform a SaaS Gross Margin Calculation?

A SaaS gross margin calculation shows how much revenue remains after the direct cost of serving the product. Start with revenue for the same period as the service costs, subtract cost of service, and divide by revenue. The result is a percentage that helps operators track delivery economics without confusing margin with cash flow or pricing.

  1. Set the measurement period. Choose a consistent period, such as one month, and use revenue recognized for that period. Match it with the costs incurred to deliver the service during the same period. Do not substitute cash collected for revenue simply because the cash report is easier to access.
  2. Identify cost of service. Pull the service-delivery costs included by your accounting policy. Depending on the product and policy, this may include hosting, third-party infrastructure, relevant support, customer success serving existing accounts, DevOps, or AI inference costs. Keep classifications consistent so changes reflect the business rather than a shifting definition.
  3. Apply the formula. Use (revenue – cost of service) / revenue. Convert the resulting decimal to a percentage. For example, if monthly revenue is 200 units and serving cost is 50 units, the calculation is (200 – 50) / 200, or 75%.
  4. Review the result and assumptions. Record the result with the period, revenue source, cost accounts, and any allocation method used. Compare it with prior periods only when the underlying definitions remain consistent. Investigate a sudden change before treating it as a product or operational trend.

Illustrative Example, Not a Benchmark

The 200-unit revenue and 50-unit serving-cost example is illustrative rather than a benchmark, price claim, or recommended target. Actual results depend on the product, infrastructure design, support model, customer mix, and accounting policy. The arithmetic simply demonstrates how the formula produces a 75% gross margin.

Before using the number in planning or management reporting, check that:

  • Revenue and service costs cover the same period.
  • Cost-of-service accounts are separated from operating expenses under your documented policy.
  • Shared costs are allocated consistently and reviewed when usage or customer mix changes.
  • The calculation ties back to the underlying ledger or reporting system.

How Should You Allocate Shared Costs Across Customers or Segments?

Allocate shared costs using the driver that best reflects why the cost exists. For example, hosting may follow compute or storage usage, while a reasonable proxy may be necessary when direct usage data is unavailable. Document the method, apply it consistently, and review whether the allocation still reflects causation as the product and customer mix change.

Segment-level margin matters because a company-wide average can conceal an expensive customer group. A blended gross margin may look stable even while a lower-margin segment consumes disproportionate infrastructure or service resources. That can distort pricing, packaging, capacity planning, and decisions about where to invest.

MethodBest fitCaveat
Usage-basedAllocate hosting by tracked compute, storage, or similar consumption.Requires reliable usage data and a clear mapping to cost.
Seat-basedUse seat count when account size is a meaningful consumption signal.Seats may not reflect actual usage, especially across different customer types.
Proxy allocationUse a documented proxy, such as seat count weighted by a usage ratio, when direct data is unavailable.Treat results as estimates and revisit the proxy as better evidence becomes available.

The goal is not to manufacture precision. It is to produce a useful, defensible view of contribution by segment. If two segments receive the same allocation simply because the ledger lacks detail, note that limitation rather than presenting the result as measured cost.

Keep the allocation policy separate from other unit-economics measures. Gross margin describes the cost of serving revenue; CAC-to-LTV analysis addresses acquisition efficiency and customer value. For the broader relationship between those measures and retention, see SaaS financial metrics and retention.

What Does Gross Margin Tell You About SaaS Growth?

Gross margin shows how much revenue remains after the costs required to deliver a SaaS product. Watching its direction helps founders assess operating leverage, service intensity, and the economics behind growth. A rising margin may indicate delivery efficiency, while a falling margin can signal infrastructure, support, or product complexity that needs attention.

Trend direction is usually more useful than a single result. If gross margin improves as revenue grows. The business may be gaining operating leverage: a larger share of each additional dollar remains available for product development, sales, administration, and profit. By contrast, a 60% margin requires more revenue than an 80% margin to fund the same level of operating activity, all else equal.

Read the Trend Alongside Its Cost Drivers

A margin change is not automatically good or bad. A temporary decline may reflect deliberate investment in infrastructure or hands-on implementation for larger accounts. A persistent decline may point to rising hosting consumption, support demands, customer success work, or AI inference costs. Review the underlying cost categories and ask whether the increase is tied to revenue growth, a particular segment, or an avoidable process.

Compare equivalent periods and use consistent classification policies. Monthly results can be distorted by billing timing, one-time hosting commitments, or costs posted late. Period-over-period and year-over-year views are more useful when the revenue and cost periods match. Segment analysis can also reveal whether a blended company margin is hiding a service-intensive customer group.

Use Gross Margin as Context, Not a Rule

Some industry guidance places healthy SaaS gross margins broadly around 70% to 85%. Treat that range as directional context, not a universal standard or an investment rule. Product architecture, customer support expectations, implementation work, data intensity, and accounting policy all affect what is reasonable for a specific business. The same percentage can describe very different operating models.

Gross margin also informs unit economics without replacing them. It helps explain the delivery economics behind revenue, while CAC-to-LTV analysis addresses acquisition efficiency and customer value. Keep those questions connected but distinct. Comparing periods, segments, and cost drivers gives founders a clearer basis for deciding whether growth is becoming more efficient or simply more expensive to serve.

How Can You Build Reliable Gross Margin Reporting Controls?

Reliable gross margin reporting comes from repeatable controls, not a spreadsheet formula alone. Define revenue and cost-of-service accounts, close the books on a consistent schedule, reconcile balances, document allocations, review variances, and assign clear ownership. Then feed the results into forecasting so the calculation supports decisions, not merely historical reporting.

Start with a chart of accounts that separates revenue streams and direct delivery costs in a way your team can maintain. A well-designed chart of accounts for cost tracking should make hosting, infrastructure, support, and other service-delivery categories visible without creating unnecessary account sprawl. Document which costs are included, which remain operating expenses, and when policy judgments require review.

Use the Monthly Close as the Control Point

During each close, confirm that revenue and cost cutoffs cover the same reporting period. Reconcile bank, credit card, payroll, accounts receivable, vendor, and key infrastructure balances. Investigate unusual changes rather than carrying unexplained differences forward. TeKoda’s monthly bookkeeping process includes account reconciliation and preparation of the Balance Sheet, Income Statement. And Statement of Cash Flows, a practical foundation for checking whether gross margin ties to the broader financial statements. Learn more about monthly close and reporting controls.

Keep allocation schedules separate from the ledger when shared infrastructure or support costs must be distributed across products, plans, or customer segments. Record the driver, source data, period, preparer, reviewer, and any changes from the prior month. Usage, seats, or another reasonable proxy may be appropriate depending on what the business can measure. Consistency matters more than false precision, and the method should be revisited when the operating model changes.

Assign Review Ownership and Connect Margin to the Forecast

Name an owner for preparation and a separate reviewer for close approval. A variance review should compare actual margin with the prior period, budget, and forecast, then explain movements such as hosting growth, support staffing, pricing changes, or mix shifts. Set thresholds that trigger investigation, but do not let a threshold replace judgment.

Finally, use the findings to update assumptions about capacity, infrastructure, hiring, and customer economics. TeKoda’s five-stage method moves from Stabilize and Understand to Plan, Decide, and Grow: dependable books create the visibility needed for that progression. Its financial planning, forecasting, and analytics work can help connect recurring margin reviews to forward-looking decisions.

Frequently Asked Questions

What Is the Formula for Gross Margin?

Subtract cost of service from revenue, divide the result by revenue, and multiply by 100. In formula form: (revenue – cost of service) / revenue x 100. Use revenue and service costs from the same reporting period so the percentage reflects the economics of that period.

What Costs Should a SaaS Company Include in Cost of Service When Calculating Gross Margin?

Review the costs required to deliver and support the product, such as hosting, third-party infrastructure, DevOps, and support. Customer success serving existing accounts or AI inference may also belong in cost of service, depending on your accounting policy and operating model. Document the policy and apply it consistently rather than treating one classification as universal. Sales commissions are generally treated as sales and marketing operating expenses under one cited SaaS reporting convention, not cost of service.

How Do You Calculate SaaS Gross Margin From Recurring Revenue?

Calculate the margin using the period’s recognized revenue, including recurring revenue recognized for that period, and the matching cost of service. MRR and ARR help describe recurring-revenue scale, but they are not substitutes for revenue in the margin formula. Keep revenue recognition, billing, and margin reporting aligned, and consult your accounting policy when contract terms or ASC 606 considerations affect recognized revenue.

How Should SaaS Companies Allocate Shared Service-Delivery Costs Across Customers or Segments?

Use the most defensible driver available. Hosting can be allocated by tracked compute or storage usage; when usage data is unavailable, seat count weighted by a reasonable usage ratio is one possible proxy. Record the method, review it as the product changes, and avoid presenting a blended company margin as representative of every segment. A blended result can conceal materially different support or infrastructure economics.

What Is the Average Gross Margin for SaaS Companies?

There is no universal average that applies to every SaaS business. Product complexity, infrastructure intensity, support model, services revenue, and AI usage can materially change the result. Some industry guidance describes 70% to 80% as a directional healthy range and above 80% as best-in-class, but treat those figures as context, not a required standard.

Ready to Make Gross Margin More Useful?

Reliable gross margin reporting can give your team a clearer foundation for planning, reviewing service-delivery costs, and discussing growth with investors. TeKoda Accounting can help you evaluate your reporting process and identify practical controls for more consistent SaaS financial insight.

Schedule a free discovery call with TeKoda Accounting