What is the cost of goods sold? COGS formula, calculation, and examples

Laptop displaying COGS data in a warehouse setting.

If you own a small business that sells a product, such as food or clothing, you have likely heard the term cost of goods sold or COGS. This metric is essential to business success because if the cost of goods sold is too high compared to revenue, your business could be leaving profit on the table.

Knowing what it costs to make or buy the products you sell helps you price them profitably. But which expenses count toward COGS, and which don’t? Here’s how to calculate COGS and put the numbers to work for your business.

What is the cost of goods sold and what does COGS include?

Cost of goods sold (COGS) is the cost of purchasing or producing the products a business sells during an accounting period. It includes inventory purchases, direct materials, production labor, and certain manufacturing overhead. Marketing, office administration, and general operating expenses are typically excluded. However, the exact classification can vary depending on your business and accounting method.

COGS is generally deductible, and businesses that sell products report it on their tax return. While many businesses have an accountant or other tax professional calculate COGS, it’s still important to know what to track when you make or buy products to sell. These are the core inputs for calculating cost of goods sold:

  • Beginning inventory
  • Materials purchased
  • Direct & indirect labor
  • Manufacturing overhead
  • Inbound freight
  • Ending inventory

How to calculate cost of goods sold

Compiling all the costs needed to determine cost of goods sold can be complicated, especially when a company sells multiple products, but once you’ve gathered the data, the calculation is actually quite simple.

The formula to calculate cost of goods sold is:

COGS = Beginning inventory + Purchases and production costs − Ending inventory

To determine COGS, start with the inventory you had at the beginning of the period (beginning inventory). Add qualifying purchases (such as raw materials) and production costs (labor, manufacturing, and shipping), then subtract the value of the inventory remaining at the end (ending inventory).

For example, if your scarf-making business had $14,000 in scarves and materials at the beginning of the year, spent $20,000 on purchasing new fabric and knitting services, and had $10,000 worth of scarves and materials at the end of the year, your COGS would be:

  $14,000 (Beginning Inventory) 

+ $20,000 (Purchases & Costs)

–  $10,000  (Ending Inventory) 

= $24,000 (Cost of Goods Sold)

The ending inventory of one year must match the beginning inventory of the following year. You may owe additional taxes if your beginning inventory doesn’t match last year’s ending inventory, so be as precise as possible.

Remember, you can only calculate the cost of goods sold if you actually sell your product. Inventory sitting in a warehouse isn’t tax-deductible because it’s still an asset you own. One way to ensure that you can deduct COGS from your business income is to produce your product based on purchase orders.

What is included and excluded from COGS?

Not every expense connected to a product belongs in COGS. Here’s where common costs generally fall:

Included in COGS
Usually excluded
Raw materials and inventory purchases
Advertising and marketing
Direct manufacturing labor
Administrative salaries
Inbound freight on purchased inventory
Shipping orders to customers
Qualifying factory rent and utilities
Office rent and general overhead

Warehouse storage costs require a closer look. Some production-related costs may qualify, but ordinary storage and distribution expenses typically don’t. Ask your accountant how your inventory method affects the classification.

How inventory accounting affects COGS

The accounting method you use affects which costs appear in COGS. Three common methods are:

  • FIFO (first in, first out): Assumes the oldest inventory is sold first.
  • LIFO (last in, first out): Assumes the newest inventory is sold first.
  • Weighted-average cost: Uses an average unit cost to value inventory.

When prices rise, FIFO generally produces lower COGS than LIFO because the older, less expensive inventory sells first. LIFO is permitted under certain U.S. accounting and tax rules but has additional requirements. Changing inventory methods may require IRS approval via Form 3115, so consult your accountant before switching.

COGS vs. operating expenses and cost of revenue

COGS measures the cost of products sold; operating expenses cover the cost of running the business, including office salaries and advertising. Cost of revenue is a broader reporting term that can include the costs of delivering products or services.

For a service business, “cost of services” may provide a better metric than COGS for expenses like billable labor. The terminology depends on how your business prepares its financial statements.

Why COGS matters for gross profit, pricing, taxes, and financing

COGS helps you understand how much money your business keeps from each sale before paying everyday operating expenses. To find your gross profit margin, subtract COGS from net sales to calculate gross profit, then divide gross profit by net sales. This shows the percentage of revenue left after covering the cost of the goods you sold.

For example, if your business generates $100,000 in net sales with $60,000 in COGS, your gross profit is $40,000, and your gross profit margin is 40%.

Remember that $40,000 must still cover expenses like marketing, office rent, and administrative salaries before your business earns a net profit. Understanding these concepts helps you set prices that support a healthy business profit margin.

Tracking COGS also helps you spot rising production costs, manage inventory purchases, and maintain accurate tax records. Higher COGS can mean lower profits even when sales are up. Because businesses often pay for inventory before customers buy it, inventory purchases can put pressure on business cash flow.

If you need funds to cover that gap, inventory financing options or working capital financing may help.

Businesses that may not need to calculate COGS

Businesses that provide only services generally don’t calculate inventory-based COGS. However, a contractor who also sells materials or a salon that sells retail products may need to account for those goods separately. Service businesses still need to track expenses and understand what each job costs to deliver.

Types of businesses that typically don’t need to track COGS include:

  • Service industries
  • Accounting and law firms
  • Consulting
  • Medical and dental practices
  • Real estate appraisers and brokers

Frequently asked questions

COGS generally appears below net sales and above gross profit on a profit and loss statement.

Normally, no. Negative COGS may signal an accounting error, adjustment, or unusual inventory transaction worth investigating.

If you place returned merchandise back in your inventory, you may need to reverse its previously recorded COGS, since it’s no longer “sold.”

Damaged, missing, or obsolete inventory may require adjustments that affect your computation of cost of goods sold.

Generally, sales tax collected on behalf of the government isn’t part of COGS.

Typically, no. They’re generally recorded as transaction or operating expenses rather than product costs.

Freight-in generally contributes to inventory costs and should be counted toward COGS. Freight-out, or shipping products to customers, is generally a selling expense and not included in COGS.

Yes. Returns, supplier credits, and the accounting method you use can affect your reported COGS after buying inventory.

Trade discounts reduce the cost of buying inventory, which can lower your COGS. Early-payment discounts have different accounting options that must be applied consistently.

Keep your supplier invoices, purchase receipts, freight bills, inventory counts, and relevant payroll records to support your COGS calculations and tax filings.

Credibly merchant cash advances and working capital loans to merchants in California are provided by Retail Capital LLC. All other Credibly products in all other jurisdictions are provided by Credibly of Arizona LLC.

Credibly management team member smiling, professional portrait.

Chad Cohen

Chad Cohen is Credibly’s VP of Direct Sales with a career spanning small business ownership and leadership roles at top financing firms. He’s passionate about helping business owners secure the funding they need to succeed.

Explore business financing with Credibly

Government business loans for women and grants don’t fit every funding need or timeline. If you’re weighing other options, Credibly can help you compare business financing options. We’ve financed 55,000+ businesses since 2010, and every conversation starts with where your business is headed.


Explore your financing options

Speak with a financing expert

Recent Posts: