# SaaS COGS: What to Include, Exclude & Where AI Fits

Woosung Chun is the CFO of DualEntry with experience in corporate finance, accounting, strategy, and acquisitions. He previously grew from scratch and led the M&A and Finance teams at Benitago, where he completed more than 12 acquisitions in 2 years. He graduated with a BS from NYU Stern. At DualEntry, Woosung writes about AI in accounting, revenue recognition, foreign currency accounting, hedge accounting, and ERP modernization for finance teams navigating complex, multi-entity environments.

Learn about our [editorial policies](/content/legal/editorial-guidelines/index.html).

Last updated

November 6, 2026

Reviewed by

Do San (Justin) Myung

Justin (Do San Myung) is Expert Accountant at DualEntry with 20+ years of hands-on experience managing general ledgers, financial close processes, and ERP implementations for mid-market and enterprise companies. As a former Consulting CFO and Controller, he has personally overseen month-end closes, SOX compliance programs, and multi-entity consolidations across technology, manufacturing, and services industries. Justin specializes in transforming manual accounting workflows into automated, AI-driven processes.

.webp)

COGS is one piece of the broader [SaaS accounting](/content/blog/saas-accounting/index.html) picture, and in SaaS it comprises hosting, DevOps personnel, customer support, retention-focused customer success, and embedded third-party software. GAAP does not prescribe a standard COGS definition for SaaS companies, so consistent classification against market convention is what makes gross margin comparable. Setting those classifications up once in [accounting software for SaaS](/content/saas/index.html) keeps COGS consistent from month to month.

Everything comes back to one question: would service to your existing customers degrade if this spend stopped? If yes, it’s a COGS candidate. If the spend chases future customers or future product, it isn’t.

## What’s included in SaaS COGS?

The six line items included in SaaS COGS are hosting and infrastructure, DevOps and production engineering, customer support, retention-focused customer success, embedded third-party software, and professional services.

For each line, fully burden the cost – count the whole team, not just their salaries. That means wages plus payroll taxes, benefits, and the tools they use, all charged back to that team’s budget. Professional services should sit as its own revenue stream with its own COGS. It shouldn’t be blended into subscription margin.

### SaaS COGS line items at a glance

| Line item | Examples | Behavior | Why it's COGS |
| --- | --- | --- | --- |
| Cloud infrastructure and hosting costs | AWS, Azure, GCP, CDN, monitoring | Variable | Product goes down without it |
| DevOps / production engineering | SRE, release mgmt, infra engineers | Semi-fixed | Keeps the production instance running |
| Customer support | Tier 1-3 support, ticketing tools | Semi-variable | Servicing live accounts |
| Customer success (retention) | CSMs comped on [GRR](/content/blog/gross-revenue-retention-grr/index.html), onboarding | Semi-variable | Delivery and retention; not selling |
| Embedded third-party software | APIs, data feeds, licensed components | Variable | Ships inside the delivered product |
| Professional services | Implementation, config, training | Variable | Separate stream, separate margin |

## What stays out: COGS vs OpEx

Customer success is included in COGS when the work involves retention, onboarding, and adoption. If CSMs carry an expansion quota or are comped on upsell ARR, that portion moves to Sales & Marketing OpEx. The underlying rule is that if an expense acquires future revenue or builds future product, it’s OpEx.

COGS carries only the cost of serving your current customers. Sales commissions, product management, and marketing all chase future revenue or future product – so they’re all excluded from COGS.

Sales commissions are a special case worth noting. ASC 340-40 requires capitalization of incremental costs of obtaining a contract, such as sales commissions. So, rather than expensing them upfront, you capitalize and amortize them over the life of the customer.

### The 5-question classification test

| # | Question | If yes, then… | If no, then… |
| --- | --- | --- | --- |
| 1 | Would service to existing customers get worse if the spend stopped? | COGS candidate | OpEx |
| 2 | Is the person's primary goal retention/delivery (not bookings)? | COGS | S&M OpEx |
| 3 | Is the third-party tool embedded in what customers use? | COGS | OpEx (internal tooling) |
| 4 | Does the cost scale with usage or customer count? | Supports COGS | Revisit question 1 |
| 5 | Is it building future product or future revenue? | OpEx (R&D / S&M) | COGS candidate |

## How to calculate SaaS COGS – and what good gross margin looks like

What’s a good gross margin for SaaS? 75-80%+ blended is the target. Median subscription gross margin equals ~81% for private B2B SaaS.

Take that $15M ARR scale-up. Hosting and infrastructure come to $1.4M, DevOps $700K, support $500K, and retention CS $400K. That’s $3M of subscription COGS, for a subscription gross margin of 80%.

Now, bring in a services line. Say implementation adds $2M of revenue at $1.4M of cost. Blend that with the subscription side and your overall gross margin slips to around 74%. This is why it’s important to report margin by stream.

## Gross margin benchmarks by revenue stream

| Stream | Median GM | Top quartile | Source |
| --- | --- | --- | --- |
| Blended / total revenue | 77% | 80%+ | Benchmarkit 2025 (private B2B SaaS) |
| Subscription / recurring revenue | 81% | 85-90% | Benchmarkit 2025; SaaS Capital portfolio 80-85% |
| Professional services | 30% | 35-40% | Benchmarkit 2025 |
| AI-heavy products | ~52% expected (2026) | 25-60% by archetype | ICONIQ State of AI 2026 |

## Where AI costs land in COGS

AI costs that scale with customer usage (e.g. inference, per-call API fees, serving infrastructure) are COGS. Costs that build the model itself, like foundation training and generic fine-tuning, are R&D. AI inference costs are classified as COGS because they scale with product usage. Model training and fine-tuning costs are classified as R&D OpEx, unless performed per-customer as a delivery obligation.

### AI costs: COGS or not?

| AI cost | Classification | Explanation |
| --- | --- | --- |
| LLM API / inference fees (OpenAI, Anthropic, Bedrock) | COGS | Scales with product usage; equivalent to hosting |
| Reserved GPU capacity for serving | COGS | Production delivery infrastructure |
| Vector DB / embeddings / RAG infrastructure | COGS | Runs the live product |
| Human-in-the-loop review of AI output | COGS | Direct cost of delivering accurate service |
| Foundation model training / platform fine-tuning | R&D OpEx | Builds future product, not current delivery |
| Customer-specific fine-tuning promised in contract | COGS (services) | Contractual delivery obligation |
| AI coding assistants, internal AI tooling | OpEx (department) | Internal productivity, not product delivery |

## COGS discipline by stage

How carefully you need to track COGS depends on your stage. At seed, a single ‘hosting’ line is forgivable. But using the same shortcut when you’re heading for an exit will cost you real money on your valuation.

The stakes are measurable. SEG’s data shows the above-80% gross margin cohort trading at roughly a 105% premium to the SEG SaaS Index median.

### What changes at each growth phase

| Stage | Acceptable state | Must fix before next stage |
| --- | --- | --- |
| Seed to Series A | Single hosting line; support inside a blended payroll account | Separate COGS departments; stop letting G&A absorb them |
| Series B-D | Departmentalized, fully burdened COGS; monthly reclass review; margin by stream | Usage/AI cost metering; ASC 340-40 commission capitalization |
| Exit or IPO-ready | Defensible, consistent policy; subscription vs. services vs. usage margins; audit trail on allocations | Nothing. This is the diligence standard buyers test line-by-line |

## Putting COGS to work in your GL

A COGS policy only survives if your ledger enforces it. Use department or dimension coding on one clean set of accounts, rather than duplicating accounts for every team. This keeps your chart of accounts readable as you grow and makes margin-by-stream reporting possible.

There are two ways to organize COGS in your [SaaS chart of accounts](/content/blog/saas-chart-of-accounts/index.html). The first is the dimension-based approach: one clean “Hosting” account, with a department tag that shows which team the cost belongs to. The second is inline duplicated accounts, where you create a separate account for each team (Hosting for Support, Hosting for Success, etc).

The dimension-based route works best for most companies. Duplicating accounts causes your chart of accounts to inflate, and it quickly gets complicated once you start consolidating multiple entities or reporting margin by stream.

Burdening takes just one journal entry a month: apply an overhead rate to each department’s salaries – say 22% for taxes, benefits, and tools – and post it.

## Final thoughts

How you classify your costs is what sets your valuation. Every COGS line you book hinges on the same test: asking if you stopped that spend, would the service your current customers rely on get worse.

## SaaS COGS FAQs

### Is customer success included in SaaS COGS?

It depends on what the role actually involves. A CSM who owns renewals, onboarding, and product adoption is COGS (because those tasks are about service delivery). The common mistake is leaving 100% of a hybrid CSM's comp in COGS even after they start carrying an expansion quota. Instead, split it: retention-tied pay stays in COGS, and the expansion-quota portion moves to Sales & Marketing OpEx.

### Are software engineers part of SaaS COGS?

Only engineers who keep the production environment running (DevOps, SRE, infrastructure). Engineers building new features are R&D and stay in OpEx.

### What percentage of revenue should SaaS COGS be?

There's no single target as it depends what's blended in. Subscription-only COGS typically runs 15-25% of revenue, in line with the ~81% median gross margin. What matters more than the number itself is the trend: COGS should shrink as a share of revenue as you scale, not grow with it.

### Do AI and LLM API costs belong in COGS?

Yes: inference, vector database, and GPU costs scale with usage, just like hosting. Model training and platform-wide fine-tuning, meanwhile, belong in R&D.

### Are payment processing fees COGS?

Generally, yes for transaction-based revenue. Stripe/PayPal fees scale directly with revenue delivered. Some companies choose to net them against revenue. The best approach is to pick one treatment and apply it consistently.
