← Back to all articles
·By ·Updated

SaaS Gross Margin: Formula, COGS, and Benchmarks

Calculate SaaS gross margin with a free Excel sheet, work through a $10,000 month, and compare your result with benchmarks by company size and revenue type.

SaaS COGSSaaS gross marginSaaS benchmarksSaaS profit margin

SaaS gross margin is the percentage of revenue left after you pay to deliver the software. In a month with $10,000 in earned revenue and $2,500 in delivery costs, gross profit is $7,500 and gross margin is 75%.

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

Download the free SaaS gross margin worksheet (Excel). It includes the worked month, a second month with higher AI and hosting costs, and a blank column for your business.

For a size-matched reference, Pavilion and Benchmarkit's 2025 report put median total gross margin at 70% for survey respondents below $1 million in annual recurring revenue (ARR). The same report's 81% median covers subscription revenue across company sizes. Pick the figure that matches what you sell and which costs you include. 2025 SaaS Performance Benchmarks, pp. 41 and 45

The example uses fictional USD records for a SaaS that drafts client reports. Customers pay monthly or annually. Delivery costs include AI calls, hosting, storage, and support.

How to calculate SaaS gross margin

Use the same month for earned revenue and delivery costs. Accountants call these costs cost of goods sold (COGS) or cost of revenue. Stripe's guide to SaaS gross margin

Gross profit = Revenue − Cost of revenue

In the example, $7,500 ÷ $10,000 × 100 = 75%. If a month has zero revenue, leave gross margin blank and record the delivery costs.

Start with revenue earned in the month

Our example reports revenue as customers receive the service. The founder collects $8,400 from monthly subscriptions and refunds $200 for service in that month.

A new customer also pays $2,400 for a year up front. The plan starts on the first day of the month. Spread the payment evenly across 12 months for this example. The product earns $200 from the new plan this month. Older prepaid plans contribute $1,600 for service delivered during the same month.

Revenue earned this month Amount
Monthly subscriptions $8,400
Refunds on this month's service −$200
This month's share of the new annual plan $200
This month's share of older annual plans $1,600
Revenue for the month $10,000

Customers paid $10,600 this month after refunds and before processor fees. The founder earned $10,000. Customers on older annual plans paid in earlier months and used the product this month. Most of the new annual payment covers service the founder still owes. The worksheet uses equal months for the example. Stripe's revenue recognition reports can allocate amounts at a finer level and show the balance still deferred. Stripe's revenue recognition methodology

Keep the processor payout separate from both numbers. A payout can include payments from several dates. The processor can also deduct fees and refunds before it sends the deposit. Start with the payment and revenue reports so you can see those amounts separately. If you start with an amount that already has fees deducted, a second deduction will understate profit. How to reconcile Stripe payouts with QuickBooks or Xero

If you take the recognized revenue total from a report, check the payment details before you make adjustments. That total may already include refunds and earned amounts from annual plans. The worksheet builds the same figure from the invoice and schedule. Stripe deferred revenue schedule template

What counts as SaaS COGS?

SaaS cost of goods sold (COGS) covers the costs of delivering the software and supporting customers who use it. For a small SaaS, that often includes production hosting, database and storage charges, AI calls that serve live customers, and paid support time. A flat monthly database plan can still be a delivery cost. HubSpot's 2025 annual filing, for example, lists managed hosting and customer support payroll among its subscription costs. HubSpot 2025 Form 10-K, Cost of Revenue

For an internal margin report, classify a charge by what it pays for. Live AI calls that generate customer reports go into COGS. Calls that test a new model for an unreleased feature go into development. One vendor can bill you for both. Marketing tools and general admin costs usually go into operating expenses. Use your accounting policy when you prepare formal accounts, especially for software development costs and overhead. Ben Murray's breakdown of AI costs in The SaaS CFO

A worked SaaS COGS example

Take the same reporting app with $10,000 of earned revenue. It has two environments, production and development. The founder starts with the month's hosting invoice, AI invoice, storage invoice, contractor invoice, and fee report. These are fictional billing records in USD. The founder includes processing fees in delivery costs for this example.

Billing record Total SaaS COGS Development expense
Hosting invoice, including $200 in shared compute $900 $650 $250
AI API invoice $1,500 $1,200 $300
Production file storage and delivery $150 $150 $0
Contractor invoice for support and feature work $400 $250 $150
Payment processing fee report $250 $250 $0
Total across these records $3,200 $2,500 $700

The hosting invoice already identifies $500 for production and $200 for development. The remaining $200 covers a shared compute pool. Its usage export shows 4,500 CPU minutes for production and 1,500 for development at the same rate. Production accounts for 4,500 ÷ 6,000, or 75% of that pool, so it takes $150 of the charge. Development takes the other $50. The two hosting subtotals are $500 + $150 = $650 for production and $200 + $50 = $250 for development.

Example $200 shared compute charge. Production used 4,500 of 6,000 CPU minutes, so $150 goes to COGS. Development used 1,500 minutes, so $50 goes to development expense.

The CPU-minute split works here because it reflects how the shared charge arises. For shared storage, stored gigabyte-months could be a better basis. Use project or environment labels for charges you can assign directly. Document how you split a shared line, and keep any amount you still can't assign visible in the monthly worksheet. That makes it easier to check the invoice total and revisit the split next month. FinOps Foundation guide to cost allocation · How to track Vercel costs per project

For the AI invoice, the cost export shows $1,200 for the production project and $300 for development. Match the service dates to the invoice. Check credits, flat fees, and unassigned charges if the export total differs from the bill. Use dollar costs when models have different prices per token. OpenAI's guidance on exporting monthly API costs

The contractor's timesheet shows five hours of support and three hours of feature work at $50 an hour. That gives you $250 for support and $150 for development. Across all five records, $2,500 in COGS plus $700 in development ties to the $3,200 you started with.

Subtract $2,500 from the $10,000 in earned revenue. That leaves $7,500 of gross profit, or 75% gross margin. COGS accounts for the other 25% of revenue. If you put all $3,200 under COGS, the report shows 68% gross margin. The seven-point gap comes from the $700 of development expense. Save the split with your invoices so you can tell a reporting change from a real increase in delivery costs.

While the hosting usage report is pending, the other lines give you $2,350 in COGS. If all $200 ends up in production, margin is 74.5%. If it all goes to development, margin is 76.5%. Treat the range as provisional until you have the split.

Gross margin, operating margin, and net margin

The founder spent $2,200 on development in total. That includes the $700 already listed in the invoice split and another $1,500 of engineering work. Add $800 for marketing and $500 for administration to get $3,500 in operating expenses. Subtract that from $7,500 of gross profit and the business has $4,000 in operating profit. Operating margin is $4,000 ÷ $10,000 = 40%.

The example also has $100 of interest expense and $500 of income tax expense for the month. After those amounts, net profit is $3,400. Divide it by $10,000 and the net profit margin is 34%.

Revenue: $10,000. Gross profit: $7,500 (75% margin). Net profit: $3,400 (34% margin).
The same month leaves $7,500 after delivery costs and $3,400 after the rest of the expenses.
What the business earned Calculation Amount Margin
Gross profit $10,000 revenue − $2,500 delivery costs $7,500 75%
Operating profit $7,500 gross profit − $3,500 operating expenses $4,000 40%
Net profit $4,000 operating profit − $100 interest − $500 income tax $3,400 34%

Gross margin shows how much revenue you have left after you serve customers. Operating margin accounts for the rest of the day-to-day costs. Net margin also accounts for interest and income tax in this example. If you spend more on ads, operating and net margin can fall while gross margin holds steady. An increase in production AI costs shows up in gross margin as well.

The example treats processing fees as a delivery cost. If you move the $250 to operating expenses, gross margin rises to 77.5%. Operating profit and net profit stay at $4,000 and $3,400. You still spent the same money. This matters when two dashboards show different margins for the same business. Check which expense lines each one subtracts before you compare the percentages.

SaaS gross margin benchmarks by company size

Pavilion and Benchmarkit's 2025 report groups companies by annual recurring revenue (ARR). Its total gross margin includes subscriptions, variable revenue, and professional services. The 25th and 75th percentiles bound the middle half of each group, with the median in between.

Report year ARR cohort 25th percentile Median total gross margin 75th percentile
2025 Below $1 million 50% 70% 81%
2025 $1 million to $5 million 64% 74% 85%
2025 $5 million to $20 million 70% 77% 81%

The under-$1 million group covers a wide range. A solo founder with $30,000 ARR and a team with $950,000 ARR can both fall in that group. The report publishes figures for the whole group, so you can't tell where the solo founder's closest peers sit within it. 2025 SaaS Performance Benchmarks, p. 41

Report year and source Companies counted Median Revenue basis
2025 Pavilion and Benchmarkit 196 total-margin respondents across ARR sizes 77% Total revenue
2025 Pavilion and Benchmarkit 76 subscription-margin respondents across ARR sizes 81% Subscription revenue
2025 Pavilion and Benchmarkit 38 services-margin respondents across ARR sizes 30% Professional services revenue
2026 Benchmarkit B2B SaaS and AI-native report, overall software figure 80% Software revenue

The 2026 public summary gives the overall software figure without a cohort count or an under-$1-million breakout beside it. The 2025 report gives the sizes of the three groups above, and they differ. Treat each figure as a separate comparison. If you charge for implementation or training, track what that service earns and the hours it takes. That lets you compare your software margin and your total margin with figures on the same basis. 2025 SaaS Performance Benchmarks, p. 45 · Benchmarkit's 2026 B2B SaaS and AI-Native Metrics

Which benchmark should a bootstrapped founder use?

Look for companies close to your size with a similar product and billing model. An AI reporting tool and a calendar plugin can have very different delivery costs at the same revenue.

Our reporting SaaS has a 75% gross margin. If its ARR is below $1 million, 75% sits between the 70% median and the 81% upper quartile in the survey. Check the cost split before you draw a conclusion from the gap. If the founder omitted paid support hours, the 75% overstates what the product keeps.

For a separate check on individual costs, SaaS Capital's 2026 survey gives spending figures for private B2B companies. Median hosting spend was 5% of ARR. Median spending on customer support and customer success was 9% of ARR. Use those figures to compare the individual costs as a share of ARR. Each figure comes from a separate distribution of responses, so use the report's numbers one expense at a time. SaaS Capital's 2026 spending benchmarks

For a solo founder, the last few months of the same product are often the closest comparison. Put revenue, hosting, AI usage, and support side by side to find the expense that moved.

What rising AI and hosting bills do to margin

The reporting SaaS earns the same $10,000 of revenue the next month. A few customers start generating much longer reports. Production AI costs rise from $1,200 to $2,400. Production hosting and database costs rise from $650 to $950. The other delivery costs stay the same.

Cost of revenue rises by $1,500 to $4,000, and gross margin falls from 75% to 60%. Each $100 of revenue now leaves $60 for the rest of the business.

What changed Worked month Higher-cost month Effect on gross margin at $10,000 revenue
Production AI $1,200 $2,400 −12 percentage points
Production hosting $650 $950 −3 percentage points
Other delivery costs $650 $650 0 percentage points
Cost of revenue $2,500 $4,000 −15 percentage points
Workbook results for the fictional example. At $10,000 earned revenue in both months, delivery costs rise from $2,500 to $4,000 and gross margin falls from 75% to 60%.
The worksheet calculates both months from the same source rows. The higher-cost month changes production AI and direct production hosting.

With the same $3,500 of operating expenses, operating profit falls from $4,000 to $2,500. Check the AI bill first. It accounts for $1,200 of the $1,500 increase. Use feature or account logs to see whether you served more requests, used more tokens per request, or shifted traffic to a pricier model. The cost export tells you how much was billed to a project. Your own request logs can tell you which feature or customer used it. How to track OpenAI and Anthropic API costs per user

Start with the unit you sell. If customers pay per report, compare what one report earns with what it costs to generate, store, and deliver. If they buy an unlimited subscription, calculate the monthly delivery cost per account. Keep the smallest and largest users in view. The average may look fine while a handful of accounts cost more to serve than they pay.

If production hosting serves two apps, split the bill across products before you run the margin calculation for each one. Give each bill a product and a purpose. Two production apps can both incur delivery costs, even when a single provider invoices them together. How to split shared SaaS costs across products

Test a change against the same month of usage. Try short reports on a cheaper model and check the results. Include the cost of any extra time you spend fixing the output.

Check the plans behind the average

Suppose the founder sees two accounts on the same $40 plan. One costs $8 to serve, and the other costs $32. Together they earn $80 and cost $40, a 50% gross margin. The first account leaves $32 for the rest of the business. The second leaves $8. If a new feature appeals mainly to accounts that generate long reports, the next ten customers could look more like the second account than the first.

Run this check with delivery costs you can trace or allocate. Add a reasonable share of production hosting and support alongside the API charge. If you only have the API cost for each account, use it to compare model usage. Work out the full margin at the product level. You can revisit the split once you have more detail.

The breakdown helps when you change a plan. For longer reports, estimate the extra cost per account before you settle on an allowance. Try that allowance against a month of actual usage and count how many people would reach it. The gross margin sheet shows the effect on the whole product. Use the pricing worksheet to see how a plan change would affect individual accounts. AI SaaS pricing worksheet

Use the editable SaaS gross margin worksheet

Download the Excel worksheet and save a copy for the month you're closing. The first column of figures contains the worked example. The second uses the same inputs apart from production hosting and production AI, with a separate bill total to check the allocation. Enter your figures in the Your month column. The sheet leaves results blank until the inputs they depend on are present. Enter zero when you have confirmed there was no amount for a line. Leave the input blank if you are waiting for a report.

  1. Fill in earned revenue. Use subscription and refund records, the new annual invoice and its term, and the revenue schedule for older plans. The annual line assumes a full first month and an even split. For a different schedule, enter the actual recognized share in the optional row.
  2. Fill in costs. Use the hosting invoice and its usage export, the AI cost export, the contractor's time record, and the fee report. Use one reporting period and currency. The optional bill check compares the five example records with the amounts assigned to delivery and development. If your copy shows a difference, look for a missing or double-counted line before using the margin.
  3. Record the other expenses if you want operating and net profit. The gross margin still works when you leave these rows blank. If you use the workbook to report a different product next month, save each month's source files with its worksheet.

How we checked the worksheet. OpenAI Codex ran the local workbook check on December 2, 2026, using the fictional report figures in this guide. It recalculated both months in LibreOffice Calc and checked that changing production AI and hosting costs updates gross margin. The worksheet shows the inputs, formulas, and results for both months.

For a trend, make one row per month in a separate summary. Keep columns for revenue, delivery costs, gross profit, and gross margin. Add operating expenses and net profit when you have the full set of books for each period. Get the Excel SaaS metrics dashboard

If revenue is in column B and delivery costs are in column C, enter =B2-C2 in D2 for gross profit. Enter =IF(B2>0,D2/B2,"") in E2 and format that cell as a percentage. Copy both formulas down. The second formula leaves the percentage blank when the month's revenue is zero or negative. The gross profit column still shows the result in dollars.

At the end of the month, match your revenue total to the revenue report and your delivery costs to the invoices. If a bill arrives late, mark that cost as pending. A zero can make an incomplete month look like your best one. Check the trend again once you record the bill.

If your figures swing from month to month, try a three-month view. Add up revenue and delivery costs for the three months, then use those totals in the gross margin formula. This weights each month by revenue.

Say the example's third month brings in $2,000 and costs $1,600 to serve. Its gross margin is 20%. The average of the three monthly percentages is about 52%. Across the full period the product earned $22,000 and had $8,100 in delivery costs. That leaves $13,900, or about 63% of revenue. Use 63% if your question is how much of that period's revenue the business kept after delivery costs.

RealMRR can bring revenue and expense data from connected providers into the same workspace and show tracked profit by product. Use those records to check which costs you captured and which are still unassigned. If you compare your gross margin with a report, use a matching revenue figure and check how the report defines cost of revenue. See how RealMRR turns Stripe sales and tracked bills into profit by product

Common questions

Is 70% a good gross margin for a small SaaS?

Seventy percent was the median total gross margin for the under-$1 million ARR group in the 2025 Pavilion and Benchmarkit survey. At $10,000 of revenue, that margin leaves $7,000 for operating expenses, interest, taxes, and profit. Compare those $7,000 with what your business needs to spend each month.

Can SaaS gross margin be negative?

Yes. If you earn $4,000 and spend $5,000 delivering the service, gross profit is negative $1,000 and gross margin is negative 25%. Check that the bills and revenue cover the same period. If they do, check which customers, plans, or features account for the spend.

Should I include unpaid founder time?

Record the expenses you incurred in the main calculation. Say you spend ten unpaid hours on customer support. In a second calculation, multiply those hours by what you'd pay someone to do the work. Record the hours and the rate you assumed. That estimate shows what could happen to margin if you hire support or sell the business.

RealMRR publishes guides on SaaS profit, payment integrations, cloud costs, and bookkeeping workflows.

Built for indie founders

Know your real profit today.

Connect your payment gateway and cloud bills to get verified profit rankings, automated bookkeeping, and zero guesswork.