SaaS Gross Margin: Calculate Infrastructure Cost per Customer

Batuhan Esirger
Batuhan Esirger
Co-Founder
Updated Sep 23, 202616 min read
Written for: SaaS founders and operators connecting cloud delivery cost to customer economics, pricing, and gross margin
SaaSGross MarginCloud CostUnit EconomicsFinOps
Last reviewed:
Guide
SaaS Gross Margin: Calculate Infrastructure Cost per Customer
rafftechnologies.com/learn
On this page

Key Takeaways

Gross margin needs a consistent SaaS COGS policy. Allocate direct costs first, shared costs by a documented driver, and keep unresolved spend visible. Compare unit cost with revenue and reliability needs.

SaaS gross margin is the percentage of revenue remaining after direct service-delivery costs are subtracted.

For a cloud product, the difficult part is not the formula. It is deciding which costs belong to delivering the service and allocating those costs consistently across products, customers, and shared infrastructure. Raff Technologies can provide infrastructure used by these workloads, but the business still needs a repeatable way to connect VMs, databases, storage, third-party services, and operational support with customer revenue.

A 1 percentage-point margin change can materially affect how much revenue remains for product development, sales, administration, and future infrastructure investment. This guide explains how to define SaaS cost of goods sold, calculate infrastructure cost per customer, choose an allocation method, and interpret margin movement without sacrificing reliability. It complements SaaS Infrastructure Cost: From MVP to Series A, which covers stage-based budgeting rather than customer-level unit economics.

SaaS gross margin measures delivery efficiency

Gross profit and gross margin answer related but different questions.

Text
Gross profit = recognized revenue - SaaS COGS Gross margin percentage = (recognized revenue - SaaS COGS) / recognized revenue x 100

Gross profit is a currency amount. Gross margin is the percentage of revenue left after direct delivery costs.

An illustrative monthly example:

ItemAmount
Recognized subscription revenue$60,000
Production infrastructure$7,000
Direct third-party service usage$3,000
Customer support and service delivery$5,000
Total SaaS COGS$15,000
Gross profit$45,000
Gross margin75%

The 75% result is not automatically good or bad. It must be interpreted against the product model, customer segment, support requirements, infrastructure intensity, and the company's accounting policy.

Industry sources often use roughly 70% to 85% as a reference range for SaaS gross margin, but products with heavy data processing, media delivery, human service, or dedicated customer infrastructure may operate differently. A benchmark should start an investigation, not replace one.

Gross margin should also remain separate from net margin. Sales, marketing, general administration, and most new-product research typically appear below gross profit rather than inside the direct cost of delivering the existing service.

SaaS COGS needs an explicit policy

SaaS cost of goods sold is the direct cost required to deliver and maintain the service for current customers. The exact classification varies by company and accounting policy, so finance and accounting ownership matters.

A practical policy can begin with this decision table:

CostUsually included in SaaS COGSPolicy judgment required
Production computeYesSeparate product and internal workloads
Production databases and cachesYesAllocate shared clusters consistently
Customer file storage and egressYesAttribute by tenant when measurable
Backups and production recoveryUsuallySeparate operational protection from broad business continuity
Third-party APIs used to deliver the productYesExclude internal productivity tools
Customer supportOftenDefine which support roles are direct delivery
Reliability and production operations laborOftenAllocate only the delivery-related portion
Payment processingOftenTreatment depends on finance policy
Development and staging infrastructureSometimesDistinguish cost to produce from cost to serve
New feature developmentUsually noNormally research and development expense
Sales and marketingNoOperating expense
General administrationNoOperating expense

The goal is not to find one universal classification. It is to make the company's classification stable enough that one month can be compared with another.

Three rules improve consistency:

  1. Use recognized revenue and costs from the same period.
  2. Document which labor, infrastructure, and vendor costs are included.
  3. Do not change the policy merely to improve the reported percentage.

A management dashboard may use a broader operational measure than the official financial statements. Label it clearly. For example, infrastructure contribution margin or cost to serve can be useful internal metrics without being presented as accounting-approved gross margin.

Infrastructure cost per customer is an operational unit cost

Infrastructure cost per customer connects cloud spend to a measurable business unit.

Text
Infrastructure cost per active customer = attributable monthly infrastructure cost / active customers in the same period

Suppose the product has $9,000 of attributable monthly infrastructure cost and 300 active paying customers:

Text
$9,000 / 300 = $30 per active customer

That number becomes useful only when the denominator matches how value and cost are created.

UnitAppropriate whenMain limitation
Active customerAccounts have broadly similar usageHides large customer differences
Paid tenantOne organization maps to one workload boundarySeats and usage may vary widely
Active seatCost grows with usersData and compute may not follow seats
Transaction or jobProcessing drives infrastructureRequires reliable event counts
1,000 API requestsRequest volume drives computeIgnores storage and support
GB stored or transferredData is the dominant costIgnores fixed platform cost
Workload or productPortfolio decisions matterDoes not show individual customer economics

Choose one primary unit and one or two diagnostic units. A B2B application might track cost per paid tenant, storage per tenant, and support hours per tenant. An API product might track cost per million successful requests and cost per customer segment.

Do not divide total company cloud spend by all registered accounts. Use customers that received service during the same period, and exclude old, inactive, internal, or free accounts unless the metric intentionally includes them.

Allocation methods create different answers

Cloud costs usually fall into four groups:

Cost groupExamplePreferred treatment
Direct customer costDedicated VM or customer-specific storageAssign directly
Direct product costProduct-specific app and database resourcesAssign to the product, then its customers
Shared platform costMonitoring, load balancing, shared database, backupsAllocate by a documented driver
Unallocated costUnknown owner or missing metadataKeep visible until resolved

The decision framework should use the simplest defensible method.

Allocation methodChoose it whenExampleRisk
Direct attributionThe resource belongs to one customer or productDedicated tenant VMMost accurate, but only for isolated resources
Usage-based allocationReliable usage data existsRequests, CPU time, GB stored, egressMeasurement can become complex
Revenue-weighted allocationShared cost supports customers with different contract valuesEnterprise platform overheadRevenue may not reflect technical consumption
Equal allocationCustomers use a genuinely similar serviceSmall homogeneous tenant basePenalizes light users and hides heavy users
Capacity-weighted allocationReserved capacity is divided intentionallyDatabase or worker poolRequires a stable capacity model
Keep as shared overheadNo fair driver exists yetInternal monitoring platformCustomer cost remains incomplete

Use direct attribution first. Allocate measurable shared costs second. Keep the remaining shared or unknown amount visible instead of forcing false precision.

A practical allocation sequence is:

Text
Direct customer costs + allocated product costs + allocated shared platform costs = attributable cost to serve Attributable cost to serve / selected business unit = unit cost

For shared infrastructure, the driver should reflect causation where practical. Storage can follow bytes retained, API processing can follow requests or execution time, and support can follow recorded service effort. Equal allocation is acceptable for a small, homogeneous customer base, but it should be replaced when usage differences become material.

Customer and workload patterns explain margin movement

A falling gross margin does not always mean the cloud provider became expensive. The cost model may be revealing a product, pricing, or customer-fit problem.

Fixed, variable, and step costs behave differently

Cost behaviorExampleMargin effect
Fixed baselineMinimum production stackMargin improves as revenue grows
VariableEgress, object storage, API callsCost follows usage
Step costSecond app node or larger database tierMargin drops, then may recover with growth
Dedicated customer costIsolated environment or custom supportDepends on contract pricing
Temporary costMigration or launch environmentShould not become permanent baseline

A step increase may be healthy when it creates capacity for contracted growth or reduces a material reliability risk. It becomes a concern when the additional capacity stays idle or cannot be connected to customer value.

Customer segments can have different economics

One average can hide several businesses inside the same product.

SegmentRevenue patternCost patternQuestion
Small self-serviceLow revenue, low supportShared infrastructureDoes automation keep delivery cost low?
Data-heavy customerHigher storage and egressVariable infrastructureIs usage priced or limited correctly?
Enterprise tenantHigh contract valueIsolated or customer-specific infrastructure and supportDoes the contract cover isolation and service effort?
Free or trial userNo current revenueCompute, storage, and supportIs the acquisition value worth the delivery cost?
Legacy planOlder priceCurrent service costHas cost outgrown the contract?

Track revenue and cost by segment before changing architecture for the entire customer base.

Margin movement should be decomposed

A useful monthly bridge is:

Text
Prior-period cost to serve + new customers + higher customer usage + storage and retention growth + support and vendor changes + reliability investments * right-sizing and cleanup * customer churn or reduced usage = current-period cost to serve

This separates healthy growth, deliberate reliability spending, temporary projects, and avoidable waste.

Margin improvement should protect reliability

Improving SaaS gross margin is not a mandate to remove every redundancy, backup, or support function. The objective is to reduce cost that does not create customer value or required resilience.

Use these operating priorities:

Repair ownership and allocation first

A large unallocated pool makes optimization unreliable. Apply consistent workload, environment, owner, customer, and lifecycle metadata before drawing customer-level conclusions. The Server Naming Convention guide provides the governance model.

Remove idle and expired infrastructure

Temporary environments, detached storage, old snapshots, and unused services can become permanent COGS. Use Idle Infrastructure Cost for the keep, resize, schedule, archive, or delete decision.

Right-size the constrained layer

Do not resize every component because one role is constrained. Measure app, worker, database, storage, and network behavior separately. A larger VM is appropriate when it solves a measured bottleneck; it is not a substitute for understanding the workload.

Align pricing with expensive usage

When customer cost is driven by storage, egress, jobs, API calls, or premium support, the commercial model should acknowledge that driver. Options include usage allowances, paid overages, higher tiers, dedicated-environment pricing, or explicit service packages.

Review retention and third-party services

Logs, backups, objects, API vendors, observability, and support tools can grow without a matching pricing decision. Retention and vendor reviews should follow customer, recovery, compliance, and operational requirements.

Preserve recovery and service commitments

A higher reported margin is not an improvement when it depends on untested backups, insufficient capacity, or reduced customer support that increases churn and incidents.

Raff cost attribution starts with workload metadata

Raff customers can build a unit-cost model by combining current billing or account data with a maintained resource inventory.

A practical inventory maps each resource to:

  • stable resource ID;
  • workload or product;
  • production or non-production environment;
  • owner;
  • customer or customer segment where appropriate;
  • lifecycle state;
  • allocation rule;
  • recovery and retention policy.

The model can include Raff VMs, Managed Databases, Object Storage, and Data Protection. Use the live pricing page and verified billing records rather than copying plan prices into a permanent spreadsheet without effective dates.

A simple Raff allocation table might look like this:

ResourceWorkloadAllocation
Shared application VMsMain SaaS productActive tenants or request share
Dedicated customer VMEnterprise tenantDirect to customer
Managed databaseMain SaaS productQuery, storage, or active-tenant share
Object storageCustomer filesStored bytes by tenant where available
BackupsProtected workloadFollow the protected resource allocation
Development and stagingEngineering deliverySeparate cost-to-produce pool

The existing Power BI cloud cost guide explains how to turn a cost ledger and ownership table into a reusable reporting model. Start with a spreadsheet when the resource footprint is small, but preserve stable identifiers and definitions so the model can grow without being rebuilt.

Raff's infrastructure model can make direct resource costs easier to map to workloads. Customer economics still depend on disciplined allocation, product usage data, support effort, and the revenue policy used by the business.

Conclusion

SaaS gross margin becomes useful when revenue and direct service-delivery costs are classified consistently.

Define the SaaS COGS policy with finance, attribute direct customer and product costs first, allocate shared infrastructure with a documented driver, and keep unresolved spend visible. Then calculate infrastructure cost per a unit that reflects the product—such as an active tenant, transaction, request, or gigabyte—rather than relying on total cloud spend alone.

Use Cloud Budget Guardrails for Startups to control future spend drift, and connect the unit-cost model to customer pricing, capacity, and reliability decisions.

Model current Raff infrastructure costs against your SaaS revenue and customer usage.

Was this article helpful?
Batuhan Esirger
Batuhan Esirger
Co-Founder

Co-founder of Raff, focused on practical cloud infrastructure, product strategy, and helping small teams choose simpler hosting architectures.

Put it into practice

Spin up a Raff server, follow the steps above on real infrastructure, and you are live. Linux or Windows, backed by a 14-day money-back guarantee.

Frequently asked questions

What is SaaS gross margin?
SaaS gross margin is the percentage of recognized revenue remaining after direct service-delivery costs, or SaaS COGS, are subtracted.
What is the SaaS gross margin formula?
Gross margin equals recognized revenue minus SaaS COGS, divided by recognized revenue, multiplied by 100. Use revenue and costs from the same period.
What belongs in SaaS COGS?
SaaS COGS commonly includes production infrastructure, direct cloud usage, customer support, required third-party services, and delivery-related operations. The exact policy should be agreed with finance.
What is a good SaaS gross margin?
Many industry sources use approximately 70% to 85% as a reference range, but the right comparison depends on product model, support, infrastructure intensity, stage, and customer segment.
How is infrastructure cost per customer calculated?
Divide attributable monthly infrastructure cost by active customers receiving service in the same period. Use a different unit when tenants have materially different usage.
How should shared cloud costs be allocated?
Assign direct costs first, then allocate shared costs using a documented driver such as requests, storage, capacity, revenue, or active tenants. Keep unresolved costs visible.
Should development and staging costs be included in SaaS COGS?
Treatment varies. Many teams keep development and staging in a separate cost-to-produce pool unless the costs are directly required to deliver the current service.
How does Raff support SaaS unit-cost analysis?
Raff VMs, Managed Databases, Object Storage, and Data Protection can be mapped to workloads, environments, and customers using stable resource identifiers and an inventory model.