September 8, 2026

COGS vs. operating expenses: Key differences explained

Every expense your business incurs falls into one of two categories: cost of goods sold (COGS) or operating expenses (OpEx). Classifying them incorrectly can distort profit margins, mislead stakeholders, and create tax and reporting issues.

COGS includes the direct costs required to produce what you sell, while operating expenses are the indirect costs of running the business and affect a different level of profitability on your income statement.

What is cost of goods sold?

Cost of goods sold (COGS) refers to the direct costs incurred to produce the products or services a business sells. These are expenses that can be clearly traced to production or service delivery, and without them, there would be nothing to sell.

COGS typically includes costs that scale with production or are directly attributable to it, making it a critical input for calculating gross profit and evaluating unit economics. Because COGS sits immediately below revenue on the income statement, even small classification errors can significantly distort margin analysis.

What's included in COGS?

The specific components of COGS vary by industry, but most businesses see the same core categories appear consistently:

  • Raw materials and inventory: The physical components that become part of the finished product, such as steel for manufacturers or ingredients for restaurants
  • Direct labor costs: Wages paid to employees who are directly involved in producing goods or delivering services
  • Manufacturing overhead: Production-related costs like factory utilities, equipment maintenance, facility rent, and depreciation on manufacturing equipment
  • Freight-in costs: Shipping expenses required to bring raw materials or inventory to a production or storage location
  • Packaging materials: Boxes, labels, and protective materials included with products sold to customers

How to calculate COGS

The standard COGS formula applies to any business that holds inventory:

COGS = Beginning inventory + Purchases − Ending inventory

To calculate COGS accurately, follow these steps:

  1. Determine beginning inventory by measuring the value of inventory at the start of the accounting period
  2. Add purchases made during the period, including raw materials, finished goods, and freight-in
  3. Calculate ending inventory by valuing what remains unsold at the end of the period
  4. Subtract ending inventory from the total to arrive at the cost of goods sold

Your inventory accounting method affects this calculation. FIFO assumes the oldest inventory is sold first, LIFO assumes the newest inventory is sold first, and the weighted average method smooths price changes by averaging inventory costs over the period.

What are operating expenses (OpEx)?

Operating expenses are the indirect costs required to run a business that aren't directly tied to producing goods or delivering services. These expenses support day-to-day operations and appear below gross profit on the income statement, where they're used to calculate operating income.

Unlike COGS, operating expenses aren't traceable to individual units of output. Some remain fixed regardless of sales volume, while others fluctuate with business activity, which makes understanding their behavior essential for budgeting and cost control.

Common types of operating expenses

Operating expenses are typically grouped by function to make financial reporting and analysis easier.

Selling expenses include costs associated with generating revenue, such as:

  • Sales team salaries and commissions
  • Marketing and advertising spend
  • CRM and sales software subscriptions
  • Trade shows, sales materials, and travel for customer meetings

General and administrative (G&A) expenses cover the costs of running the organization itself, including:

  • Office rent and utilities
  • Insurance premiums, such as general liability and D&O coverage
  • Legal, accounting, and professional fees
  • Office supplies, equipment, and administrative staff salaries

Other operating expenses may include items that support the business but don't fall neatly into selling or G&A categories, such as research and development costs, depreciation on non-production assets, amortization of intangibles, and bad debt expense.

Fixed vs. variable operating expenses

Not all operating expenses behave the same way as revenue changes, which affects how they should be managed.

  • Fixed operating expenses remain largely constant regardless of sales volume, such as office leases, insurance premiums, and most salaried roles
  • Variable operating expenses fluctuate with business activity, including sales commissions, transaction fees, and certain marketing costs

Understanding which operating expenses are fixed vs. variable helps businesses plan for growth, model cash flow, and identify which costs will scale naturally and which require active control.

COGS vs. operating expenses key differences

The difference between COGS and operating expenses affects how profit is calculated, how performance is evaluated, and where cost-control efforts should focus. While both reduce revenue, they do so at different stages of the income statement and reveal different insights about business efficiency.

FactorCost of goods sold (COGS)Operating expenses (OpEx)
DefinitionDirect costs to produce goods or deliver servicesIndirect costs required to run the business
Relationship to productionDirectly tied to production or service deliveryNot tied to specific units of output
Income statement placementSubtracted from revenue to calculate gross profitSubtracted from gross profit to calculate operating income
Cost behaviorOften scales with production volumeMix of fixed and variable costs
Profit metric affectedGross profit and gross marginOperating income and operating margin
Common examplesMaterials, production labor, factory overheadRent, marketing, administrative salaries

Direct vs. indirect costs explained

At the core of this distinction is whether a cost can be directly traced to producing what you sell.

Direct costs are incurred only when goods or services are produced. If production stops, these costs largely disappear. Indirect costs support the business as a whole and typically continue regardless of output levels.

A practical way to assess classification is to ask whether the cost would exist if production halted entirely. Costs that vanish with production usually belong in COGS, while those that persist are operating expenses.

How each affects profitability

COGS and operating expenses reduce revenue in sequence, which is why accurate classification matters for financial analysis:

Revenue − Cost of goods sold = Gross profit

Gross profit − Operating expenses = Operating income

Gross profit shows how efficiently a business produces or sources what it sells. Operating income reflects how well the business manages all ongoing costs. Misclassifying expenses can inflate one metric while understating issues in another, leading to poor decisions around pricing, hiring, or investment.

How capital expenditures (CapEx) fit

A third category, capital expenditures (CapEx), often gets confused with COGS and OpEx, but GAAP treats it differently. CapEx is money you spend on long-term assets like property, equipment, or software that will benefit your business for more than one year.

The key contrast: CapEx is recorded as an asset on the balance sheet and expensed gradually through depreciation or amortization. COGS and operating expenses hit the income statement in the current period. Under GAAP, this timing difference is the defining split between capital expenditures vs. operating expenses.

Here's a clean decision rule: If it's a direct cost of producing a good, it's COGS. If it's a running cost you use up within the year, it's OpEx. If it's an asset you'll benefit from for a year or more, it's CapEx. This simple test helps you answer the common question of whether CapEx is an operating expense: No, because CapEx lives on the balance sheet until it's depreciated.

One practical note: Companies sometimes convert CapEx to OpEx, for example by leasing equipment instead of buying it, to take the full deduction in the current year. This CapEx vs. OpEx decision can have significant tax and cash flow implications.

CategoryFinancial statementTimingExample
COGSIncome statementExpensed when goods are soldRaw materials, production labor
Operating expenses (OpEx)Income statementExpensed in the period incurredRent, marketing, salaries
Capital expenditures (CapEx)Balance sheetDepreciated or amortized over yearsEquipment, buildings, software

Common expense categorization challenges

Some expenses don't fall cleanly into COGS or operating expenses and require judgment to classify correctly. These gray areas are common sources of error, especially as businesses scale or adopt new operating models.

The goal isn't perfection, but consistency. Expenses should be categorized based on how they support the business, using a rationale that can be applied the same way period after period.

Tricky expenses that cause confusion

Expense typeTypical classificationReasoning
Inbound shipping (freight-in)COGSPart of acquiring inventory or materials needed for production
Outbound shipping (freight-out)Operating expenseOccurs after production and relates to order fulfillment
Production supervisor salaryCOGSDirectly oversees manufacturing or service delivery
Sales manager salaryOperating expenseSupports revenue generation but doesn't create products
Factory rentCOGSEnables production activities
Office rentOperating expenseSupports administrative and operational functions
Quality control testingCOGSEnsures products meet specifications before sale
Customer support costsOperating expenseSupports customers after the sale is complete

Industry-specific classification nuances

How expenses are classified often depends on the underlying business model. For SaaS and technology companies, infrastructure costs can serve multiple purposes. Customer-facing hosting and production environments are typically classified as COGS, while development, testing, and internal systems fall under operating expenses.

Professional services

Professional services firms often need to distinguish between billable and non-billable time. Labor tied directly to client work is usually treated as COGS, while time spent on training, sales, or internal administration is classified as an operating expense.

Manufacturing

Manufacturing businesses frequently deal with shared overhead. Utilities, rent, and maintenance costs should be allocated using a consistent method, such as square footage or machine usage, to separate production-related costs from administrative ones.

Retail and e-commerce

Retail and e-commerce companies face ambiguity around fulfillment and platform fees. Payment processing and marketplace fees are generally operating expenses, while warehousing and fulfillment costs may be classified as COGS if they're directly tied to preparing products for sale.

E-commerce businesses in particular benefit from a disciplined approach to managing e-commerce cash flow, since misclassified costs can distort both margin reporting and working capital planning.

SaaS

For SaaS companies, customer-facing hosting classified as COGS is often reported as "cost of revenue" rather than "COGS" on the income statement. Keeping these judgment calls consistent period over period is where automation helps.

For example, Ramp's Accounting Agent auto-codes GL, department, class, location, and custom fields the moment a transaction posts, coding 3.5x more transactions automatically than rules-only tools.

Gray-area costs like freight-in vs. freight-out or shared-facility rent follow the same rationale every time, and every coding decision carries a confidence level, rationale, and override capability so you can review the logic and adjust when needed.

Why proper classification matters for your business

Correctly distinguishing between COGS and operating expenses isn't just an accounting exercise. It directly affects how you evaluate performance, explain results to stakeholders, and decide where to focus cost-control efforts.

When expenses are misclassified, core metrics can become unreliable. A business may appear to have strong gross margins while struggling operationally, or vice versa, making it harder to diagnose problems or plan for growth.

Impact on financial analysis and decision-making

Expense classification shapes the financial metrics leaders rely on most. If production costs are incorrectly treated as operating expenses, gross profit will be overstated, potentially leading to pricing decisions that erode margins. Conversely, misclassifying operating expenses as COGS can mask inefficiencies in overhead and support functions.

Accurate classification also enables meaningful comparison against industry benchmarks. Investors, lenders, and potential buyers expect consistency in how costs are reported, and discrepancies can undermine confidence in financial statements.

Ramp flags in-policy transactions and syncs them to your ERP with 98% accuracy on transactions marked "ready to sync." Every coding decision carries a confidence level, rationale, and override, so the numbers behind your gross margin and operating income stay defensible in an audit.

Strategic cost management approaches

COGS and operating expenses call for different optimization strategies because they reflect different parts of the business.

Reducing COGS typically involves improving how products or services are produced, such as negotiating vendor pricing, reducing waste, or improving labor efficiency. A well-structured procurement process can also drive meaningful COGS reductions by standardizing supplier selection and purchase terms.

Managing operating expenses focuses on structural efficiency, including controlling fixed costs, streamlining processes, and evaluating return on discretionary spending. Understanding where costs sit allows teams to prioritize the right actions instead of cutting expenses indiscriminately, which can create unintended long-term consequences.

What percentage of sales should COGS and OpEx be?

The ranges below are illustrative benchmarks drawn from public-company industry margin data. Actual figures vary by business model, company size, and sub-segment, so treat these as reference points rather than strict targets.

Typical COGS as a percentage of sales by industry

  • Grocery stores: 74%–79%
  • Manufacturing (capital goods and machinery): 62%–70% (process and commodity manufacturing, such as steel and food processing, runs higher, around 75%–88%)
  • Retail: 65%–70%
  • Software (SaaS): 20%–35%

Typical operating expenses as a percentage of sales by industry

  • Software (SaaS): 35%–50%
  • Retail businesses: 20%–28%
  • Manufacturing: 18%–25%

These ranges provide context, not judgment. Higher COGS may reflect premium inputs or labor-intensive production that supports higher pricing. Higher operating expenses can signal investment in growth, such as sales expansion or product development, rather than inefficiency.

The most useful comparison is often your own trend over time. Consistent classification allows you to track how changes in pricing, volume, or operations affect margins and to spot issues early.

Real-world examples of COGS vs. OpEx in action

The examples below are simplified, composite scenarios that reflect common expense patterns across different business models. They're designed to illustrate how COGS and operating expenses are typically classified in practice.

Example e-commerce retailer

An e-commerce retailer generates $150,000 in monthly revenue.

  • COGS ($75,000): Inventory purchases, inbound freight, warehouse receiving labor, product packaging, and fulfillment pick-and-pack fees
  • Operating expenses ($35,000): Office-related rent, customer support salaries, marketing spend, e-commerce platform subscriptions, and outbound shipping

This results in a 50% gross margin and a 23% operating margin, indicating that customer acquisition and fulfillment efficiency have a greater impact on profitability than sourcing costs.

Example SaaS company

A SaaS company generates $200,000 in monthly recurring revenue.

  • COGS ($18,000): Customer-facing cloud infrastructure, third-party API licenses, and customer support teams
  • Operating expenses ($112,000): Product development salaries, sales compensation, marketing programs, office costs, and general administration

With a high gross margin but a lower operating margin, this structure shows how SaaS businesses often achieve strong unit economics while absorbing significant operating costs to support growth.

Example manufacturing business

A manufacturing business generates $250,000 in monthly revenue.

  • COGS ($125,000): Raw materials, production wages, factory rent and utilities, equipment depreciation, and quality control
  • Operating expenses ($45,000): Sales commissions, administrative salaries, office rent, marketing, and delivery to customers

This breakdown highlights how production efficiency drives gross margin, while sales and administrative costs determine operating profitability.

Automate COGS and OpEx classification with Ramp

Distinguishing between COGS and OpEx is critical for accurate financial reporting, but manual classification is time-consuming and error-prone. When transactions aren't coded correctly, your income statement becomes unreliable, making it harder to analyze profitability, manage budgets, and make informed decisions about pricing and operations.

Ramp's AI-powered accounting software eliminates the guesswork by learning your accounting patterns and automatically coding transactions across all required fields as they post. The platform analyzes transaction details, merchant information, and historical coding decisions to classify expenses correctly, whether they're direct costs tied to production or indirect costs supporting your operations.

  • AI codes with precision: Ramp learns how your business categorizes different types of spend and applies consistent logic to code transactions in real time, reducing manual review time and classification errors
  • Auto-sync routine spend: Ramp identifies in-policy transactions and syncs them to your ERP automatically, so correctly classified expenses flow to the right accounts without manual intervention
  • Review with full context: Ramp surfaces transaction details, receipts, and approvals in one place, making it easy to verify classifications and adjust coding rules when needed
  • Maintain audit trails: Every transaction includes a complete record of who approved it, why it was coded a certain way, and what supporting documentation exists

Try an interactive demo to see how Ramp helps finance teams code 3.5x more transactions using AI compared to rules-only automation.

Try Ramp for free
Share with
Mason Brady, MBA, CEPAPresident, Brady CFO
Brady CFO is a full-service Fractional CFO firm supporting companies in agriculture, food, manufacturing, logistics, warehousing/distribution, construction & professional services industries. We serve as strategic partners to CEOs and owners to improve profits and cash flow. Our innovative service model provides tools and insights to drive sustainable growth without wasting time and money on inefficient processes or unnecessary expenditures. With Brady CFO, you're investing in a creative and evolving strategy that fits the needs of your growing business.
Ramp is dedicated to helping businesses of all sizes make informed decisions. We adhere to strict editorial guidelines to ensure that our content meets and maintains our high standards.

FAQs

Inventory is an asset on the balance sheet, not an expense. When inventory is sold, its cost is recorded as cost of goods sold on the income statement. Unsold inventory is never classified as an operating expense.

It depends on the role. Salaries for employees directly involved in producing goods or delivering services are classified as COGS. Salaries for administrative, sales, marketing, and management roles are operating expenses.

Yes. Some costs, such as rent or utilities for a shared facility, can be allocated between COGS and operating expenses. The key is to use a reasonable allocation method, apply it consistently, and document the rationale.

Both COGS and operating expenses reduce taxable income, but the timing differs. Operating expenses are generally deductible in the period they're incurred, while COGS is deducted only when the related inventory is sold.

No. Capital expenditures buy long-term assets and are recorded on the balance sheet, then expensed over time through depreciation or amortization. Operating expenses are shorter-term running costs deducted in the period they're incurred.

Invoices, cards, tokens. The categories change but the principle doesn't: know where the money is going, remove the work around it, and make sure the spend is worth it.

Maciej Mylik. Finance

ElevenLabs

ElevenLabs speaks more than 70 languages but its money speaks the same one

There's just no surprises anymore. No more waiting two months to find out how a job did. We know how it's doing as it's happening.

Erich Kuss

Financial Systems Manager, Infinity Home Services

Infinity Home Services prevents the margin leak nobody can see from the ground, so its 20+ local companies build what they bid

More token spend isn’t proof that AI is working. Less isn’t proof that it isn’t. What matters is whether we’re buying the right level of intelligence for the work. Ramp lets us make that judgment in the same place we manage every other type of spend.

Cody Nutt

Senior Director of Business Systems, Daxko

How Daxko put every AI token on the same operating system as every dollar

Most banks treat the back office as a cost to keep down. We treat ours as a return to compound, which is why we run it on Ramp. Now we put our clients on Ramp, too.

Patrick Gaughen

President & COO, Hingham Institution for Savings

The 192-year-old bank that banks on Ramp to take the waste out of its own books

Browserbase builds infrastructure so AI agents can do real work. Ramp is doing the same for finance. It’s not another tool. It’s a system purpose-built for AI-driven finance, and that’s why we chose Ramp as our financial operating system from day one.

Paul Klein IV

Founder & CEO, Browserbase

How the startup that helped design Ramp’s procurement agent automated its own procure-to-pay

We used to pay up to $20k a year for our AP platform. With Ramp, we’re earning back well over that amount. That's money that belongs to the mission now, not to the back-office software.

Heidi Coffer

Chief Financial Officer, Boys & Girls Clubs of San Francisco

Boys & Girls Clubs of San Francisco used to pay for their finance software — now it pays them

The tricky thing about corporate travel policy is timing. We didn't need a stricter policy. We needed the policy to show up earlier. With Ramp Travel, it finally does.

Keith Frantz

Director of Enterprise Risk Management, Prosper

When Prosper put policy into its corporate travel booking flow, costs fell 15% and finance reclaimed a week every month

We're accountable to our funders, our partners, and the families we serve. That accountability starts with how we manage every dollar. Ramp makes it easy for our team to spend wisely, track in real time, and keep overhead low so more resources reach the families navigating infertility.

Rachel Fruchtman

CFO, Jewish Fertility Foundation

Jewish Fertility Foundation reclaimed 11 work weeks and put more time into serving families