To calculate cost of goods sold for taxes, take your beginning inventory, add everything you purchased or produced during the year, and subtract the inventory left on hand at year-end. That figure comes off your revenue before the IRS taxes what remains, so an error in COGS moves through every line below it on your return.
The Formula and a Worked Example
Beginning Inventory + Purchases (or Production Costs) − Ending Inventory = Cost of Goods Sold.
Say your business starts the year with $50,000 in inventory, buys another $200,000 during the year, and counts $40,000 still on the shelves on December 31. COGS is $210,000. That amount offsets your revenue when you calculate gross profit. The $40,000 in unsold goods stays on your balance sheet as an asset until it sells in a later period.
The arithmetic is easy. The work is in knowing which dollars belong in each slot.
What Costs Belong Inside COGS
Federal tax rules require businesses that produce or resell merchandise to track inventory and match production costs against the revenue those goods generate.1Office of the Law Revision Counsel. 26 U.S. Code 471 – General Rule for Inventories Three cost categories feed the formula:
- Direct materials: the raw materials and components that physically become part of the finished product, plus freight to get them to your facility.
- Direct labor: wages, payroll taxes, and benefits for employees who work on the production floor or assembly line. Administrative salaries do not count.
- Manufacturing overhead: factory utilities, equipment depreciation, and facility rent tied to production.
The test is whether a cost relates to making the product or to running the business. Your factory’s electric bill goes into COGS. Your corporate office’s electric bill does not.
Manufacturers have to dig further. Federal regulations pull a range of indirect production expenses into inventory values: repair and maintenance on production equipment, quality control and inspection, indirect materials and supplies, production supervisory wages, and small tools not capitalized as separate assets. Property taxes on a factory, pension contributions and health insurance for production workers, and insurance on production equipment get included if you already treat them as production costs in your financial statements.2eCFR. 26 CFR 1.471-11 – Inventories of Manufacturers
Businesses that manufacture goods or buy them for resale must generally capitalize both direct and indirect costs into inventory under Section 263A, known as the UNICAP rules.3Office of the Law Revision Counsel. 26 U.S. Code 263A – Capitalization and Inclusion in Inventory Costs of Certain Expenses Those costs sit in inventory and only reduce taxable income when the goods sell. UNICAP catches warehouse rent, purchasing department salaries, packaging, and a share of administrative overhead allocable to production. Smaller businesses are exempt, discussed below.
Adjusting Your Purchases Figure
The number you plug in for purchases is not the raw total on your invoices. Several adjustments bring it to its true value.
- Trade discounts: if a supplier lists an item at $100 but you consistently pay $85, record $85 as your cost. The discount is not income.4Internal Revenue Service. Publication 334 – Tax Guide for Small Business
- Cash discounts: prompt-payment discounts can either reduce purchase cost directly or go into a separate discount account you include in income at year-end. Pick one and stick with it.4Internal Revenue Service. Publication 334 – Tax Guide for Small Business
- Returns and allowances: anything sent back to a supplier reduces total purchases.
- Personal use: if you pulled inventory for personal use, subtract the cost of those items from purchases. Sole proprietors often miss this, and it draws audit attention.
Freight-in charges go the other direction. Shipping to get raw materials or merchandise to your location is part of purchase cost, not a separate operating expense.
Choosing an Inventory Valuation Method
Two identical widgets bought six months apart rarely cost the same. The valuation method determines which cost gets assigned to the goods you sold and which stays in ending inventory. Federal tax law requires you to pick a method and apply it consistently.5eCFR. 26 CFR 1.471-2 – Valuation of Inventories
- FIFO (First-In, First-Out): assumes the oldest inventory sells first. When prices are rising, FIFO produces a lower COGS and higher taxable income, because older, cheaper costs flow to the income statement while newer purchases stay in ending inventory.
- LIFO (Last-In, First-Out): assumes the newest inventory sells first. In an inflationary period, LIFO pushes higher recent costs into COGS and lowers taxable income. If you use LIFO for tax purposes, you must also use it in financial statements provided to shareholders or lenders.6Internal Revenue Service. LIFO Conformity for U.S. Corporations with Foreign Subs
- Lower of cost or market: values each item at what you paid or its current replacement cost, whichever is less. Useful for products that lose value quickly.
Switching methods between years is not casual. File Form 3115 (Application for Change in Accounting Method), typically attached to your return for the year of the change, with a copy sent to the IRS National Office.7Internal Revenue Service. Instructions for Form 3115
Gathering the Numbers
Your beginning inventory is last year’s ending inventory, and the two figures should match exactly. If they do not, because of a method change or a counting error, attach an explanation to your return.4Internal Revenue Service. Publication 334 – Tax Guide for Small Business
Purchase totals come from your general ledger and should reconcile with supplier invoices and payment records. For manufacturers, beginning inventory includes raw materials and work-in-process, meaning partially completed products still on the production floor, in addition to finished goods.4Internal Revenue Service. Publication 334 – Tax Guide for Small Business
Ending inventory requires a physical count of what remains on hand at the close of the period. Many businesses count on the last day of the fiscal year or as close to it as possible. A sloppy count skews COGS in ways that are hard to catch later.
The Extra Step for Manufacturers
Retailers buy finished goods and resell them, so the standard formula works cleanly. Manufacturers have work-in-process to account for. The cost of goods manufactured is calculated first, then plugged into the broader COGS formula.
The sequence: beginning work-in-process inventory, plus all production costs added during the period (materials, direct labor, factory overhead), minus ending work-in-process inventory. That result is the cost of goods manufactured, meaning everything that moved from the production floor to the finished-goods shelf. It replaces the “purchases” line in the standard formula.
The Small Business Exemption
Not every business has to work through formal inventory accounting. If your average annual gross receipts over the prior three tax years do not exceed $32 million (the inflation-adjusted threshold for 2026), you qualify as a small business taxpayer and can skip the standard inventory rules.8Internal Revenue Service. Revenue Procedure 2025-32 The exemption also frees you from UNICAP.3Office of the Law Revision Counsel. 26 U.S. Code 263A – Capitalization and Inclusion in Inventory Costs of Certain Expenses
Qualifying businesses have two simplified options. You can treat inventory as non-incidental materials and supplies, essentially deducting cost when you use or sell items rather than tracking formal inventory layers. Or you can use whatever method appears in your financial statements or internal books.1Office of the Law Revision Counsel. 26 U.S. Code 471 – General Rule for Inventories For many small retailers and sole proprietors, this cuts accounting complexity sharply.
Tax shelters are excluded from the exemption regardless of gross receipts. The $32 million threshold adjusts annually for inflation, so check the current IRS revenue procedure if you’re near the line.
Where to Report COGS on Your Return
The reporting location depends on entity type.
- Sole proprietors: calculate COGS in Part III of Schedule C (Form 1040), lines 35 through 42. The result flows to line 4 of Schedule C and reduces gross income from the business.9Internal Revenue Service. Instructions for Schedule C (Form 1040)
- Corporations, S corporations, and partnerships: attach Form 1125-A (Cost of Goods Sold) to the entity’s return. Form 1120 for C corporations, Form 1120-S for S corporations, Form 1065 for partnerships.10Internal Revenue Service. Form 1125-A – Cost of Goods Sold
Both walk through the same basic structure: beginning inventory, plus costs added during the year, minus ending inventory. The forms also ask you to identify your valuation method and whether you’re using LIFO, which lets the IRS check consistency across years.
What Stays Out of COGS
Selling, general, and administrative expenses belong below the gross profit line on the income statement, not in COGS. Marketing and advertising, office rent for non-production space, salaries for accountants and HR staff, and legal fees are real business costs, but they do not relate to making or acquiring the product.
Outbound shipping is the common trap. Freight-in (materials to your facility) goes into COGS. Freight-out (finished goods to buyers) does not. Misclassifying outbound shipping inflates COGS, understates gross profit, and creates problems on examination.
Service businesses generally don’t have traditional COGS, since they aren’t selling tangible products. A consulting firm or law office reports its direct costs as “cost of services” or as operating expenses. If a service business also sells some physical products, only those product-related costs run through the COGS calculation.
Recordkeeping the IRS Expects
The IRS expects records that support every number on your return. For COGS, that means purchase invoices, shipping receipts, payroll records for production workers, and physical inventory count sheets.11Internal Revenue Service. What Kind of Records Should I Keep During an audit, the IRS asks for documentation supporting claimed income and deductions.12Internal Revenue Service. Audits Records Request
If your records cannot back up the COGS figure you reported, the IRS can disallow the deduction, leaving you owing tax on revenue that should have been offset by legitimate production costs. Accuracy-related penalties apply at 20% of the underpayment, rising to 40% for a gross valuation misstatement.13Office of the Law Revision Counsel. 26 U.S. Code 6662 – Imposition of Accuracy-Related Penalty on Underpayments Keep employment records for at least four years and other business records for at least as long as your returns remain open, generally three years from the filing date, longer if the IRS suspects substantial underreporting.