Cost of Goods Sold (COGS): Formula & How to Calculate

Cost of Goods Sold (COGS): Formula & How to Calculate

Cost of Goods Sold (COGS) is the direct cost of producing the goods a company sold during a period — raw materials, direct labor, and production overhead. You calculate it as Beginning Inventory + Purchases − Ending Inventory, then subtract it from revenue to get gross profit.

What is Cost of Goods Sold (COGS)?

COGS represents the direct costs tied to producing or acquiring the products a company sells. It's one of the largest line items on most income statements and the single biggest driver of gross profit and gross margin. Tracking COGS shows how efficiently a business turns inputs into sellable product, and how much room it has to price competitively while staying profitable.

The COGS Formula

COGS = Beginning Inventory + Purchases − Ending InventoryCost of goods sold

You start with the inventory you held at the beginning of the period, add everything you bought or produced during it, then subtract what's still on the shelf at the end. Whatever was "used up" to make sales is your COGS.

Worked example

Say a furniture maker starts the quarter with $20,000 of inventory, buys $50,000 of wood and fabric, and ends with $15,000 of unsold inventory:

COGS = $20,000 + $50,000 − $15,000 = $55,000Quarterly COGS

If quarterly revenue was $90,000, gross profit is $90,000 − $55,000 = $35,000 (a 39% gross margin).

What COGS Includes vs Excludes

Included in COGS (direct)Excluded from COGS (indirect → OpEx)
Raw materials & componentsMarketing & advertising
Direct production laborAdministrative & office salaries
Manufacturing overheadRent for non-production space
Freight-in / inbound shippingR&D and software tools
Inventory bought for resaleDistribution & sales commissions

COGS in SaaS

Software companies have COGS too — but it's the cost of delivering the service, not making a physical product: hosting and cloud infrastructure, third-party APIs, payment processing, and customer support / success headcount. SaaS gross margins run high (70–85%) precisely because this delivery cost is low relative to revenue.

Why COGS Matters

  • Drives gross profit: revenue − COGS = gross profit. A rising COGS quietly erodes margin.
  • Signals efficiency: climbing COGS as a % of revenue points to rising input costs or production waste.
  • Shapes pricing: you can't price sustainably without knowing your unit cost.
  • Affects taxes: COGS is deductible, so accurate tracking lowers taxable income legitimately.

Cost of Goods Sold FAQ

How do you calculate COGS?

Use COGS = Beginning Inventory + Purchases − Ending Inventory. Add the inventory you started with to what you bought during the period, then subtract the inventory left at the end. The result is the cost of the goods you actually sold.

Is COGS the same as operating expenses?

No. COGS is the direct cost of producing what you sold. Operating expenses (OpEx) are the indirect costs of running the business — marketing, admin, rent. Both sit on the income statement, but COGS comes first (used to find gross profit) and OpEx comes after.

Where does COGS appear on the income statement?

Directly below total revenue. Revenue − COGS = gross profit, which is the starting point for the rest of the profit and loss statement.

Does COGS include shipping?

Inbound freight (getting materials to you) is part of COGS. Outbound shipping to customers is usually a selling expense recorded under operating expenses, not COGS.

Adlega - Reduce Your Churn