What counts as COGS for a SaaS company?
A practical list of what belongs in SaaS cost of goods sold — hosting, AI APIs, payment fees, support — what doesn't, and how to treat staging, credits and tools.
October 3, 2026 · 1 min read
Cost of goods sold (COGS) is the cost of delivering your product to the customers you already have. Get it wrong and gross margin stops meaning anything.
The test
Ask: would this cost go away if we had zero customers but kept building the product? If yes, it's probably COGS. If you'd still pay it, it's probably an operating expense.
Usually COGS
- Production hosting: compute, databases, object storage, CDN and bandwidth.
- AI inference and other per-request APIs used by the product.
- Payment processing and billing fees.
- Third-party services embedded in the product: email delivery, SMS, auth, search, maps.
- Production monitoring and logging.
- Customer support and success for existing customers.
Usually not COGS
- Staging, preview and development environments.
- Internal tools (CRM, analytics, design, docs).
- R&D experiments — an OpenAI project for prompt research, a GPU box for model evaluation.
- Sales and marketing, including free-trial infrastructure if you track CAC carefully.
Grey areas
- Cloud credits. They reduce your bill today but expire. Report margin without them so it doesn't collapse when credits run out.
- Shared accounts. If one AWS account hosts both production and staging, split by tags or accounts where possible; otherwise estimate and label the estimate.
- Annual tool invoices. Spread them across the months they cover.
In MarginMeter, classification rules move a staging account or an R&D project out of COGS without editing data, and manual costs carry a class of COGS, OpEx or excluded.
Frequently asked questions
Are payment processing fees COGS?
Yes, for most SaaS businesses. Fees are incurred for every sale and scale with revenue, so they belong in the cost of delivering the product.
Is customer support COGS?
Support for existing customers is commonly treated as COGS by mature SaaS companies. Pre-sales support and onboarding for prospects is sales cost. Whatever you choose, apply it consistently.
Are staging and development environments COGS?
No. They support building the product, not delivering it to customers. Treat them as R&D or operating expense.
Related
- How to calculate SaaS gross margin (with a worked example)The SaaS gross margin formula, what belongs in COGS, a worked example with AI and cloud costs, and the mistakes that make margin look better than it is.
- AI SaaS gross margins: what to expect and how to improve themWhy AI products often run lower gross margins than classic SaaS, which costs drive the gap, and practical levers — model mix, caching, pricing — to improve margin.
- How to price an AI SaaS product without losing moneyPrice AI features from cost per user and target margin: estimate inference cost, add payment fees, choose a margin, and protect yourself from heavy users.
- How to calculate LLM cost per userCalculate LLM API cost per request and per user from tokens, model prices, caching and usage — with a worked example and the mistakes that underestimate cost.
See your real margin in five minutes.
Connect Stripe and your cost providers with read-only access. Free for two connections — no card required.