What Is Cost of Goods Sold? Formula, Methods, and Tax Filing

Cost of goods sold is the total of every direct cost your business incurred to produce or purchase the items it sold during a tax year or accounting period. You find it with one formula: beginning inventory, plus purchases and production costs, minus ending inventory. The result reduces your taxable income, which is why the IRS pays close attention to how you arrive at it.

The Formula

The math is the same whether you resell finished goods or manufacture them:

Beginning Inventory + Purchases and Production Costs − Ending Inventory = Cost of Goods Sold

Beginning inventory is whatever you had on hand at the start of the tax year, which for most businesses equals the ending inventory from the prior year. To that you add every cost directly tied to acquiring or producing goods during the year: raw materials, merchandise bought for resale, direct labor, and manufacturing overhead. Subtract what’s still on the shelf at year end, and you’ve isolated the cost of the goods that actually left the business.

Inventory sitting in your warehouse isn’t an expense yet. Federal law requires businesses to track inventory in a way that clearly reflects income, so you can only deduct the cost of goods you’ve actually sold.1Office of the Law Revision Counsel. 26 USC 471 – General Rule for Inventories

What Counts as a Direct Cost

The IRS separates costs that belong in COGS from ordinary business expenses deducted elsewhere. The line matters because misclassifying a cost shifts income between years and inflates or shrinks your gross profit.

  • Raw materials and merchandise. Anything that physically becomes part of the finished product or that you bought to resell. Lumber for a furniture shop, fabric for a clothing line, wholesale goods for a retail store.
  • Direct labor. Wages and benefits paid to employees who physically work on producing goods, including the payroll taxes your business pays on those wages.
  • Manufacturing overhead. Rent, utilities, insurance, depreciation, and maintenance for your production facility. These don’t attach to a single unit the way materials do, but they keep the factory running.2Internal Revenue Service. Publication 334 (2025), Tax Guide for Small Business
  • Freight-in. Shipping charges to get raw materials or merchandise to your warehouse or factory.2Internal Revenue Service. Publication 334 (2025), Tax Guide for Small Business

Outbound shipping to your customers is a selling expense, not a production cost. The IRS treats containers and packaging the same way when they aren’t part of the product itself. Office rent, marketing, sales commissions, and administrative salaries all fall outside COGS and are deducted as operating expenses further down the return. Miscategorizing a selling expense as COGS won’t change your total deductions, but it will overstate COGS and understate gross profit, which can draw questions during an audit.2Internal Revenue Service. Publication 334 (2025), Tax Guide for Small Business

A Retail Example

A clothing boutique starts the quarter with $40,000 in inventory. Over three months the owner buys $100,000 in new merchandise from wholesalers. A physical count at quarter’s end shows $30,000 in unsold clothing.

  • Beginning inventory: $40,000
  • Plus purchases: $100,000
  • Goods available for sale: $140,000
  • Minus ending inventory: $30,000
  • COGS: $110,000

That $110,000 is the direct cost of every item the boutique sold during the quarter. If revenue was $180,000, gross profit is $70,000. Rent, advertising, and payroll for non-production staff still come out before net profit, but COGS tells you whether the pricing strategy covers the cost of the merchandise itself.

A Manufacturing Example

A furniture manufacturer starts the year with $50,000 in raw materials and $20,000 in partially finished pieces (work-in-process). During the year the company spends $150,000 on new lumber and hardware, pays $80,000 in wages to shop-floor workers, and incurs $40,000 in factory overhead for electricity, equipment maintenance, and shop rent.

  • Beginning inventory (materials plus work-in-process): $70,000
  • Plus materials purchased: $150,000
  • Plus direct labor: $80,000
  • Plus factory overhead: $40,000
  • Total production pool: $340,000
  • Minus ending raw materials: $30,000
  • Minus ending work-in-process: $15,000
  • COGS: $295,000

Manufacturing COGS is more complex because you’re tracking three inventory categories (raw materials, work-in-process, and finished goods) instead of one. The craftsmen’s wages and the shop’s electric bill both landed inside COGS because they’re tied to production. The office manager’s salary would be an operating expense.

Inventory Valuation Methods

The formula tells you to subtract ending inventory, but not how to value that inventory when identical items were bought at different prices during the year. The method you pick can meaningfully change your tax bill.

FIFO (First-In, First-Out)

FIFO assumes the oldest inventory is sold first. Ending inventory carries the most recent purchase prices, and COGS reflects older, typically lower prices. When costs are rising, FIFO produces a lower COGS and higher taxable income than the alternative.3Internal Revenue Service. Publication 538 (Rev. January 2022)

LIFO (Last-In, First-Out)

LIFO assumes the most recently purchased items are sold first. COGS reflects newer, higher prices, so taxable income is lower when costs are rising. There’s a catch: if you use LIFO for taxes, you must also use it in financial statements reported to shareholders and creditors. You elect LIFO by filing Form 970 with the return for the first year you want to use it.4Office of the Law Revision Counsel. 26 USC 472 – Last-In, First-Out Inventories

Specific Identification

When each item is unique or individually trackable, such as art, cars, or custom furniture, you match the actual cost to each specific item sold. It’s the most precise method, but only practical when items aren’t interchangeable.3Internal Revenue Service. Publication 538 (Rev. January 2022)

Your choice is sticky. Once you’ve filed a return using a particular method, switching requires IRS approval on Form 3115, generally with a Section 481(a) adjustment to prevent income from being duplicated or skipped in the transition year.3Internal Revenue Service. Publication 538 (Rev. January 2022)

The Small Business Exemption

Not every business needs to track inventory this closely. If your average annual gross receipts over the prior three tax years don’t exceed $32 million (the inflation-adjusted threshold for 2026), you qualify for a simplified approach.5Internal Revenue Service. Revenue Procedure 2025-32

A qualifying business can treat inventory as non-incidental materials and supplies, deducting the cost when items are sold or used rather than running the full beginning-ending inventory calculation. You can also follow whatever method your financial statements use. The exemption comes from Section 471(c) and removes the general requirement to maintain inventories in the way the IRS otherwise prescribes.1Office of the Law Revision Counsel. 26 USC 471 – General Rule for Inventories

The same threshold exempts qualifying businesses from the uniform capitalization rules under Section 263A, which otherwise require manufacturers and resellers to capitalize certain indirect costs into inventory. For a small manufacturer, the exemption can simplify bookkeeping and accelerate deductions.6Office of the Law Revision Counsel. 26 USC 263A – Capitalization and Inclusion in Inventory Costs of Certain Expenses

Where COGS Goes on Your Tax Return

The dollar figure lands in roughly the same place on each form (right below total revenue, so gross profit falls out naturally), but the form itself depends on how your business is structured:

Form 1125-A is the standardized COGS worksheet. It walks through beginning inventory, purchases, labor, materials, other costs, and ending inventory, essentially the formula broken into line items. It also asks which inventory valuation method you’re using, so the IRS can verify consistency year over year.

Penalties for Misstating Inventory

Overstating ending inventory understates COGS, which pushes reported income up. The more tempting error runs the other direction: understating ending inventory inflates COGS and shrinks taxable income. The IRS treats either mistake as a potential accuracy-related penalty under Section 6662.

The standard penalty is 20% of the tax underpayment caused by the misstatement. If the IRS decides the error rises to the level of a gross valuation misstatement, the penalty doubles to 40%.11Office of the Law Revision Counsel. 26 USC 6662 – Imposition of Accuracy-Related Penalty

Documentation is the defense. The IRS expects you to keep purchase invoices, receipts, canceled checks, and descriptions of every item bought for resale or production. Payroll records for production workers, freight-in shipping receipts, and year-end inventory count sheets should be organized by year and type. If you can show how every number on the return was calculated, an auditor has far less room to argue the figures are wrong.12Internal Revenue Service. What Kind of Records Should I Keep