Accounting & Financial Ops

How to calculate cost of goods sold (COGS)

A founder-friendly guide to understanding, calculating, and tracking this key metric with examples, formulas, and common mistakes to avoid.

September 17, 2025

Revenue can look impressive on paper, but it doesn’t always mean your business is financially healthy. A $100,000 month takes on a different context if it costs you $75,000 to deliver your product vs. $95,000.

That’s why the cost of goods sold (COGS) is a number every founder should understand. It shows the real cost of delivering what you sell and helps you see your true gross profit, file accurate taxes, and make smarter pricing and forecasting decisions.

For early-stage founders handling their own books, learning how to calculate COGS is an important step towards better understanding your business’ financials.

What is COGS (cost of goods sold)?

COGS represents the direct costs of producing or delivering your product or service.

For a product business, that means the materials and labor tied to production. For a SaaS startup, it might include hosting costs or software infrastructure.

COGS is important for three major reasons: 

  • Gross profit: Revenue minus COGS shows how much money you actually make after covering the costs of delivering your product. 
  • Taxes: COGS is deductible from your taxes. Calculating it correctly can reduce your taxable income. 
  • Financial decisions: Understanding COGS can help you set prices, control costs, and evaluate unit economics. 

On your income statement, COGS sits just below revenue. Subtract it to see gross profit — one of the clearest measures of financial health.

To see how COGS fits into the bigger picture, learn how to analyze a profit and loss statement

What COGS includes (and excludes)

People often get confused about what exactly constitutes COGS. A good test is to ask: if the product disappeared, would this cost still exist? If the answer is no, it likely belongs in COGS.

COGS includes: 

  • Raw materials and supplies
  • Direct labor tied to production or delivery
  • Packaging
  • Freight and shipping connected to sales

COGS excludes: 

  • Rent or coworking space
  • Marketing and advertising
  • Salaries for leadership or admin staff
  • General office software

For a restaurant, COGS would include food costs, but not Instagram ads. For a logistics company, COGS would include warehouse staff wages and the boxes used for shipments, but not the CEO’s salary.

For a deeper look, check out this piece on understanding unit economics.

How to calculate cost of goods sold

To find your COGS, you’ll need a formula that captures what you started with, what you added, and what’s left unsold.

COGS = Beginning Inventory + Purchase During the Period - Ending Inventory

  • Beginning Inventory: Value of goods at the start of the period (such as a month, quarter, or year). 
  • Purchases during the period: New stock or raw materials bought during the period.
  • Ending Inventory: Value of what remains unsold at the end of the period. Represents the stock you will carry into the next period. 

This cost of goods sold formula ensures you only capture the costs tied to goods that left your business during the period. 

Example: A coffee subscription business starts with $5,000 in beans and packaging, buys $12,000 more during the month, and ends with $4,000 left. 

COGS = $5,000 + $12,000 - $4,000 = $13,000

The true cost of serving customers that month is $13,000. 

Plug your own numbers into this ecommerce income statement template.

Real-world examples for founders

COGS varies by business model. Understanding what counts for your specific model will make your numbers far more useful.

For SaaS startups

COGS usually reflects the costs of keeping your product available and running smoothly. That often includes:

  • Cloud hosting fees
  • Customer support team salaries if they are helping paying users
  • Third-party tools or APIs for product delivery
  • Software licenses for infrastructure 

These costs scale with customer growth.

For ecommerce companies

COGS generally covers the full journey of producing and delivering a physical item. This includes:

  • Raw materials (fabric, electronics, ingredients, etc.)
  • Manufacturing labor or contractor costs
  • Packaging used to ship products to customers
  • Freight or shipping fees tied directly to sold items

These costs usually scale with volume as well.

Edge cases to consider

  • Dropshipping businesses: COGS is often the per-unit price you pay suppliers for goods sold to customers.
  • Hybrid businesses: The materials and labor tied to devices would fall under product COGS, while hosting and support would belong under SaaS COGS.

The principle is always the same: only include costs directly tied to getting your product into a customer’s hands.

This SaaS income statement template can help you break out COGS.

COGS vs operating expenses (OPEX)

Founders often confuse COGS with operating expenses (OPEX), but they play different roles in your financials.

  • COGS: direct costs of creating or delivering your product or service. These costs scale alongside your sales.
  • OPEX: broader costs of running your company. These costs are more fixed over time.

Here are some examples of COGS vs. OPEX:

COGS:

  • Inventory and raw materials
  • Direct labor tied to production or delivery
  • Hosting and server costs

OPEX:

  • Rent for your office or warehouse
  • Salaries for leadership, HR, or finance
  • Marketing campaigns and ad spend

Why the distinction matters

  • COGS affects gross profit. Gross profit is revenue minus COGS, and it is one of the clearest signals of whether your business model is viable. 
  • OPEX affects net profit. OPEX comes after gross profit. These costs matter for overall sustainability, but they do not change your gross margin.

When you separate COGS and OPEX correctly, you get a clearer view of your margins and can make better decisions. Misclassifying expenses here can distort your financial picture and lead to poor decisions.

For more, explore our financial forecast model for ecommerce.

How to track COGS as a startup operator

COGS can be tracked in different ways, depending on your business’ stage:

  1. Manual tracking in a spreadsheet: Simple and transparent for a handful of costs, but requires discipline.
  2. Bookkeeping software: Tools like QuickBooks or Xero automate categorization and inventory tracking, though you still need to review your numbers.
  3. Integrated tools: Connect banking, expenses, and reporting in one place for a streamlined workflow. 

Whichever method you use, consistency matters most. Calculate COGS monthly to keep an accurate, real-time view of your margins.

Common COGS mistakes (and how to avoid them)

Founders often trip up on COGS by moving fast without a clear process:

  • Misclassifying expenses:
    • Don’t put marketing or admin costs in COGS. 
    • Use a checklist of valid items (materials, hosting, packaging) to stay consistent.
  • Skipping inventory adjustments:
    • Always record your beginning and ending inventory so that only sold goods are counted.
  • Calculating annually:
    • Tie COGS to your monthly close for real-time insight and for more accuracy. 

Tracking COGS consistently and categorizing items correctly is one of the simplest ways to build financial discipline into your business from the start.

TLDR: Quick reference summary

COGS shows the direct cost of producing or delivering your product. It is critical for calculating gross profit, setting prices, and filing accurate taxes.

Cost of Goods Sold Formula reminder: COGS = Beginning inventory + Purchases – Ending inventory

Track it monthly, keep it separate from operating expenses, and use it to guide growth decisions.

FAQs

Is cost of goods sold an expense?
Yes. COGS is an expense on the income statement, deducted from revenue to calculate gross profit.

Is cost of goods sold a debit or credit?
COGS is recorded as a debit (an expense), with the offset being a credit to inventory.

Why is COGS important for taxes?
COGS is deductible, lowering taxable income and reducing your tax bill.

Share article

Table of Contents

Disclaimers and footnotes

Mercury is a fintech company, not an FDIC-insured bank. Banking services provided through Choice Financial Group, Column N.A., and Evolve Bank & Trust, Members FDIC. Deposit insurance covers the failure of an insured bank.