Key Points
COGS = beginning inventory + purchases - ending inventory.
COGS sits under revenue on the income statement, and revenue minus COGS gives gross profit.
FIFO, LIFO and weighted average can give different COGS; IAS 2 does not allow LIFO.
In fiscal 2026, Apple's cost of sales was 51.2% of revenue versus 87.2% for Costco's merchandise costs.
Watch COGS as a share of revenue over time and against close peers.
The cost of goods sold formula shows what a company spent to make or buy the products it sold. It sounds like dry accounting. Yet this one number decides gross profit, shapes margins, and often moves a stock on earnings day. In this guide, we walk through the formula and a simple worked example. Then we cover inventory methods and real numbers from big U.S. companies.
What Is Cost of Goods Sold (COGS)?
Cost of goods sold (COGS) is the direct cost of the products a business sold during a period. It covers raw materials, factory labor, and what a store paid for the items on its shelves.
COGS only counts goods that were sold. Stock still sitting in a warehouse stays on the balance sheet as inventory. It moves into COGS only when a customer buys it.
Many companies use a different name for the same idea. Apple calls it “cost of sales.” Walmart also uses “cost of sales.” Costco calls it “merchandise costs.” When you read a report, look for any of these labels.
The Cost of Goods Sold Formula Explained
Here is the standard cost of goods sold formula:
COGS = Beginning Inventory + Purchases − Ending Inventory
Each part is simple:
- Beginning inventory: the value of goods on hand at the start of the period. It should match last period’s ending inventory.
- Purchases: what the business bought or made during the period. For a factory, this includes materials and direct labor.
- Ending inventory: the value of unsold goods left at the end of the period.
The logic is easy to follow. We start with what we had, add what we bought, then remove what is still unsold. Whatever is left must have been sold.
The U.S. tax agency uses the same structure. U.S. small business owners work out COGS on lines 35 to 42 of Schedule C, as shown in IRS Publication 334. Those lines add beginning inventory, purchases, labor, materials, and other costs, then subtract inventory at the end of the year.
What Goes Into COGS (and What Stays Out)
The split between direct and indirect costs matters. Getting it wrong changes gross profit.
| Usually included in COGS | Usually left out of COGS |
|---|---|
| Raw materials and parts | Marketing and advertising |
| Direct factory labor | Head office salaries |
| Freight to bring goods in (freight-in) | Rent for corporate offices |
| Containers and packaging for products | Interest on loans |
| Factory overhead tied to production | Income taxes |
The IRS lists freight-in, containers, and production overhead under “other costs” in the COGS section of Publication 334. Costs like ads and office rent show up lower on the income statement as operating expenses.
COGS Calculation: A Simple Worked Example
Let’s run a quick COGS calculation for a made-up shoe shop over one year.
- Beginning inventory: $20,000
- Purchases during the year: $50,000
- Ending inventory: $15,000
Now we plug the numbers into the cost of goods sold formula:
$20,000 + $50,000 − $15,000 = $55,000
So the shop’s COGS is $55,000. Next, say the shop made $90,000 in sales. Gross profit is sales minus COGS:
$90,000 − $55,000 = $35,000 gross profit
Gross margin is gross profit divided by sales. Here, that is $35,000 ÷ $90,000, or about 38.9%. In other words, the shop keeps about 39 cents per sales dollar. That money pays rent, wages, and everything else.
Is COGS on the Income Statement?
Yes. COGS sits near the top of the income statement, right under revenue. The basic layout looks like this:
- Revenue (sales)
- minus cost of goods sold
- equals gross profit
- minus operating expenses
- equals operating income
Inventory, on the other hand, lives on the balance sheet. That link is why the formula needs both beginning and ending inventory. The two statements work together.
Gross profit then feeds into many popular ratios. We cover several of them in our guide to financial ratios for stock analysis. COGS also sits above EBITDA, so a COGS change flows into that figure too.
How Inventory Methods Change the Cost of Goods Sold Formula
Prices change during the year. So which cost do we use when a unit is sold? That depends on the inventory method. The three common ones are FIFO, LIFO, and weighted average.
- FIFO (first in, first out): the oldest units are treated as sold first.
- LIFO (last in, first out): the newest units are treated as sold first.
- Weighted average: every unit carries the average cost of all units available.
FIFO vs LIFO vs Average: A Quick Example
Imagine a store buys 100 units at $10 each. Later, it buys 100 more at $12. Then it sells 150 units.
| Method | How the 150 sold units are costed | COGS |
|---|---|---|
| FIFO | 100 × $10 + 50 × $12 | $1,600 |
| LIFO | 100 × $12 + 50 × $10 | $1,700 |
| Weighted average | 150 × $11 average cost | $1,650 |
Same store, same sales, three different answers. When prices rise, LIFO gives a higher COGS and lower profit. FIFO does the opposite. The IRS explains this effect in Publication 538. It also notes that the effect flips when prices fall.
Where LIFO Is Allowed
Rules differ by country. U.S. tax rules let businesses adopt LIFO by filing Form 970, according to IRS Publication 538. However, the global accounting standard for inventory, IAS 2, allows only specific identification, FIFO, or weighted average cost. LIFO is not on that list.
That matters when we compare companies across borders. A U.S. firm using LIFO and a European firm using FIFO can report different margins for similar businesses.
Real Company Examples of COGS
Numbers from real filings show how much COGS varies by business model. The figures below come from each company’s latest annual report (Form 10-K) filed with the U.S. Securities and Exchange Commission, as of December 2026.
| Company | Fiscal year end | Revenue | COGS label and amount | COGS as % of revenue |
|---|---|---|---|---|
| Apple (AAPL) | Sep 26, 2026 | $478.8 billion | Cost of sales: $245.2 billion | 51.2% |
| Walmart (WMT) | Jan 31, 2026 | $706.4 billion (net sales) | Cost of sales: $535.4 billion | 75.8% |
| Costco (COST) | Aug 30, 2026 | $303.2 billion (total revenue) | Merchandise costs: $264.3 billion | 87.2% |
Sources: Apple 10-K, Walmart 10-K, and Costco 10-K on SEC EDGAR. Percentages are our own math from those filings.
So what do these numbers tell us? Apple keeps almost half of each sales dollar as gross profit. Its software and services help lift that. Costco sits at the other end. It sells goods at thin markups and earns a lot from membership fees instead. Walmart lands in between.
None of these is “good” or “bad” by itself. A high COGS ratio is normal for a discount retailer. The key is to compare a company with its own past and with close peers.
Why the Cost of Goods Sold Formula Matters to Investors
COGS is often the biggest cost a company has. Small shifts can swing profits. Here are the signals we watch:
- Rising input costs: When materials, chips, or freight get pricier, COGS rises. For example, we looked at how a memory chip price surge could pressure Apple’s margins.
- Tariffs: Import taxes often land in COGS for firms that buy goods abroad. Our guide on how tariffs work explains who usually pays.
- Accounting errors: Mistakes in COGS can hit profit guidance hard. In October 2025, UK retailer B&M found about £7 million of overseas freight costs missing from its cost of goods sold. It cut its yearly profit outlook, and its finance chief stepped down, as The Guardian reported. We covered that B&M accounting error in detail.
- Inventory build-up: If inventory grows much faster than COGS, goods may not be selling. That can lead to write-downs later.
Quick Checklist for Reading COGS in a Report
- Find the COGS line under revenue. Note its exact label.
- Divide COGS by revenue. Compare the ratio with the last three years.
- Check the notes for the inventory method (FIFO, LIFO, or average).
- Read management’s comments on costs, freight, and pricing.
- Compare the ratio with two or three close rivals.
Common Mistakes With the COGS Formula
- Mixing up COGS and operating expenses. Ads and office rent are not COGS.
- Forgetting freight-in. The cost to bring goods to your store belongs in COGS.
- Using a mismatched opening inventory. It should equal last period’s closing inventory.
- Comparing firms with different methods. LIFO and FIFO users are not apples to apples.
- Assuming service firms have COGS. Many service businesses report a “cost of revenue” instead, or none at all.
Conclusion
The cost of goods sold formula is short: beginning inventory plus purchases minus ending inventory. Still, it unlocks gross profit, gross margin, and a clear view of how a business makes money. Once we know where COGS sits and which inventory method is used, earnings reports get much easier. Next time a company reports, start with the COGS line. It often tells the story before the headline profit does.
Frequently Asked Questions
What is the cost of goods sold formula?
The cost of goods sold formula is beginning inventory plus purchases minus ending inventory. The result is the direct cost of the goods a business sold during the period.
How do you do a COGS calculation for a small business?
Take the inventory value at the start of the year. Add everything you bought or made for sale. Then subtract the inventory left at year end. U.S. sole owners report this on Schedule C, lines 35 to 42.
Is COGS on the income statement?
Yes. COGS appears on the income statement just below revenue. Revenue minus COGS gives gross profit. Inventory itself appears on the balance sheet.
Is COGS the same as operating expenses?
No. COGS covers direct costs of the products sold, like materials and factory labor. Operating expenses cover running the business, like marketing, rent, and office salaries.
Why does the inventory method change COGS?
FIFO, LIFO, and weighted average assign different unit costs to goods sold. When prices rise, LIFO usually gives a higher COGS than FIFO. When prices fall, the opposite is true.
Interested in the stock market and want to dig into company numbers faster? Check out Meyka. Meyka is an AI-powered stock research and alternative-data platform. It brings prices, financials, and AI insights together in one place, so you can research companies with more context. Its forecasts are research tools, not guarantees.
Disclaimer: This article is for informational purposes only and is not financial advice. Always do your own research or speak with a licensed professional before making investment decisions.
About Author

Danny Kontos
Co FounderDanny Kontos has been a stock investor since 2007 and co-founded Meyka in 2023. He keeps a small, focused portfolio and only moves when the numbers are hard to argue with. He has waited years on a single position before. Before Meyka, he ran a web hosting company and a mortgage lending platform, so he knows what a well-run business actually looks like under the hood. This article did not come from a news cycle. It came from someone who has been watching this space for a long time.
What brings you to Meyka?
Pick what interests you most and we will get you started.
I'm here to read news
Find more articles like this one
I'm here to research stocks
Ask Meyka Analyst about any stock
I'm here to track my Portfolio
Get daily updates and alerts (coming March 2026)