E-Commerce Inventory Accounting: COGS, FIFO vs Average Cost, and When UNICAP Applies
Cost of goods sold is usually the largest single deduction on an online seller’s tax return, and it is calculated differently depending on which costing method the business elects, which means the same sales year can produce a meaningfully different taxable income number depending on that choice. Under IRC 471, a business that sells merchandise must account for inventory, and the two most common methods, FIFO (first-in, first-out) and weighted average cost, allocate cost between what was sold and what is still on the shelf in different ways when unit costs change over time. Layered on top of that is IRC 263A (the uniform capitalization rules, “UNICAP”), which forces larger sellers to capitalize certain indirect costs (like a portion of purchasing, storage, and handling labor) into inventory instead of deducting them immediately, and landed cost questions (freight, duty, and customs on imported goods) that many sellers under-track. Getting inventory accounting wrong does not just create an audit risk; it can mean paying more tax than necessary in a growth year, or a costing method that quietly overstates profit in a year when unit costs are rising.
COGS is calculated as beginning inventory, plus purchases (or production costs) during the year, minus ending inventory, and the costing method used to value that ending inventory (FIFO, weighted average, or specific identification) directly changes the COGS figure and therefore taxable income whenever unit costs are not flat. The small business exemption from full UNICAP capitalization applies to businesses with average annual gross receipts of $32 million or less for 2026 (indexed annually, up from $31 million for 2025), under the exception in IRC 263A(i); most online sellers fall well under this threshold and are exempt from the full UNICAP calculation. Landed cost (product cost, inbound freight, customs duty, and any prep fees before the item is available for sale) belongs in the cost basis of inventory, not as a separate operating expense. Inventory write-downs for obsolete or unsellable stock need to be supported by documentation (a physical count, a specific identification of the affected units, and a basis for the reduced value), not just an estimate applied at year end.
Why does cost of goods sold matter this much?
COGS is subtracted from gross revenue before arriving at gross profit, and because inventory-based businesses often operate on tight margins, the COGS figure has an outsized effect on taxable income relative to almost any other line on the return. The basic formula is beginning inventory plus purchases (or, for a manufacturer, production costs) minus ending inventory equals cost of goods sold. Two sellers with identical revenue can report very different taxable income if one systematically overstates ending inventory (understating COGS, overstating profit and tax) or understates it (understating profit and potentially understating tax in a way that draws IRS attention if it does not match a physical count).
- Inventory must be counted, and the count has to tie to the books. A physical inventory count (or a well-maintained perpetual inventory system reconciled periodically against a physical count) is the control that keeps the COGS calculation honest. A seller that only estimates ending inventory from a point-of-sale system without ever physically verifying it is exposed if the estimate drifts from reality, which happens more often than most sellers assume once shrinkage, damage, and miscounts from suppliers enter the picture.
- The method has to be applied consistently, and changing it requires IRS consent. Once a business adopts an inventory costing method (FIFO or weighted average, most commonly, for a typical e-commerce seller) on a filed return, changing it later generally requires filing Form 3115, Application for Change in Accounting Method, which is a specific procedural requirement, not something that can just be switched year to year based on which method produces a better result.
FIFO versus weighted average cost: what’s the difference?
Both methods answer the same question (what cost do we assign to the units sold this year versus the units still on the shelf) but they answer it differently, and the difference only matters when unit cost is changing over time. If every unit ever purchased cost exactly the same, FIFO and weighted average produce an identical result.
- FIFO (first-in, first-out) assumes the oldest inventory (by purchase date) is sold first, so cost of goods sold reflects the oldest, earliest-purchased unit costs, and ending inventory reflects the most recently purchased (and, in a period of rising costs, more expensive) units. In a period of rising costs, FIFO produces lower COGS and higher reported profit (and higher tax) than weighted average would, because the cheaper, older costs get expensed first while the pricier recent costs sit on the balance sheet as inventory value.
- Weighted average cost recalculates a blended average cost per unit each time new inventory is purchased (or, under a periodic system, at the end of the period), and applies that average to both units sold and units remaining. It smooths out cost fluctuations, producing a COGS figure that sits between what FIFO and LIFO (last-in, first-out, rarely used by small e-commerce sellers due to its complexity and the requirement to use it for financial statements if used for tax) would each produce.
- Specific identification tracks the actual, specific cost of each individual unit, most practical for sellers of unique or high-value items (custom furniture, one-of-a-kind goods) where units are not interchangeable. Most e-commerce sellers of standardized, interchangeable SKUs use FIFO or weighted average instead, since specific identification is impractical at volume.
- The method choice matters most when supplier costs, freight rates, or customs duties are moving. A seller who imports the same product and saw landed cost per unit rise from $8 to $11 over the year due to freight cost increases will show meaningfully different profit under FIFO (expensing the cheaper $8 units first) versus weighted average (blending the $8 and $11 costs together immediately).
What’s landed cost, and why does it matter for COGS?
Landed cost is the total cost of getting inventory to the point where it is available for sale, not just the price paid to the supplier. For any seller importing product or paying meaningful inbound freight, landed cost is often understated in the books, which understates COGS and overstates profit.
- Product cost is the base price paid to the manufacturer or supplier.
- Inbound freight (ocean, air, or domestic trucking to get the product to the seller’s warehouse or fulfillment center) is part of the cost of the inventory, not a separate freight expense line, under general inventory costing principles and the capitalization rules of IRC 263A.
- Customs duties and tariffs paid to import the goods are part of landed cost as well. A seller who imports a product subject to a 15% tariff and does not roll that duty into the per-unit cost basis is understating COGS by the full amount of duty paid, which overstates margin in every internal report and overstates taxable profit on the return.
- Prep and inbound handling fees (labeling, poly-bagging, or other prep required before the item is sellable, including fees charged by a 3PL or by Amazon for FBA prep services) also belong in landed cost.
- A practical approach: calculate a landed cost multiplier or per-unit adjustment periodically (for example, “add 18% to invoice cost to arrive at landed cost” based on recent actual freight and duty experience) and apply it consistently, rather than trying to trace freight and duty invoices to specific units after the fact, which is rarely practical at e-commerce volume.
When does IRC 263A (UNICAP) apply to an online seller?
UNICAP requires certain indirect costs, beyond the direct product cost and inbound freight already discussed, to be capitalized into inventory rather than deducted immediately, but a small business exception exempts most e-commerce sellers from this entirely.
- The small business exception, added by the Tax Cuts and Jobs Act and codified at IRC 263A(i), exempts a taxpayer (other than a tax shelter) whose average annual gross receipts for the three prior tax years do not exceed a threshold that is indexed for inflation: $31 million for 2025, rising to $32 million for 2026. A seller under this threshold is not required to apply the full UNICAP capitalization rules at all.
- Above the threshold, UNICAP requires capitalizing a share of costs like purchasing department labor, a portion of warehouse rent and utilities allocable to inventory storage, and certain administrative overhead directly related to inventory, spreading those costs across inventory on the balance sheet rather than deducting them as incurred. This is calculated using either the simplified production method, the simplified resale method, or a more detailed facts-and-circumstances allocation, and it is a meaningfully more complex calculation than what most e-commerce sellers need to perform.
- The exception is measured on a rolling three-year average, and it can be lost as a business grows. A seller crossing the threshold (whether from organic growth or an acquisition) needs to start applying full UNICAP going forward, generally requiring a method change filed on Form 3115. This is a bridge most sellers do not need to cross for years, but a fast-growing seller approaching eight or nine figures in revenue should have this on the radar rather than discover it retroactively.
How should write-downs for obsolete inventory be handled?
Inventory that is unsellable at its recorded cost, whether from damage, obsolescence (a discontinued SKU, a seasonal item that missed its window, expired product) or excess quantity that will only move at a steep discount, should be written down to its actual realizable value, but the write-down needs support, not just a year-end estimate.
- Document the specific units and the basis for the write-down. A physical count identifying the specific SKUs and quantities affected, a description of why they are impaired (damaged, discontinued, expired), and a reasonable basis for the reduced value (a liquidation price actually being used, a comparable sale) supports the deduction if the return is examined. A blanket year-end adjustment with no supporting detail is the version that gets challenged.
- A write-down is generally not the same as a bad debt or a casualty loss, and the tax treatment depends on which category actually applies (a normal inventory valuation adjustment under the seller’s costing method, versus a casualty loss under IRC 165 for inventory destroyed in an identifiable event like a warehouse fire or flood). Mischaracterizing one as the other is a common preparer-level error.
- Physical counts matter more here than anywhere else in inventory accounting. A perpetual inventory system (tracking units through a point-of-sale or inventory management platform in real time) is useful for day-to-day operations, but it should be periodically verified against an actual physical count, since the two drift apart over time from unrecorded shrinkage, receiving errors, and miscounts, and a write-down calculated from an unverified perpetual balance is on weaker footing than one confirmed by a recent physical count.
What should I do next?
Confirm which inventory costing method your business currently uses on its filed returns, and whether that election was ever formally made (rather than just defaulted to by whatever your accounting software calculates). Check whether your landed cost calculation actually includes freight and customs duty, or whether those are sitting in a separate expense account understating your true product cost. If your average gross receipts are approaching $32 million (the 2026 threshold), get ahead of the UNICAP small business exception threshold before you cross it.
- E-commerce sales tax nexus: economic nexus, Wayfair, and multistate compliance, the sales tax side of holding inventory across state lines
- Amazon FBA tax issues, how commingled FBA inventory should be costed
- Shopify bookkeeping: chart of accounts and sales tax tracking, where the COGS entry fits into your monthly close
- Dropshipping tax treatment, why a dropshipper’s COGS calculation looks completely different when inventory is never held
- Selling internationally: customs, duties, VAT, and compliance, the outbound side of the same customs and duty exposure covered here on the inbound, import side
Related guides:
- Ecommerce Amazon Fba Tax Inventory Nexus
- Ecommerce Dropshipping Tax Sales Tax Income
- Ecommerce Entity Structure Llc Scorp Tax Planning
- Ecommerce International Selling Customs Duties Tax
- Ecommerce Quarterly Estimated Taxes Self Employment
Related guides:
Start with a Diagnostic: a CPA licensed in the US and Canada reads your file and tells you in writing what's wrong and how to fix it, three to four business days after you finish the questions. The report is $250. If you hire us for any work after that, you get the $250 back as a discount on that work. Or send us your return or your letter and get a fixed price, free.
One or two plain-English guides a week on US-Canada tax. No spam, unsubscribe anytime.
Done. The next guide will land in your inbox.
Yarik Yarosh, CPA. "E-Commerce Inventory Accounting: COGS, FIFO vs Average Cost, and When UNICAP Applies." Blue Cloud CPA, September 4, 2026, updated October 4, 2026. https://bluecloudcpa.com/guides/ecommerce-inventory-accounting-cogs-methods
This guide is general information, not tax advice for your specific situation. Which points apply, and how, depends on your facts.