How to Correctly Calculate your SaaS Gross Profit Margin

calculate saas gross profit

There are many financial metrics that I calculate and review each month, and this includes my SaaS gross margin. Of course, it’s not just your overall gross margin that is important. You must also calculate and understand gross margins for each of your revenue streams.

Depending on your business model, these revenue streams may include only your subscription revenue gross margin and your professional services margin. But with today’s SaaS revenue models, you may also need to calculate your variable revenue and hardware margins.

In this post, I’ll explain how to calculate your SaaS gross margin, recurring revenue margin, and services margin. The same logic applies to your other revenue streams. I’ll also walk you through the gross margin formula and the financial data that you need to correctly calculate your gross margins.

SaaS Gross Margin Definition

Let’s start with your overall SaaS gross margin. Your SaaS gross margin is simply total revenue minus cost of goods sold (COGS). COGS, it’s such an old school term, but this is your bucket of expense that directly supports ALL of your revenue streams. COGS can also be called our cost of revenue.

The gross margin formula below is not unique to SaaS companies. It’s applicable to all companies and must be measured on a monthly basis. I also measure on an trailing three and six months basis to smooth out any fluctuations.

I use gross profit and gross margin interchangeably. Of course, dollar amounts and trends are important. But we are common-sizing our gross profit performance by dividing gross profit or margin by total revenue to put in on a percentage basis.

Of course, in SaaS we like to have our own metrics. Next, I’ll explain the gross margin formula that is unique to SaaS companies.

SaaS Gross Margin Calculation

SaaS Cost of Goods Sold (COGS)

What’s the biggest mistake when calculating your overall gross profit margin? Your classification of SaaS COGS expenses. You must have the correct expenses in the COGS section of your SaaS P&L.

So, what should be included in SaaS COGS?

For pure play SaaS, I include Support, Professional Services, Customer Success (if they don’t sell!), and Dev Ops. I use Dev Ops to house my hosting costs, R&D amortization from capitalized software for sale (if any), royalties, and resold product expense.

SaaS COGS

Of course, what you include in your COGS depends on your business model. If you don’t have services revenue, I would not expect a services department in your cost of revenue. However, if you have transactional revenue, I would expect a transactions expense department to house the hard expenses related to transactions.

Your COGS section is dictated by your revenue streams.

The departments that you do include in COGS should be fully burdened. Fully burdened means that the departments are responsible for every expense that originates from their operational activities.

This includes wages, bonuses, payroll taxes, benefits, travel, training, internal use software, and on. Department leaders must be accountable for every expense under their control. Don’t use G&A (general and administrative) as a dumping ground for expenses.

SaaS Gross Margin Formula

The gross margin formula above works well to calculate our overall margin, but it’s just a little too generic for our use in SaaS.

We must expand our COGS line, aka our cost of revenue, into additional buckets. The buckets can call be called cost centers or departments. As you can see in the formula below, I have expanded COGS into four additional cost centers.

SaaS Gross Margin Formula

Of course, we can still calculate our overall margin, but this formula sets us up to calculate margins by revenue stream. In this example, I assume that our business model includes only subscription revenue and services revenue.

If you also have transactional revenue and/or hardware revenue, I would expect a COGS cost center for transaction and hardware expenses.

Structuring our SaaS P&L with the proper departments (cost centers) prepares us for great financial management and analysis.

Gross Margin Video Tutorial

Check out this quick video to learn about SaaS gross margins.

What About Your Customer Success Department?

Before we move on, we should address your customer success department (CSM). Should the CS department be under sales and marketing in operating expense (OpEx) or under COGS? It’s a hotly debated topic.

I view it this way. If your CSM team is purely focused on retention, then keep it in COGS. They are focused on product adoption.

If your CS team also transacts some business such as seat add-ons and holds a quota, then I place them below the gross margin line in your sales operating expenses.

If they perform both functions, then we must consider an expense allocation between COGS > CS and OpEx > Sales.

Subscription Revenue Gross Margins

Subscription revenue margins follow the same logic as our gross margin formula, but we narrow the scope of our revenue line and COGS expenses.

In place of total revenue, we now use only subscription revenue. We then subtract the expenses from subscription revenue that directly support our subscription revenue.

The departments that directly support subscription revenue include Support, Customer Success (depending on how you classify them), and Dev Ops.

subscription gross margin formula

To be comparable with other companies, you may want to calculate your recurring gross margin with and without R&D amortization (if you capitalize). Some companies capitalize their software development, and some do not. Differences in R&D capitalization policies among SaaS companies can make margin comparisons difficult.

Service Margins

Calculating your service margins follows the same gross margin logic. In the case of service margins, we narrow the scope of the margin formula.

We simply subtract our service expenses from our services revenue. This gross margin logic can also be applied to any other revenue streams on your SaaS P&L. If you also have transactional revenue, for example, you will subtract transaction expense from your transaction revenue.

Calculating your specific revenue stream margins is simply a matter of bucketing the correct revenue and expense. The key to gross margin calculations is the proper set up of your SaaS P&L and coding your expenses to the department level.

services gross margin

The SaaS P&L

The setup of your SaaS P&L is key to proper financial management. It’s the foundation to calculate your gross margins and SaaS metrics. Without a SaaS P&L like the format below, it’s very difficult to manage your SaaS business and calculate the metrics relevant to your business.

With the proper P&L setup, you can see how easy it is to align your revenue streams with the expenses that directly support them.

SaaS P&L

In the revenue section, you must have your revenue segregated by your major revenue streams. For example, subscription, services, variable (usage, transactions, consumption, etc.), managed services, hardware, and other.

Also, be sure that you don’t mix revenue streams. For example, coding service revenue to your subscription revenue line. Do not comingle subscription revenue with variable revenue.

Again, the departments in your COGS should be fully burdened with expenses that originate from these departments.

Why are Gross Margins Important?

It’s important for founders and SaaS teams to understand how and which revenue streams are contributing to their overall SaaS gross margin. The blend between services, recurring, and any other revenue stream is important.

For example, you could have a mediocre 60% SaaS gross margin. This could be caused by low or negative service margins. Meanwhile, your recurring margin is a stellar 90%.

Calculating only your overall gross margin would hide lower than ideal service margins. You’d also miss out on the credit due for great subscription margins.

Margins by revenue category also help budget and planning sessions, so that you can balance resource requests against forecasted margins. It’s hard to make decisions without knowing revenue stream margins and the impact of investments on your business.

What’s a Good SaaS Gross Margin?

There are several reports on the Internet where you can benchmark your performance. You have to be careful, though. Aggregate benchmarks can be dangerous to your SaaS health.

However, gross margin is one metric where you can use an overall benchmark. I like to benchmark by ACV profiles.

In my view, a great overall margin is 80% and above and a subscription gross margin near 90%.

Check out https://saasbenchmarks.ai/ to grab your custom benchmarks.

Action Items

Find your monthly SaaS P&L and try to calculate your overall gross margin and your margins by revenue stream. If that is difficult, you may not have the proper accounting set up for a SaaS P&L. Check out the suggested readings below.

The key to an actionable P&L is your chart of accounts and coding expenses to the department level.

Once you are set up correctly, it’s important to review your margins on a monthly basis and also your margin trend in your financial forecast.

Suggest Reading

Do you review your margins monthly? What other margins do you review? Please let me know in the comments below.

46 Replies to “How to Correctly Calculate your SaaS Gross Profit Margin”

  1. Great article Ben. I’d guess the proper inclusion of R&D amortization from capitalized software is an area where a lot of companies diverge in how they calculate gross margin. In your opinion, what is the right way to calculate that for a SaaS company with several product lines and a significant percentage of R&D expenses in less mature product lines?

    1. Hi Nate,

      Great question. I would calculate both ways (with and without R&D amortization). Internally, it’s good to know both, but if you are comparing against benchmarks, I’d exclude because everyone does R&D capitalization differently.
      I have a monthly P&L where I exclude all depreciation and amortization, so that you can easily see your EBITDA performance. Very focused on the rule of 40 right now.

      R&D expenses should be below gross margin in operating expenses.

      Ben

  2. Could be more specific about CSM teams? Practically all these teams in my experience are trying to upgrade clients. But they also do support functions. We’ve seen some attempts to allocate between the two. They tend to show CSM is more support than upgrade. Since this has such a profound impact on gross margin, it is an important issue in the analysis. Do you have any more specific guidance?

    1. Hi Alex,

      I can see an argument for the CSM team to be located in COGS and OpEx. If the CSM is team is purely focused on retention and post-implementation onboarding, I’d place them in COGS. Inherently, they should be on the lookout for upsell opportunities (leads) which they can pass on to their sales team.

      If they are trying to close upsells, I’d place them in Sales in OpEx. I’m not a big fan of allocations unless it is material.

      Ben

  3. Ben,
    COO Question: What’s your take on the treatment of credit card fees for businesses using CC billing platforms for the majority of their transactions, especially B2C businesses that skew towards monthly billing? Though there’s a GM penalty (as much as 3 points), it’s less of a discretionary financing decision and more of a cost of operations. Curious what you’re seeing and recommending. Thanks.

    1. Hi Sam,

      Great question. I would lean towards COO for B2C credit card transaction fees since that is necessary for the sale. And the expense fluctuates with sales, and typically the expenses in COGS will track with revenue over time.

      Ben

  4. Hey Ben! We’ve got a fairly high touch training and onboarding process for our SaaS product. Would you consider our training team’s costs as part of COGS?

    For Enterprise customers we also do some custom development work during their training and onboarding. Would you consider development costs also be part of COGS?

    Thanks in advance,
    Olivia

    1. Hi Olivia,

      Great questions. Yes, I would consider onboarding/training as part of your COGS expense. For custom development, if you are charging for it, I could see it in COGS as you’d have a revenue stream to offset the expense. If there is no reimbursement, I could see it as part of OpEx.

      Ben

  5. Ben – thank you for this great write-up. Two questions:
    1) To your point about CSMs, if a company has Account Managers that only manage renewals and all expansions are handled by AEs, that would still go under S&M expense and not COGS correct?
    2) How would you treat recurring services revenue? Do you create a 3rd revenue and expense category so it can be its own P&L or do you merge into the one-time service revenue?

    1. Hi Arjun,

      Thanks for the comment and question. Do the account managers receive compensation for renewals? If yes, then code to Sales. If no, that’s a bit trickier b/c AM’s are traditionally sales roles. But then in your case, they are acting more like Customer Success. In that case, I’d code to CSM and in gross margin/COGS.

      If you have recurring services revenue, I would definitely code to a separate GL account. And even call out separately on your P&L. You’ll get more value for that then one-time services.

  6. Hi Ben
    Great articles. One question for you. For mobile app sales, where there’s a yearly upfront payment for the app that’s spread over 12 mths to get the accounting MRR, would you have an opinion as to whether a platform fee (eg Apple’s 30% commission taken at the point of sale) as a one-off COGS (recognised in the month of the sale), or do you think it should be matched to the MRR and spread over the 12 mths also?
    Thanks
    Johnny

    1. Hi Johnny,

      Great question. Under the new accounting rules (ASC 606), you will now need to match the commission expense to the revenue stream. So you’ll need to amortize the commission over the same 12 months of the annual subscription.

      Ben

  7. Good read and well thought out articles. Question for you. Where would engineers that design (put multiple SaaS offers together to “build” a customer solution) be classified ? COGS ? or part of Sales ?? They support or sales teams from customer presentations, solution overview and design work.

    1. Hi Nick,

      Since they are supporting the sales effort, I would keep the expense in Operating Expenses and not COGS. So you are good there structurally on the P&L. But their efforts would be considered Sales. When calculating CAC or cost of acquisition, you might want to allocate a % of the engineering department to CAC.

      Ben

  8. Raman Nagarajan says: Reply

    Thanks for sharing… very clearly written. COO was very interesting though I don’t fully agree.
    When it comes to COGS, one school of thought is to only include “Cost of any third-party software or data that is included in your delivered product” (Source: SaaS Capital) and exclude “Third-party software use in-house for operations, but not packaged in your product” (Source: SaaS Capital)
    Can you please explain the rationale in including Amortization of capitalized software in COGS?

    Thanks

    1. Hi Raman,

      Great question. I need to edit that comment in my post to clarify. I do mean amortization of capitalized software for sale. Not, for example, Cisco telephone software that was purchased, capitalized, and amortized. You are correct in your comment.

      Ben

  9. Hi Ben
    I’m a novice, so please excuse my ignorance.
    We develop a SAAS app (in the school based curriculum space). Would our curriculum development costs (making up the content in the web app) and product development costs (the coding of the web app) fall under COGS?
    Thanks

    1. Hi Dereck,

      Typically, the product development costs are in operating expense (below COGS). I have seen some treat product costs as COGS but that seems to be the minority.

      Ben

  10. Hi Ben,
    Great article. I have a question: we partner with a company to develop an add on online module. In the agreement, we revenue share with them on the sales for the add on module. We also revenue share a portion of our existing software modules sales to their existing customers who bought as a bundle. Where should I categorize the revenue share cost? Thank you!

  11. Hi Ben, would costs related to security and compliance (e.g. SOC2 audit/certification, payment to a security consultant/SISO) be included in COGS or should these be a separate line item in operating expenses?

    1. Hi Graham,

      Thanks for the question. I can definitely see a security consultant being coded to COGS as security is part of customer hosting. For the audit, just depends on how material. Since that is Dev Ops related, I could also see it being coded to COGS.

      Ben

  12. Should we add payment gateway commission to the COGS?

  13. Hi Ben, this post is really helpful. Can you provide some guidance on how development team expenses should be classified? About 25% of our development time is spent maintaining our product, upgrading integrations with third-party tools, and managing our production infrastructure. Should that portion of our development team expenses be allocated to COGS or is it better to allocate the full cost of our development team to Operating Expense?

    1. Hi Lee,

      I’d say development is an area of expense that can be interpreted in different ways. It’s common and expected that part of the development team’s time is to maintain existing products. I have not seen that portion coded to COGS and would still consider that OpEx. Regarding production infrastructure, if you have heads dedicated to Dev Ops, I would code that to COGS.

      Ben

      1. Hi Ben
        Thanks for you effort in clarifying stuff

        So that means you will put all software maintenance cost into R&D (no matter amoritization) and not as part of COGS eventhough some of the development is obligated?
        Included in maintenance cost at us is technical debt, bugfixing, changes due to laws and regulations.
        How about incidents – meaning engineers fix incidents directly in production. Would you consider that as R&D as well?

        Sune

        1. Hi Sune,

          If you capitalize R&D costs, I do put the amortization in COGS under the Dev Ops or COO department. Yes, I consider any new features, technical debt, and bug fixes as an R&D expense in OpEx.

          Ben

  14. For our revenue sharing agreements with our sales partners, is it proper to account gross, where as the revenue is grossed up and the fees to the partners is included in COGS?

    1. Hi Sherri,

      Great question. This gets into principal versus agent accounting and if you should record as gross versus net. Here are some considerations.

      Indicators that an entity controls the specified good or service before it is transferred to customer and is therefore a principal.
      -The entity is primarily responsible for fulfilling the promise to provide the good or service
      -The entity has inventor risk before the specified good or service has been transferred to the customer
      -The entity has discretion in establishing the price of the specified good or service
      -Who bears the risk of the customer does not like the good or service?

  15. Thanks you Ben for this insightful article, you write for people that don’t understand finance so I appreciate that. I have a follow up question to R&D amortization from capitalized software. I understand that is includes expenses during the development of the technology (e.g., developer salaries, testing, design, etc.). My question is though for how long do you amortize this expense for? As you know SaaS tech can sometimes be completely overhauled every 3-4 years or if the infrastructure is sold then it can last longer. So what’s the average amortization period for a SaaS business and does it differ between B2B and B2C SaaS tools? Thanks so much.

    1. Hi Tarik,

      I’d say a three to five year life for software available for sale. But I would consult with your auditors to make sure you are both in agreement.

      Ben

  16. Great articles, glad i found your site. I am probably totally wrong but always thought margins were put in terms of percentages not actual numbers.

    1. Hi David, I am always looking at margins (i.e. gross margin) and gross margin percentages. But, yes, percentage tells the story. With margin dollars, looking at how much drops to EBITDA and what revenue streams are contributing to overall margin and EBITDA.

  17. Hi Ben,

    My company makes enterprise software. I have a question about hosting cost. Right now my company uses Amazon Network Services(AWS) for building our own product platform. The cost is relatively fixed.

    For our clients, if they are small/medium clients, we host them on AWS as well (multi-tenants). For this part of the infra cost, it’s a fixed cost for us for probably thousands of clients. If they are large clients, they normally either have their own server or rent their own cloud services. So the large clients’ infra cost is irrelavent to us.

    My question is:
    The infra cost for AWS for our own products, are they COGS? Or should they be counted as OPEX since they are R&D related.?
    For the infra cost for small/medium clients, they are relatively fixed according to our CTO, they don’t seem to increase with the number of clients, are they also COGS?

    Would like to hear your opinions. Thank you.

    1. Great question. The hosting costs for your small/medium clients should be COGS. The hosting costs for development servers, testing servers, internal servers, etc. should be charged to the department that is generating that cost. In the case of R&D’s use of testing servers, for example, then that should be OpEx in their department.

  18. Hi Ben,

    In my company I have two kind of SaaS business (B2B); 1- Saas for companies and 2- Saas for corporates.
    Two questions:
    1- To calculate the gross margin I can use this formula GM=MRR- CAC ?
    2- Hoe I can marge the two kinds of business?

    Congrats for yout job!!

    Best Regards!

    1. Hi Carles,

      Either way, I would calculate your gross margin the same way. Total revenue – COGS = Gross Margin. Of course, you revenue streams may be different in each business which may dictate how you calculate your revenue stream gross margins.

      Ben

  19. Hi Ben,

    Thank you for this great post; it’s enormously helpful. My question is: how would you recommend treating implementation and onboarding costs as part of COGS, if you want a clear picture of your gross margin, by customer? For example, let’s say we have a 3-month implementation/onboarding period for a particular customer. We’ll incur all of our implementation and onboarding costs during that 3-month period. But we typically have multi-year contracts (3 years or more) with our customers. Would you recommend amortizing the implementation and onboarding costs for this customer over the 1st year? (In which case, our gross margin would improve over the subsequent years of the customer contract?) Would you amortize these costs over a longer period?

    Thank you!

    1. Hi Sid,

      Yes, implementation and onboarding costs are included in COGS and part of your overall gross margin. I typically do you not look at combined gross margins between services and recurring. I isolate my recurring gross margin and my professional services gross margin. I have not seen any guidance to suggest the amortization of the implementation costs over the contract term. But economically, that is a correct perspective when trying to understand margins at the customer level.

      Ben

  20. Bruce Jackson says: Reply

    Excellent article, Ben. And some great Q&A as well.
    I know you’re focused on SaaS but I wonder if you know of an article like this that’s focused on e-commerce companies. We go round and around on the issues surrounding gross margin definitions in e-commerce. Any ideas?

  21. Helpful article and Q&A good as well. On ‘what is a good gross margin’ I think you have the %s flipped in the table for SaaS CFO. Thanks again.

  22. Hi Ben,
    Thanks for this article. This is my first go to for accounting questions. I’m having trouble determining where I should expense the product managers. Would they go under Research and Development expense or just overhead wages.
    Thanks!

    Brad

    1. Hi Brad,

      Great to hear. I code product managers to R&D in OpEx.

      Ben

  23. Hi Ben,

    If you are a SaaS Business with only annual subscription how do you calculate Gross Margin monthly?

    Do you consider MRR or total revenue on a specific month?
    Thank you

    1. Greetings,

      You have to have rev rec in place. You follow the same process and calculate monthly but if you do not rev rec your annual invoices, you gross margin calculation will be inaccruate.

      Ben

  24. Hi Ben,

    Just came across this article, and then went down the rabbit hole on many of your other articles. Great stuff!

    How do you account for credit card transaction fees and App Store fees for a subscription SaaS business? I’ve heard of these sometimes being included in COGS, but perhaps more often in Operational Expenses. What is your preference?
    Phil

    1. Hi Phil, I post these to Dev Ops in COGS. Ben.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.