COGS for SaaS: What Counts as Cost of Goods Sold?

Which costs belong in SaaS COGS, a per-customer breakdown, and how it affects your margins.

February 25, 20262 min read364 words

one-line definition

COGS is the direct cost of delivering your product to customers — for SaaS, this means hosting, third-party APIs, payment processing fees, and customer support.

formula: COGS = Hosting + Third-party API costs + Payment processing fees + Customer support costs + Any per-unit delivery cost. Gross Margin = (Revenue − COGS) ÷ Revenue × 100.

tl;dr

Most solo founders ignore COGS because they think "my only cost is $20/month hosting." Then they add an AI feature with OpenAI calls, start paying Stripe 2.9%, and suddenly 35% of revenue goes to delivery costs. Know your COGS before you set your price.

Simple definition

COGS (Cost of Goods Sold) represents every dollar you spend to actually deliver your product to a paying customer. For a physical product, it is materials and manufacturing. For SaaS, it is everything that scales with customers: server costs, third-party API calls, payment processing, and the customer support time needed to keep them running. COGS matters because it determines your gross margin — the money left over to pay for marketing, development, and your salary. A product with 80% gross margin has room to grow. A product with 50% gross margin needs to be very careful about how it acquires customers.

How to calculate it

COGS = Hosting + Third-party APIs + Payment fees + Support costs

Then: Gross Margin = (Revenue − COGS) ÷ Revenue × 100

Break it down per customer to understand unit economics:

Cost itemMonthly amountPer-customer (100 customers)
Hosting (Vercel/Railway)$25$0.25
OpenAI API calls$180$1.80
Stripe fees (2.9% + $0.30 on $29 plan)$114$1.14
Email delivery (Resend)$20$0.20
Total COGS$339$3.39

Revenue: $2,900. COGS: $339. Gross margin: 88.3%. Healthy. But watch what happens if users start making 3x more AI calls.

Example

You build an AI writing assistant at $29/month. At launch, each user averages 200 OpenAI API calls per month, costing you $0.80 in inference. Total COGS per customer: $0.80 (AI) + $0.25 (hosting share) + $1.14 (Stripe) = $2.19. Gross margin: 92.4%. Excellent. Six months later, you add a more powerful model and usage doubles. AI cost per user jumps to $3.20. Total COGS: $4.59. Gross margin drops to 84.2%. Still fine. But your heaviest 10% of users cost you $12 in AI calls alone — their COGS exceeds the subscription price. You add a usage cap at the $29 tier and create a $59 tier with higher limits. Problem solved before it ate your margins.

Related terms

  • Gross Margin
  • Contribution Margin
  • Unit Economics

FAQ

What counts as COGS for a SaaS product?+

Hosting and infrastructure, third-party API costs (OpenAI, Twilio, email delivery), payment processing fees (Stripe's 2.9% + $0.30), and direct customer support. Developer salaries are NOT COGS — they are operating expenses. The rule: if the cost scales with the number of customers or usage, it is probably COGS.

What is a healthy COGS percentage for indie SaaS?+

Keep COGS under 20-25% of revenue, giving you 75-80% gross margin. If you're spending more than 30% on delivery costs, you either have a pricing problem or an architecture problem. AI-heavy products often have higher COGS (30-50%) due to inference costs — price accordingly.

previous

Cohort Analysis: The Trend Hidden in Your Averages

How grouping users by signup date reveals whether your product is improving or degrading.

next

Churn Rate: The Silent SaaS Killer

How to calculate churn rate, what benchmarks look like, and why even small churn compounds into a crisis.

Put this knowledge into practice

Join solo founders building real products from scratch. Showcase your work and get discovered.

Submit your project

Related terms

newsletter

Weekly builds, experiments, and growth playbooks

No fluff. Just things that actually shipped.