Sub topic 4
Cost of Goods Sold: The Direct Cost of What You Sold
This chapter assumes you can read the top of an income statement and know what revenue is. It also assumes basic arithmetic and percentages. No accounting training is needed beyond that.
What cost of goods sold measures
Cost of goods sold (COGS) is the direct cost of producing or buying the goods a company sold during the period. Service businesses often call the same line "cost of revenue" or "cost of services." It sits directly under revenue and is subtracted from it to give gross profit.
The key word is sold. COGS does not measure what a company spent on production or purchasing. It measures the cost attached to the units that left the business in this period. Units that were bought or made but not yet sold stay on the balance sheet as inventory.
This follows from the accrual basis. Revenue is recognized when the sale happens, and the cost of the item sold is recognized in the same period. Accountants call this matching.
What goes into COGS
Typical components:
- Raw materials and purchased goods for resale.
- Direct labor, meaning wages of people who make the product.
- Manufacturing overhead, such as factory rent, factory utilities, and depreciation on production equipment.
- Freight-in, the cost of getting inventory to the company.
Typical exclusions:
- Sales commissions, advertising, and store rent for a retail shop floor are usually operating expenses.
- Head office salaries and R&D are operating expenses.
- Interest on borrowing is a non-operating item.
Classification varies by company. A retailer may put distribution costs in COGS, and another may put them in operating expenses. When you compare gross margins between companies, read the accounting policy notes first.
The COGS formula for a merchandiser
For a business that buys and resells goods, COGS comes from the inventory roll-forward:
COGS = beginning inventory + purchases − ending inventory
Think of it as "goods available for sale" minus "goods still on the shelf."
beginning_inventory = 120_000
purchases = 640_000
ending_inventory = 160_000
goods_available = beginning_inventory + purchases
cogs = goods_available - ending_inventory
print(f"Goods available for sale: {goods_available:>10,.0f}")
print(f"Cost of goods sold: {cogs:>10,.0f}")This prints 760,000 for goods available and 600,000 for COGS, which matches the 600,000 used in the income statement example earlier in this tutorial. Inventory grew by 40,000, so the company bought 40,000 more than it sold.
A manufacturer adds a step. It first computes the cost of goods manufactured (materials, labor, and overhead put into production, adjusted for work in progress). It then uses that figure in place of purchases.
Inventory cost methods
When identical items are bought at different prices, the company must decide which cost to assign to units sold. The choice changes COGS, gross profit, and ending inventory, even though the physical flow of goods is the same.
| Method | Assumption | Effect when prices rise |
|---|---|---|
| FIFO (first in, first out) | Oldest costs are expensed first | Lower COGS, higher profit, higher ending inventory |
| LIFO (last in, first out) | Newest costs are expensed first | Higher COGS, lower profit, lower ending inventory |
| Weighted average | Every unit carries the average cost | Results between FIFO and LIFO |
LIFO is permitted under US GAAP but not under IFRS. A company using LIFO often discloses a "LIFO reserve" so analysts can convert to FIFO.
A worked example makes the difference concrete. Suppose a company buys 100 units at 10 and later 100 units at 12, then sells 100 units.
layers = [(100, 10.0), (100, 12.0)] # (units, unit cost), oldest first
units_sold = 100
def cogs_fifo(layers, units):
total = 0.0
for qty, cost in layers:
take = min(qty, units)
total += take * cost
units -= take
if units == 0:
break
return total
def cogs_lifo(layers, units):
return cogs_fifo(list(reversed(layers)), units)
def cogs_average(layers, units):
total_cost = sum(q * c for q, c in layers)
total_units = sum(q for q, _ in layers)
return units * total_cost / total_units
print(f"FIFO COGS: {cogs_fifo(layers, units_sold):,.0f}")
print(f"LIFO COGS: {cogs_lifo(layers, units_sold):,.0f}")
print(f"Average COGS: {cogs_average(layers, units_sold):,.0f}")The output is 1,000 for FIFO, 1,200 for LIFO, and 1,100 for weighted average. If these 100 units sold for 2,000, gross profit is 1,000 under FIFO and 800 under LIFO. Nothing real changed. Only the cost allocation did.
Inventory write-downs
Inventory is carried at the lower of cost and net realizable value (the expected selling price less costs to sell), with slightly different wording under US GAAP and IFRS. If goods become obsolete, damaged, or unsellable at cost, the company writes them down. The write-down usually flows through COGS.
This matters for reading the statement. A large write-down depresses gross margin in that period. If it is a one-time event, you may want to adjust for it when judging underlying performance, as covered later in this tutorial.
Fixed and variable parts of COGS
Some COGS moves with volume (materials, piece-rate labor). Some does not (factory rent, depreciation of machinery). This split has two consequences:
- Gross margin tends to rise when volume rises, because fixed production costs are spread over more units.
- A drop in volume can squeeze gross margin even if prices and material costs are stable.
Do not assume COGS always moves in proportion to revenue. Check the history.
Reading COGS in practice
Compute COGS as a percentage of revenue, which is 100% minus gross margin.
revenue = 1_000_000
cogs = 600_000
prior_revenue = 900_000
prior_cogs = 531_000
print(f"COGS % of revenue (current): {cogs / revenue:.1%}")
print(f"COGS % of revenue (prior): {prior_cogs / prior_revenue:.1%}")The current ratio is 60.0% and the prior ratio is 59.0%. COGS rose faster than revenue, so gross margin fell from 41.0% to 40.0%. Possible causes include higher input costs, discounting, a shift toward lower-margin products, or an inventory write-down. The statement shows that the margin moved, and the notes and management commentary usually explain why.
Related checks:
- Inventory turnover is COGS divided by average inventory. A falling figure means inventory is building up relative to sales.
- Inventory growing faster than sales can signal weak demand and future write-downs.
- Unusually stable gross margin in a volatile industry deserves a question about cost allocation.
Common errors
- Treating all costs of running the business as COGS. Only direct costs of the goods sold belong there.
- Using purchases instead of COGS. Purchases that remain unsold are inventory, not an expense.
- Comparing gross margins across companies without checking where each classifies costs such as distribution and depreciation.
- Ignoring the inventory method. During inflation, FIFO and LIFO companies are not directly comparable.
- Forgetting that services and software companies may report little or no COGS, so a high gross margin may reflect classification, not only a better business.
Exercises
Exercise
A retailer starts the year with 80,000 of inventory, buys 500,000 of goods during the year, and ends the year with 95,000 of inventory. Revenue is 750,000. What are COGS, gross profit, and gross margin?
Show answer
COGS = 80,000 + 500,000 − 95,000 = 485,000. Gross profit = 750,000 − 485,000 = 265,000. Gross margin = 265,000 / 750,000 = 35.3%.
Exercise
Prices of a product are rising. Compared with FIFO, what does LIFO do to COGS, reported profit, and ending inventory, and why?
Show answer
LIFO expenses the newest, higher costs first, so COGS is higher, reported profit is lower, and ending inventory is carried at older, lower costs. FIFO does the opposite. The physical goods and the cash spent are the same under both methods.
Exercise
A company's gross margin rises from 38% to 44%, but its operating margin is unchanged. Name one likely explanation and what you would check.
Show answer
The company may have reclassified costs, such as distribution or depreciation, from COGS to operating expenses. Check the accounting policy notes and any restatement of prior-year figures, and compare operating margin across periods.