SaaS Gross Margin Calculator: Hosting, AI/API and Support Costs — Free Online Tool
Measure monthly SaaS gross profit after hosting, API or AI inference, customer support and other direct delivery costs. Separate customer acquisition and general overhead from direct service COGS.
All inputs start at zero. Select Try an Example to load a sample, or enter your own values and choose Calculate. This calculator is for planning, not personalized accounting or tax advice.
SaaS Gross Margin Formula
SaaS gross margin = (recognized service revenue − direct costs of delivering that revenue) ÷ revenue × 100. In this simplified monthly model, the direct cost buckets are hosting, AI/API usage, direct customer support, payment processing and other service delivery COGS. The calculator does not infer GAAP or IFRS classification from labels. Enter amounts consistently with your accounting policy.
In the example, monthly revenue is $10,000. Hosting $1,200, AI/API $800, direct support $1,000, processing $300 and other COGS $200 total $3,500. Gross profit is $6,500 and gross margin is 65%.
Which SaaS Costs Belong in COGS?
Usually direct hosting, usage-based inference, data services and direct support needed to operate the subscription are useful candidates. Engineering for new development, broad marketing, sales commissions, and head-office expenses may belong elsewhere under the applicable accounting policy. Allocate shared infrastructure consistently and avoid mixing cash outflows with accrual-based recognized expenses without explaining that choice.
AI software deserves special attention. A flat subscription with heavy model inference may produce dramatically different unit economics depending on usage. Monitor inference cost per active customer, model choice, token consumption, cache hit rate and support utilization rather than relying on a single industry-wide margin estimate.
Gross Margin vs Net Margin
Gross margin excludes many general expenses. A SaaS company may show a strong gross margin but still have negative net income after R&D, sales and marketing, general administration and financing costs. Review our 2026 industry benchmark analysis and profit margin calculator for related context.
Frequently Asked Questions
Should customer acquisition cost be in SaaS gross margin?
Customer acquisition is usually analyzed as sales and marketing rather than service COGS; confirm classification against your actual accounting policy.
Does monthly recurring revenue always equal recognized revenue?
No. Annual prepayments, discounts, refunds and service periods can require different revenue recognition. Enter the revenue for the same accounting period as the costs.
What is a good SaaS gross margin?
There is no universal target. Product mix, delivery architecture and cost classification vary substantially. Compare against your company’s historical gross margins and similar business models.
Methodology and Disclosure
All values are calculated locally in your browser. Enter currency amounts consistently in USD, and exclude any taxes collected for the government where they do not form part of revenue. The stated examples are hypothetical, and no fee is guaranteed. Last reviewed November 16, 2026. Learn about our editorial standards and compare general pricing with the Margin and Markup Calculator.