What is COGS?
Cost of Goods Sold (COGS) represents the direct costs of producing and delivering your product or service. For SaaS companies, this typically includes hosting, third-party software, and customer support costs.
COGS is subtracted from revenue to calculate gross profit. It excludes operating expenses like sales, marketing, and R&D, which come out of gross profit.
SaaS COGS Components
Cloud infrastructure (AWS, GCP, Azure). Third-party software and APIs integrated into the product. Customer support and success teams directly serving customers. DevOps and site reliability engineering. Payment processing fees.
Why COGS Matters
COGS directly determines your gross margin, which is a key indicator of business model quality. High COGS means low margins and less money for growth. Optimizing COGS improves profitability without cutting investment.
How to Calculate COGS Step by Step
Step 1: List every direct cost of delivering your product. The key question: "Would this cost go away if I had zero customers?" If yes, it's COGS.
For SaaS:
- Cloud hosting (AWS/GCP): $28,000
- Third-party APIs baked into product: $11,000
- Customer support team: $32,000
- DevOps/infrastructure team (portion): $18,000
- Payment processing fees: $9,500
- SaaS COGS: $98,500
For Ecommerce:
- Product/inventory cost: $150,000
- Shipping and freight: $38,000
- Packaging materials: $8,000
- Fulfillment labor: $22,000
- Payment processing: $9,500
- Ecommerce COGS: $227,500
Step 2: Exclude operating expenses. These are NOT COGS:
- Engineering/R&D salaries (except DevOps directly supporting production)
- Sales and marketing
- General and administrative
- Office rent
- Legal and accounting
Step 3: Calculate gross profit.
- Revenue: $500,000
- COGS: $98,500
- Gross Profit: $401,500
- Gross Margin: 80.3%
Step 4: Set up proper cost categorization in your accounting. The biggest challenge with COGS is consistent categorization. Set up your chart of accounts with a clear COGS section from day one. This prevents scrambling to recategorize expenses before an investor meeting or audit.
Common mistakes founders make:
- Putting all engineering salaries in COGS (only infrastructure/DevOps teams belong there)
- Excluding payment processing fees (Stripe's 2.9% is a real cost of delivery)
- Inconsistent categorization month to month (makes trend analysis useless)
- Not tracking COGS per customer (hard but valuable for understanding unit economics)
COGS in Ecommerce
For ecommerce, COGS includes product cost, shipping, packaging, and fulfillment. Margins are much tighter than SaaS, making COGS optimization critical for profitability.
Gross Profit = Revenue - COGS
Gross Margin % = (Revenue - COGS) ÷ Revenue × 100
SaaS COGS breakdown:
- Cloud hosting (AWS): $30,000
- Third-party APIs: $12,000
- Customer success team: $45,000
- DevOps/infrastructure team: $25,000
Total COGS = $112,000
If revenue is $500,000:
Gross Profit = $388,000
Gross Margin = 77.6%