Cost of Goods Sold: How to Calculate It
The cost of goods sold (COGS) calculation starts with a simple formula: beginning inventory plus purchases minus ending inventory. But the result depends entirely on which inventory cost-flow assumption you choose—FIFO, LIFO, or weighted average—because those methods assign different unit costs to items sold and items on hand. The method you pick affects not just COGS, but gross profit, taxable income, and earnings per share.
The Basic COGS Formula
The easiest way to think about COGS is:
COGS = Beginning Inventory + Purchases − Ending Inventory
The logic: you start the period with inventory on hand (beginning balance). You buy more goods during the period (purchases). At the end, you count what’s left (ending inventory). Whatever you don’t have at the end, you must have sold.
Example: A retailer begins January with $50,000 in widgets. Over January, it buys $120,000 more. At month-end, it counts $35,000 of widgets still on the shelf. COGS for January = $50,000 + $120,000 − $35,000 = $135,000.
This $135,000 goes on the income statement as an expense deducted from revenue to calculate gross profit. The $35,000 ending inventory appears on the balance sheet as a current asset.
The Inventory Cost-Flow Problem
The catch: which units did you sell? If you bought widgets at different prices ($10 each in January, $11 in March, $12 in October), and you sold 10,000 units, which 10,000 did you sell? Did you sell the cheap January ones, the expensive October ones, or a mix?
In reality, if you’re selling widgets from a big pile, you don’t know which physical unit was which. But you have to assign a cost to “units sold” for COGS. The choice of assumption—FIFO, LIFO, or weighted average—determines which cost layers you remove first.
FIFO: First-In, First-Out
FIFO assumes you sell the oldest inventory first. The units purchased earliest are the units sold first; the units on hand at the end are the most recent purchases.
Example:
- Beginning inventory: 1,000 units @ $10 = $10,000
- March purchase: 2,000 units @ $12 = $24,000
- October purchase: 1,500 units @ $15 = $22,500
- Total available for sale: 4,500 units = $56,500
- Units sold during period: 3,200
- Ending inventory: 1,300 units
Under FIFO, you sold:
- 1,000 units from beginning (@ $10) = $10,000
- 2,000 units from March (@ $12) = $24,000
- 200 units from October (@ $15) = $3,000
- COGS = $37,000
Ending inventory = 1,300 units from October (@ $15) = $19,500
Check: $10,000 + $24,000 + $22,500 − $19,500 = $37,000. ✓
In a rising-price environment, FIFO gives lower COGS (you sold the cheap stuff first), higher gross profit, and higher taxable income. Balance sheet inventory is valued at recent, higher prices—closer to fair value.
LIFO: Last-In, First-Out
LIFO assumes you sell the most recent purchases first. Ending inventory is the oldest, cheapest purchases.
Same example:
- Total available: 4,500 units = $56,500
- Units sold: 3,200
Under LIFO, you sold:
- 1,500 units from October (@ $15) = $22,500
- 1,700 units from March (@ $12) = $20,400
- COGS = $42,900
Ending inventory = 1,000 units from beginning (@ $10) + 300 units from March (@ $12) = $10,000 + $3,600 = $13,600
Check: $10,000 + $24,000 + $22,500 − $13,600 = $42,900. ✓
In a rising-price environment, LIFO gives higher COGS (you sold the expensive stuff first), lower gross profit, and lower taxable income. Balance sheet inventory is valued at old, lower prices—less relevant to current replacement cost, but a tax benefit in inflationary periods.
LIFO reserve: The difference between FIFO inventory value and LIFO inventory value on the balance sheet is disclosed separately. In high inflation, LIFO reserve can be enormous.
Weighted Average
Weighted average (or average cost) assigns all units the same average cost per unit.
Same example:
- Total units available: 4,500
- Total cost: $56,500
- Average cost per unit = $56,500 ÷ 4,500 = $12.56
- Units sold: 3,200 @ $12.56 = $40,192
- Ending inventory: 1,300 @ $12.56 = $16,328
Check: $10,000 + $24,000 + $22,500 − $16,328 = $40,192. ✓
Weighted average gives a middle ground: COGS between FIFO and LIFO, gross profit between the two, and inventory valuation between the two. It’s simpler conceptually and less volatile across periods.
Periodic vs. Perpetual Inventory Systems
The calculation depends on whether you track inventory continuously (perpetual) or only at period-end (periodic).
Periodic: You count inventory once at year-end. You calculate COGS using the formula above. Most small retailers use periodic.
Perpetual: You update inventory records after every sale (now automated in point-of-sale systems). COGS is calculated incrementally as units leave inventory. Ending inventory is the remaining balance. For LIFO and FIFO under perpetual, the timing of sales matters—you remove the most recent purchase at the moment of sale, not at year-end.
Manufacturing and Production Overhead
Retailers calculate COGS simply: purchase price of goods sold. Manufacturers must include direct materials, direct labor, and allocated manufacturing overhead (e.g., factory depreciation). This complicates the ending inventory value—it includes not just raw materials but also work-in-process and finished goods.
For manufacturers, accrual accounting and inventory turnover ratios become critical to ensure overhead is assigned consistently.
Tax and Reporting Requirements
Under US tax law, companies must disclose their inventory cost-flow method and use it consistently year-to-year. Changing from FIFO to LIFO or vice versa requires disclosure and approval; the IRS treats it as a material accounting change.
Companies using LIFO in the US (uncommon outside America) must file Form 970 to elect LIFO for tax purposes. Many US companies use LIFO for tax and FIFO for book reporting (allowed if they disclose the difference).
International Financial Reporting Standards (IFRS) allow FIFO and weighted average but prohibit LIFO, so multinational companies often use FIFO or weighted average.
Why the Method Matters
In inflation, COGS can swing 10–20% or more depending on the method chosen:
- FIFO: Higher reported profit, higher tax.
- LIFO: Lower reported profit, lower tax, larger LIFO reserve liability if you later switch methods.
- Weighted average: Moderate profit, moderate tax, stable inventory value.
For earnings quality, analysts often adjust for LIFO reserve changes to compare companies on a consistent basis. A company using LIFO in high inflation looks less profitable on paper but is deferring taxes. Over the company’s lifetime, the total COGS is the same; the method just shifts when the cost appears.
See also
Closely related
- Gross profit margin — COGS as a percentage of revenue; varies by method
- Income statement — financial statement showing COGS and gross profit
- Inventory turnover — how fast inventory moves; calculated with COGS
- Accrual accounting — method that records COGS when goods are sold, not when paid
- Balance sheet — shows ending inventory as a current asset
- Generally accepted accounting principles — defines inventory cost-flow methods
Wider context
- Depreciation — allocation of asset cost over time; similar logic to inventory
- Revenue recognition — when to record sales revenue matched against COGS
- Financial statement analysis — comparing COGS across companies and periods
- Earnings per share — net income per share; COGS affects numerator
- International Financial Reporting Standards — prohibits LIFO method