An overview of cost of goods sold (COGS)

Guide5 mins read | Posted on July 24, 2026 | By Henry Jose

Introduction

Cost of goods sold (COGS) is what the stock you sold during a period cost you to buy or make. Anything you have not sold yet stays on your books as inventory until it does. COGS is usually the largest expense on your income statement, and an error in it flows straight into your gross margin and your tax bill.

This guide gives you the formula, a calculator, a clear line between what is and is not in COGS, and the period-end journal entry most guides skip.

COGS formula 

COGS totals the cost of the goods you sold, not the goods you bought:

COGS = Beginning Inventory + Purchases − Ending Inventory

Beginning inventory is what you were holding at the start of the period. Purchases are what you added during it, whether stock bought for resale or the materials and productions that went into what you make. Ending inventory is what remains, counted at the end.

Subtracting the goods still on the shelf leaves the cost of the goods that left them. For a manufacturer, "purchases" stand in for everything added to production in the period: direct materials, direct labor, and factory overhead.

Quick COGS calculator 

Enter your beginning inventory, purchases, and ending inventory, and the calculator returns your COGS. Use it to check a period quickly or to see how a different ending count moves the figure.

What is and is not in COGS 

COGS holds only the costs tied directly to producing or buying what you sold. Everything else, the cost of running the business, sits below it as operating expenses.

In COGS (direct costs)

Not in COGS (operating expenses)

Direct materials

Office rent and utilities

Direct labor (production and assembly wages)

Management, admin, and sales salaries

Manufacturing overhead (factory rent, utilities, equipment depreciation)

Marketing and advertising

Freight-in (inbound shipping to receive stock or materials)

Outbound shipping to customers and distribution

Packaging included with the product

Research, development, interest, and other financing

One simple test resolves most cases. If a cost would still exist in a period where you produced nothing, it is almost certainly an operating expense, not COGS. Shipping is where ecommerce sellers most often slip. Freight to bring stock in counts toward COGS, while shipping orders out to customers is a selling expense that sits below it.

Step-by-step with a worked example 

Take a period with $50,000 of beginning inventory, $20,000 in purchases, and $15,000 of stock left at the end.

  1. Start with beginning inventory: $50,000.

  2. Add purchases: $50,000 + $20,000 = $70,000. This is your cost of goods available for sale.

  3. Subtract ending inventory: $70,000 - $15,000 = $55,000 COGS.

COGS for the period is $55,000. Swap in your own figures to repeat this. The figure that needs care is the ending inventory, since it comes from a physical count or your inventory system, and an error there flows straight into COGS and from there into misstated profit.

COGS under FIFO, LIFO, WAC, and specific ID 

The formula is fixed. What it produces still depends on the costing method you use, because the cost you assign to ending inventory changes with the method, and when purchase prices move during the period, the four standard methods give four different answers.

  • FIFO (first in, first out): The oldest costs leave first, so COGS uses your earliest prices, and ending inventory reflects recent ones. In rising prices, this gives the lowest COGS.
     

  • LIFO (last in, first out): The newest costs leave first, so COGS uses your most recent prices. In rising prices, this gives the highest COGS and the lowest taxable income. LIFO is permitted in the US but not under IFRS.
     

  • Weighted average (WAC): Every unit is estimated at the period's average price, smoothing out cost swings.
     

  • Specific identification: Each unit carries its own actual cost, used for serialized or high-value goods.

The method you pick can change your reported profit and your tax on the very same sales. The trade-off is worked through in our FIFO vs. LIFO guide.

COGS by industry 

What counts as a direct cost shifts with the business:

Business type

What goes into COGS (or its equivalent)

Manufacturer

Direct materials, direct labor, and factory overhead for goods produced and sold.

Retailer or wholesaler

The purchase cost of goods sold plus freight-in; often reported as “cost of sales” rather than COGS.

eCommerce

Product cost plus inbound shipping. Fulfillment and outbound shipping are usually operating expenses, not COGS.

Service business

The direct labor and materials used to deliver the service, usually reported as “cost of services” or “cost of revenue.”

SaaS

Reported as “cost of revenue:” hosting, third-party fees, and support tied directly to delivering the software.

The label changes with the model (COGS, cost of sales, or cost of revenue), but the principle is the same: It's only the direct costs of what you sold.

Period-end journal entries 

Once you have the number, you still have to record it, and that is the step most guides leave out. How you record it depends on your inventory system. Under a perpetual system, you record the cost at the moment of each sale:

Account

Debit

Credit

Cost of goods sold

X

 

Inventory

 

X

Under a periodic system, you do not touch COGS during the period; purchases sit in a temporary purchases account. At a period's end, one closing entry moves everything into COGS. Using the worked example above:

Account

Debit

Credit

Cost of goods sold

55,000

 

Purchases

 

20,000

Inventory

 

35,000

That single entry clears the period's purchases, reduces inventory from its $50,000 beginning balance to the $15,000 you counted, and lands $55,000 in COGS.

Common COGS mistakes 

  • Mixing operating expenses into COGS: Rent, admin salaries, marketing, and outbound shipping belong below gross profit, not inside COGS. Fold them in, and you understate your gross margin and can misstate your tax.
     

  • Leaving out freight-in: The cost of getting stock or materials to you is part of their cost. Skip it and you overstate your margin.
     

  • A wrong ending inventory count: COGS is only as accurate as the count behind ending inventory. A miscount passes straight through to profit.
     

  • Changing costing methods casually: FIFO, LIFO, and WAC produce different COGS, so switching midstream breaks comparability, and using LIFO without IRS election is a compliance problem.  

Frequently Asked Questions

What is the cost of goods sold formula?

COGS = Beginning Inventory + Purchases - Ending Inventory.

It measures what the inventory you sold during the period cost you; stock you bought but have not sold stays on the balance sheet as inventory until it does.

How do you calculate COGS?

Start with beginning inventory, add purchases to get your cost of goods available for sale, then subtract your ending inventory. For $50,000 beginning, $20,000 purchases, and $15,000 ending, COGS is $55,000.

What is included in COGS?

The direct costs of what you sold: materials, direct production labor, manufacturing overhead, and freight-in. It excludes operating expenses such as rent, admin and sales salaries, marketing, and shipping orders out to customers.

Is COGS an expense?

Yes, COGS is an expense on the income statement and is deductible for tax. Inventory sits on the balance sheet as an asset until it is sold, and at that point its cost becomes COGS.

 

Leave a Reply

Your email address will not be published. Required fields are marked

The comment language code.
By submitting this form, you agree to the processing of personal data according to our Privacy Policy.
Thank you! Our team will get in touch with you shortly.