SaaS gross margin calculator with cost of revenue breakdown

Enter revenue and what it costs to deliver your product, line by line. See gross profit, gross margin and which cost takes the biggest share.

Gross margin · P&LCost of revenue by line · updates as you type
Recognised revenue for the period
—
Servers, databases, storage, monitoring
—
Licensed tools and APIs inside the product
—
Support team pay and help desk tools
—
Setup, migration and training for new customers
—
Card and billing fees on what you collect
—
Anything else it takes to deliver the service
—
Total cost of revenue$22,00022.0%
Gross profit$78,00078.0%
Gross margin78.0%
Gross margin78.0%Healthy
Gross profit$78,000per month
Cost of revenue$22,00022.0% of revenue
Where cost of revenue goesShare of total
    Sample numbers. Replace them with yours.
    • Gross profit
    • Cost breakdown
    • SaaS benchmarks
    • No sign-up

    Add this tool to your site

    Paste this code into any page. It stays free and updates automatically.

    How it works

    One revenue line.
    Six costs, one margin.

    1. 01

      Pick a period

      Choose month, quarter or year, and use the same period for every line.

    2. 02

      Enter revenue

      Recognised revenue for the period, from subscriptions and any services you sell.

    3. 03

      Add cost of revenue by line

      Hosting, third-party software, support, onboarding and payment fees. Enter 0 for anything that doesn't apply.

    4. 04

      Read the report

      Gross profit, gross margin against SaaS benchmarks, your largest cost and what it takes to reach 80%.

    The formula

    Gross margin = (Revenue − Cost of revenue) ÷ Revenue × 100

    Example: ($100,000 − $22,000) ÷ $100,000 × 100 = 78.0%. Gross profit is $78,000, and hosting is the largest cost at $9,000, 41% of cost of revenue.

    SaaS gross margin benchmarks

    Gross marginWhat it usually means
    80% and aboveStrong. Common for self-serve products with light support needs.
    70% to 80%Healthy. The usual range for SaaS businesses.
    60% to 70%Below target. Often heavy hosting, data or support costs.
    Below 60%Low. Looks more like services than software; check what sits in cost of revenue.

    What SaaS gross margin measures

    Gross margin is the share of revenue left after paying the costs of delivering your product. In SaaS those costs are mostly hosting, the software you build on, and the people who keep customers running: support and onboarding. Whatever is left is gross profit, and it pays for everything else, from sales and marketing to product development and overheads.

    It is one of the first numbers investors and buyers look at, because it shows how much of each new sale the business actually keeps. Two companies with the same revenue can be worth very different amounts if one keeps 80% and the other keeps 55%.

    How to calculate gross margin

    Gross margin = (Revenue − Cost of revenue) ÷ Revenue × 100.

    1. Take revenue for one period, a month, quarter or year. Use recognised revenue, not cash collected.
    2. Add up cost of revenue for the same period, line by line.
    3. Subtract cost of revenue from revenue to get gross profit.
    4. Divide gross profit by revenue and multiply by 100.

    Keep every line in the same period. Mixing annual hosting bills with monthly revenue is the most common way to get a wrong answer.

    What belongs in cost of revenue

    Cost of revenue (often called COGS) covers the costs that rise as you serve more customers. For most SaaS companies that means:

    • Hosting and infrastructure: servers, databases, storage, bandwidth and monitoring for the live product.
    • Third-party software built into the product, such as licensed APIs, email sending or mapping services.
    • Customer support: support team pay and help desk tools.
    • Onboarding and implementation: setup, data migration and training for new customers.
    • Payment processing: card and billing fees. Some companies book these as general expenses instead; pick one approach and stick to it.

    What does not belong: sales and marketing, research and development, and general and administrative costs. Engineers building new features sit in R&D, even if some of their time goes on keeping the platform running. Splitting that time honestly is better than leaving it all out.

    A worked example

    A SaaS company brings in $100,000 of revenue in a month. Its cost of revenue looks like this:

    • Hosting and infrastructure: $9,000
    • Third-party software: $3,000
    • Customer support: $5,500
    • Onboarding and implementation: $2,500
    • Payment processing: $2,000

    Total cost of revenue is $22,000, so gross profit is $78,000 and gross margin is ($100,000 − $22,000) ÷ $100,000 × 100 = 78.0%. Every $1 of revenue leaves $0.78 to fund the rest of the business.

    Hosting is the largest line at $9,000, 41% of cost of revenue and 9.0% of revenue. Cutting it by 20% would lift gross margin to 79.8%. To reach 80%, the company would need to bring cost of revenue down by $2,000 to $20,000, or grow revenue to $110,000 without adding cost.

    Gross margin benchmarks for SaaS

    Software usually runs higher margins than most businesses, because serving one more customer costs little. As a rough guide:

    • 80% and above is strong, and common for self-serve products with light support needs.
    • 70% to 80% is the usual range for SaaS.
    • 60% to 70% is below target. Heavy hosting, data or support costs are the usual reasons.
    • Below 60% looks more like a services or hardware business than software.

    It depends on the model. Products that process a lot of data, run AI workloads or include a large services component often sit lower, and early-stage companies can carry setup costs that fall away with scale. Compare yourself with businesses that sell the same way you do, and watch the trend over time more than any single number.

    How to improve gross margin

    Start with the largest line, because a small percentage cut there moves the margin most.

    • Right-size infrastructure. Remove idle resources, commit to reserved capacity once usage is stable, and review data storage you no longer need.
    • Renegotiate third-party contracts as volume grows, or replace tools that cost more than they earn.
    • Scale support without headcount: better help content, in-product guides and fixing the issues that create the most tickets.
    • Standardise onboarding with templates and self-serve setup, or charge for implementation work that is genuinely custom.
    • Raise prices or package better. Revenue sits in the divisor too, so a price rise on the same cost base lifts margin directly.

    Gross margin feeds straight into customer lifetime value, so try the SaaS LTV Calculator next. Check whether growth and profit together clear the bar with the Rule of 40 Calculator, or see your main numbers side by side in the SaaS Metrics Calculator. If revenue growth is the lever you need, see our services.

    FAQ

    Questions,
    answered.

    The share of revenue left after paying the costs of delivering your software: hosting, third-party software, support, onboarding and payment fees. It shows how much of each sale is left to fund sales, product and overheads.

    Subtract cost of revenue from revenue, divide by revenue and multiply by 100. With $100,000 of revenue and $22,000 of cost of revenue, gross margin is ($100,000 − $22,000) ÷ $100,000 × 100 = 78.0%.

    Most SaaS businesses land between 70% and 80%, and 80% or more is strong. Between 60% and 70% is below target, and below 60% looks more like a services business. It depends on the model: data-heavy, AI-heavy or services-heavy products often run lower.

    Costs that grow as you serve more customers: hosting and infrastructure, third-party software built into the product, customer support, onboarding and implementation, and usually payment processing. Sales and marketing, R&D and general admin costs do not belong there.

    Yes, in most cases. Support and onboarding are part of delivering the service, so they belong in cost of revenue. Leaving them out flatters the margin and makes it harder to compare with other SaaS companies.

    Gross profit is an amount: revenue minus cost of revenue, $78,000 in the sample numbers. Gross margin is that amount as a share of revenue, 78.0%. The margin is easier to compare across periods and companies.

    Gross margin only subtracts the cost of delivering the product. Operating margin also subtracts sales and marketing, R&D and general admin costs, so it is always lower. A business can have a strong gross margin and still lose money at the operating level.

    Start with the largest line in cost of revenue, which this calculator flags. Right-size hosting, renegotiate third-party contracts, reduce support tickets with better help content, standardise onboarding, and review pricing. In the sample numbers, cutting hosting by 20% lifts margin from 78.0% to 79.8%.

    Your numbers stay in your browser. They are saved on your device so they are there next time, and added to the page link so you can share a result. Nothing is sent to a server.

    Done-for-you

    A healthy margin needs revenue to work on.

    We help B2B SaaS teams win customers from outbound, search and AI recommendations, so every point of margin counts for more.