The formula, the lines that belong in COGS, and one illustrative month at one subscription and at ten.
On this page
The short answer
SaaS gross margin is revenue minus the cost to serve, divided by revenue. Put hosting, payment fees, customer support, and API calls that run for a customer in that cost. Leave product building, ads, and company software out. On the illustrative month, one $35 subscription with a $2.43 fee and a $25 hosting plan is 21.63%, and ten of those subscriptions on the same hosting plan are 85.91%.
Gross margin is one of the five lines on SaaS metrics, next to MRR, churn, CAC payback, and burn.
The formula
SaaS gross margin is (revenue minus COGS) divided by revenue. COGS is the cost of goods sold: what it costs to serve the customers you already have. Write the result as a percent.
Pick this formula if you need the share of revenue left after the cost to serve. Pick a profit margin that also subtracts salaries, ads, and rent if you need what the whole company kept.
Revenue on this page is the monthly price of the subscriptions in the example. It is not cash collected, and it is not a fee netted out. The fee is a COGS line, not a smaller revenue line. Ending MRR on the metrics page is a different sheet.
| Step | One subscription | Ten subscriptions |
|---|---|---|
| Revenue | $35.00 | $350.00 |
| COGS | $27.43 | $49.30 |
| Gross profit | $35.00 − $27.43 = $7.57 | $350.00 − $49.30 = $300.70 |
| SaaS gross margin | $7.57 / $35.00 = 21.63% | $300.70 / $350.00 = 85.91% |
$7.57 divided by $35.00 is 0.2162857…, which rounds to 21.63%. $300.70 divided by $350.00 is 0.8591428…, which rounds to 85.91%. The rows under the formula are where those two COGS figures come from.
What goes in COGS
Put a cost in COGS if the current customers would lose the product, or get a worse one, when you stop paying it.
SaaS Capital’s COGS page, dated October 3, 2024 and read again on November 11, 2026, says GAAP does not draw this line for you. Their list, for private SaaS license revenue, is:
- Hosting, such as the servers the app runs on
- The people who keep that production environment running
- Customer support and customer success aimed at retention, satisfaction, and usage
- Third-party software or data that is included in the product you deliver
- Other direct employee cost required to keep delivering the service
Their test is practical. If you stopped paying the line, provisioning for the customers you already have would stop or get worse quickly. They also say gross margins on SaaS license revenue in their portfolio and survey data are generally 80% to 85%. That band is theirs. The 21.63% and the 85.91% below are this example.
Too wide
The whole company
Ads, product salaries, and the tools you bought to run the business are not the cost of serving one more customer.
COGS
What the current customer consumes
- hosting
- payment fees
- support
- customer API calls
What stays out
Leave a cost out of COGS when you could cut it and the customers you already have would still get the product.
SaaS Capital names four lines they see inside COGS and do not want there: sales commissions, amortized software development costs, product management, and customer success whose job is cross-sell or upsell. A team aimed at renewal, bookings, or persuading a decision sits in operating expense. A team aimed at retention and satisfaction sits in COGS. The same person can do both. Split the cost if you can. If you cannot, do not pretend a whole salary is COGS because some of the week is support.
Ads stay out. They buy the next customer. They do not serve the ones you have. The same dollars are the numerator in CAC payback, on a different sheet.
The software you use to run the company stays out. An accounting login, a design tool, and a notes app are not inside the product the customer gets.
Worked example
Pebble Desk is fictional. The counts are example inputs, not a census. Nothing here was exported from a store, a bank, or a hosting invoice. Do not add Pebble Desk to Cedar Desk, Harbor Notes, Lumen Inbox, Sample Till, Sample Desk, or Sample Ledger.
The price is the $35 US-card subscription from Lemon Squeezy fees. The pricing page still shows 5% + 50¢ per transaction, and the fee docs still add 0.5% on a subscription. Both were read on November 11, 2026, and again on November 16, 2026. No tax is added to the order. A month of that fee, next to Stripe, Paddle, Dodo Payments, and Creem, is the payment fee calculator. Lemon Squeezy stops processing on March 31, 2027, which is written up in Lemon Squeezy vs Stripe. 5% of $35 is $1.75. 0.5% of $35 is $0.175. Add $0.50 and the fee is $2.425, which rounds to $2.43. That is the same rounding the fees post published. Lemon Squeezy does not publish its rounding rule, so a real payout can differ by a cent.
The hosting line is Supabase Pro for one Micro project, inside the included quotas, before usage past those quotas. The pricing page, read November 11, 2026, says that shape costs $25 a month, and that Pro is charged up front. The same $25 is the Supabase Pro price in Supabase vs Firebase. This sheet holds the plan fixed at both sizes. It does not add disk, egress, or a second project. A web host on top of that database is not in the sheet either.
Support is $0.00 because the example has no support invoice. API calls are $0.00 because no token count was measured. Those zeros are empty inputs.
| Line | Arithmetic | One | Ten |
|---|---|---|---|
| Revenue | Subscriptions times $35 | $35.00 | $350.00 |
| Payment fees | Subscriptions times $2.43 | $2.43 | $24.30 |
| Hosting | Supabase Pro, one Micro project | $25.00 | $25.00 |
| Support | No invoice in the example | $0.00 | $0.00 |
| API calls | No token count measured | $0.00 | $0.00 |
| COGS | Fees plus hosting | $27.43 | $49.30 |
| Gross profit | Revenue minus COGS | $7.57 | $300.70 |
| Gross margin | Gross profit divided by revenue | 21.63% | 85.91% |
Ten times the already-rounded $2.43 is $24.30. Ten times the unrounded $2.425 is $24.25. This sheet multiplies the published $2.43. A payout that rounds once on a different total can differ.
- Hosting for the app the customer uses
- The payment fee on that customer’s sale
- Support you pay so current customers can keep using it
- An API call that runs because that customer used the product
- Not ads, not product salaries, not sales commissions, not a tool that only you log in to
Download the COGS checklist (CSV)
The same rows are on Templates.
Where margin hides (AI API costs, payment fees)
The hosting bill in this example does not move when you go from one subscription to ten. The payment fee does. $2.43 becomes $24.30. That is why a single $35 sale looks like a 21.63% margin and ten sales on the same plan look like 85.91%. The plan price is the same $25. The fee scales with the sales.
A definition that leaves the fee out of COGS would call the one-subscription cost $25.00, the gross profit $10.00, and the margin $10.00 / $35.00, which is 28.57%. Ten subscriptions would be ($350.00 − $25.00) / $350.00, which is 92.86%. Same app, fee moved below the line. Say which reading you are using.
An LLM API bill hides in the same place when the call is part of serving the customer. SaaS Capital’s third-party line covers software or data included in the product. A bill for your own experiments, or for writing the code, does not. This month has no API invoice, so the line stays $0.00. Do not drop a guessed token count into the 21.63% or the 85.91%.
Usage past Supabase’s included quotas hides the same way. The $25 is the plan before that usage. This sheet does not price the overage, because this example has no usage report.
How margin feeds CAC payback and valuation
CAC payback on this site divides acquisition spend by new MRR times gross margin. A smaller margin makes the denominator smaller, so the same spend takes more months. The form is the CAC payback calculator.
The CAC payback guide uses its own sample: $6,000 of spend, $1,000 of new MRR, and an 80% margin. $1,000 times 0.80 is $800, and $6,000 divided by $800 is 7.5 months. Those figures belong to that sample. This page does not recompute them with 21.63% or with 85.91%. Pebble Desk’s margin is not Sample Till’s margin. The same margin, next to a price, a churn rate, and a CAC, is the unit economics calculator.
CAC payback calculator Spend divided by new MRR times gross margin. The fields open on the guide's 7.5 month sample, which is not Pebble Desk. Free toolThe SaaS valuation calculator leaves its multiple alone from 80% through 85%, the band SaaS Capital states, and moves the multiple outside that band by a rule this site wrote. Both illustrative margins sit outside that band. 21.63% is below 80%. 85.91% is above 85%. This page does not run the rule on Pebble Desk. Growth, NRR, churn, and ARR are not on this sheet, and a margin step alone is not a price a buyer will pay. The dated ranges, with each source and date, are SaaS valuation multiples.
Gross margin is not the profit line in the Rule of 40. That sum uses EBITDA margin or free cash flow margin. The form is the Rule of 40 calculator. Pebble Desk’s 21.63% and 85.91% stay gross margin.
SaaS valuation calculator ARR times a sourced public median, then growth, NRR, churn, and margin. The margin band that adds nothing is 80% to 85%. Free toolWhat we tested
Checked
On November 11, 2026 I re-read Lemon Squeezy’s pricing page and fee docs, Supabase’s pricing page, and SaaS Capital’s October 3, 2024 COGS page. The pricing page still showed 5% + 50¢ per transaction. The fee docs still added 0.5% on a subscription payment, on top of the platform fee. Supabase’s page still priced one Micro project on Pro at $25 a month before usage past the included quotas.
I re-added the fee: 5% of $35 is $1.75, 0.5% of $35 is $0.175, plus $0.50 is $2.425, which rounds to $2.43. One subscription: $2.43 plus $25.00 is $27.43, and $35.00 minus $27.43 is $7.57. Ten: 10 times $2.43 is $24.30, plus $25.00 is $49.30, and $350.00 minus $49.30 is $300.70.
I did not open a Lemon Squeezy store, create a Supabase project, or export a usage report. No customer count was measured. Support and API lines are $0.00 because those invoices are not in the example. The 80% to 85% band is SaaS Capital’s statement, not a margin I measured.
FAQ
Are payment fees COGS?
SaaS Capital’s COGS page, dated October 3, 2024 and read again on November 11, 2026, does not name payment fees. It names hosting, the people who keep production running, support aimed at retention, and third-party software inside the product. This page puts the Lemon Squeezy fee in the illustrative COGS, because that fee leaves on each sale. A SaaS gross margin that follows only the named lines can leave the fee out. The two readings are not the same margin.
Is support COGS?
On that same page, support and success aimed at retention, satisfaction, and usage go in COGS. A team aimed at renewal, bookings, or upsell stays in operating expense. The illustrative month has no support invoice, so the support line is $0.00. That zero is an empty input, not a claim that support is free.
Do LLM API costs count?
Count them when the call runs because the customer used the product. SaaS Capital’s list includes third-party software or data included in the delivered product. An API bill for building the product, or for your own experiments, stays out. This illustrative month has no API invoice, because no token count was measured.
Sources
- Pricing (Lemon Squeezy) Checked
- Fees (Lemon Squeezy docs) Checked
- Pricing (Supabase) Checked
- What Should be Included in COGS for My SaaS Business (SaaS Capital) Checked