Cost of Goods Sold (COGS)
What is Cost of Goods Sold (COGS)?
Cost of goods sold (COGS) is the direct cost of producing the goods or delivering the services a company sells in a period. It is subtracted from revenue to calculate gross profit.
Updated November 2026 · 2 min read
Cost of goods sold (COGS) is what it costs a company to make or deliver the things it actually sold in a period, as opposed to what it spends on selling, administration or R&D. For a manufacturer, it includes materials, production labor and factory overhead. For a software or SaaS company, often called cost of revenue, it includes hosting, third-party software and data embedded in the product, customer support and the staff who keep the service running. Revenue minus COGS is gross profit, a key measure of a business model's economics.
What is included in COGS?
| Business type | Typical COGS |
|---|---|
| Manufacturer | Materials, direct labor, manufacturing overhead. See absorption costing. |
| Retailer | Purchase cost of goods sold, freight in |
| SaaS company | Cloud hosting for the product, third-party APIs and AI model usage, customer support, site reliability staff, amortization of capitalized software |
| Services firm | Labor and costs of delivering client work |
For businesses that hold inventory, COGS is commonly calculated as beginning inventory plus purchases minus ending inventory. Operating expenses, such as sales, marketing, general administration and research and development, are not part of COGS.
Why technology classification matters
For technology companies, classifying cloud costs between COGS and operating expenses directly affects gross margin, which investors watch closely. Cloud spending for production systems serving customers usually belongs in COGS; development, testing and internal tools usually belong in R&D or general expenses. Tagging and allocation make this split possible. See cloud cost allocation.
How to calculate gross margin from COGS
A hypothetical SaaS company has annual revenue of $50 million. Its COGS includes $6 million of production cloud hosting, $2 million of third-party services and AI usage and $4 million of support and operations staff, a total of $12 million. Gross profit is $38 million, a 76% gross margin. If the company launches AI features that add $3 million of model costs without raising prices, COGS rises to $15 million, gross profit falls to $35 million and gross margin falls to 70%.
Common pitfalls
- Leaving all cloud spending in R&D, which overstates gross margin.
- Putting all cloud spending in COGS, which understates it.
- Ignoring the rising share of AI usage costs in COGS.
COGS is central to unit economics and AI unit economics.
This entry is general information, not accounting or tax advice; confirm treatment with your accounting team or auditors.
Frequently asked questions
What is included in COGS for a SaaS company?
For a SaaS company, COGS, often called cost of revenue, typically includes cloud hosting for the product, third-party APIs and AI model usage, customer support, site reliability staff and amortization of capitalized software. Sales, marketing, general administration and research and development are operating expenses, not COGS. Confirm specific classifications with your accounting team or auditors.
How do you calculate gross margin from COGS?
Gross profit equals revenue minus COGS, and gross margin is gross profit divided by revenue. A company with $50 million of revenue and $12 million of COGS has gross profit of $38 million and a 76% gross margin. If new AI features add $3 million of model costs without price increases, gross margin falls to 70%.
Should cloud costs be classified as COGS or operating expenses?
Cloud spending for production systems serving customers usually belongs in COGS, while spending on development, testing and internal tools usually belongs in R&D or general expenses. Leaving all cloud costs in R&D overstates gross margin, and putting all of them in COGS understates it. Tagging and allocation make the split possible. This is general information, not accounting advice.
Related terms
Absorption Costing
Assigning all production costs, fixed and variable, to the units produced.
Unit Economics
Revenue and cost per customer or transaction, showing if each one pays off.
EBITDA
Earnings before interest, taxes, depreciation and amortization.
Chart of Accounts
The structured list of accounts used to record every transaction.