Home » Ecommerce Accounting » Cost of Goods Sold

Understanding Cost of Goods Sold for Online Sellers

Cost of goods sold (COGS) is the total direct cost of producing or purchasing the products your ecommerce business sells during a specific period. It includes the purchase price of your products, inbound shipping and freight costs, import duties and tariffs, and packaging materials required to prepare products for sale. COGS is subtracted from your revenue to calculate gross profit, which is the most fundamental measure of whether your product pricing and sourcing strategy are sustainable. Getting COGS right directly affects the accuracy of your profit reporting, your tax liability, and your ability to make informed pricing and inventory decisions.

The COGS Formula

The basic COGS formula for a period (month, quarter, or year) is: Beginning Inventory + Purchases During the Period - Ending Inventory = Cost of Goods Sold. If you started the month with $20,000 in inventory, purchased $15,000 in new inventory during the month, and ended the month with $18,000 in inventory, your COGS for that month is $20,000 + $15,000 - $18,000 = $17,000. This $17,000 is the cost of the products you actually sold, which gets subtracted from your revenue to determine gross profit.

For example, if that month's revenue was $42,000 and COGS was $17,000, your gross profit is $25,000 and your gross margin is 59.5%. This gross margin tells you that for every dollar of revenue, $0.595 is available to cover operating expenses (marketing, software, rent, payroll) and generate net profit. If your operating expenses are $18,000 per month, your net profit before taxes is $7,000, for a net margin of 16.7%.

The formula seems simple, but the complexity lies in accurately valuing your beginning and ending inventory, properly allocating costs to inventory, and choosing the right inventory accounting method (FIFO, LIFO, or weighted average) for assigning costs to sold units.

What to Include in COGS

Product Purchase Cost

The base cost of each unit from your supplier is the largest component of COGS for most ecommerce sellers. This includes the per-unit price on your supplier invoice, any volume discounts or surcharges, and currency conversion costs if you pay in foreign currency. If you manufacture your own products, the equivalent is your raw material costs plus direct labor and manufacturing overhead directly tied to production.

Inbound Shipping and Freight

The cost of getting products from your supplier to your warehouse or fulfillment center is part of COGS, not a general shipping expense. This includes freight charges, container fees for ocean shipment, domestic trucking from port to warehouse, and any handling fees charged by freight forwarders. If you pay $3,000 to ship a container holding 5,000 units, each unit picks up $0.60 in freight cost added to its inventory value.

Import Duties and Tariffs

Customs duties paid on imported products are part of the landed cost and belong in COGS. The duty rate depends on the product's Harmonized Tariff Schedule (HTS) classification, the country of origin, and any applicable trade agreements or tariff surcharges. A product with an 8% duty rate that costs $10 from the supplier incurs $0.80 in duty per unit. This $0.80 is part of your inventory cost and flows to COGS when the unit sells. Customs brokerage fees paid to your broker for processing the import are also properly included in COGS.

Packaging Materials

Materials used to prepare your product for sale are part of COGS. This includes the product box or bag, inserts, labels, poly bags for protection, tissue paper, and any branded packaging that ships with the product. General shipping supplies used to ship orders to customers (outer boxes, tape, void fill) are an operating expense, not COGS. The distinction is whether the material is part of the product as sold (COGS) or part of the delivery process (shipping expense).

Direct Labor for Product Preparation

If you have warehouse employees who assemble, package, label, or prepare products before they are sellable, their labor is part of COGS. A worker who spends 100% of their time packaging products has their full wages included in COGS. A worker who splits time between packaging (60%) and general warehouse maintenance (40%) has 60% of their wages allocated to COGS and 40% to operating expenses. If you prepare products yourself as a solo seller, you do not include your own labor in COGS for tax purposes.

What to Exclude from COGS

Not every business expense belongs in COGS, and incorrectly including operating expenses inflates your COGS, understates your gross margin, and misrepresents your product economics. The following costs are operating expenses, not COGS.

Outbound shipping to customers is a selling expense, not a product cost. Even though shipping costs are a major expense for ecommerce businesses, they are incurred after the sale and relate to delivery, not to producing or acquiring the product. Record outbound shipping as a separate operating expense category.

Payment processing fees from Stripe, PayPal, Shopify Payments, and other processors are selling expenses. They are the cost of accepting payment, not the cost of the product. Recording processing fees in COGS inflates your product cost and makes it impossible to separately analyze your processing costs versus your product costs.

Marketing and advertising costs including Google Ads, Facebook Ads, Amazon PPC, influencer fees, and content marketing expenses are all operating expenses. These costs drive sales but are not part of producing or acquiring the product.

Software and subscriptions including your Shopify plan, accounting software, email marketing platform, and inventory management tools are operating expenses. They support your business operations but are not direct product costs.

Rent for office or retail space is an operating expense. Warehouse rent specifically used for inventory storage can be argued as part of COGS in some accounting treatments, but most small business accountants classify all rent as operating expenses for simplicity and consistency.

General and administrative expenses including insurance, legal fees, accounting fees, office supplies, and business travel are operating expenses that appear below the gross profit line on your income statement.

Landed Cost: The True Cost of Each Unit

Landed cost is the total cost to get one unit of product from your supplier into your inventory, ready to sell. It includes every component described above: product cost, freight, duties, insurance, customs brokerage, and packaging materials. Calculating accurate landed cost is essential for pricing decisions, margin analysis, and inventory valuation.

Example landed cost calculation for a product sourced from China:

  • Supplier price per unit: $8.00
  • Ocean freight per unit (container cost divided by units): $0.85
  • Import duty at 7.5%: $0.60
  • Customs brokerage per unit: $0.12
  • Domestic trucking per unit: $0.18
  • Product packaging per unit: $0.45
  • Total landed cost per unit: $10.20

If you were pricing this product based only on the $8.00 supplier price, you would understate your true cost by $2.20 per unit, which is 27.5%. Selling this product at $25 with an assumed cost of $8.00 suggests a 68% gross margin. The real margin at $10.20 landed cost is 59.2%. Both are healthy margins, but the difference becomes critical when your margins are thinner, and pricing decisions made on inaccurate costs can turn an apparently profitable product into a money-losing one.

How COGS Affects Your Taxes

COGS directly reduces your taxable income. If your annual revenue is $300,000 and your COGS is $120,000, your gross profit is $180,000. After operating expenses, your taxable net income is whatever remains. Every dollar of legitimate cost that you fail to include in COGS is a dollar that gets taxed unnecessarily. At a 25% effective tax rate, underreporting COGS by $10,000 costs you $2,500 in extra taxes.

The IRS requires businesses with inventory to use an inventory method for determining COGS rather than simply deducting the cost of purchases. This means you cannot deduct the full cost of inventory purchases in the year you buy them. You deduct the cost only when you sell the products. Buying $50,000 of inventory in December does not give you a $50,000 deduction for that year. You get the deduction gradually as each unit sells over the following months.

This is also why the cash vs accrual accounting decision matters for inventory businesses. Under cash basis, you might be tempted to record inventory purchases as immediate expenses. The IRS does not allow this if you carry significant inventory. The accrual method properly matches revenue with the cost of the specific products sold, giving both accurate financial reporting and correct tax treatment.

Common COGS Mistakes

Using supplier price only. Ignoring freight, duties, and packaging understates your true product cost and overstates your margins. Always calculate full landed cost for each product and use that as your inventory cost basis.

Including operating expenses in COGS. Adding marketing, payment processing, or software costs to COGS inflates your product costs and masks the real drivers of your expenses. Keep COGS limited to direct product costs and track operating expenses separately.

Expensing inventory immediately. Recording a $10,000 inventory purchase as a $10,000 expense in the purchase month is incorrect for any business carrying inventory. The cost sits in inventory as an asset and moves to COGS only as units sell. This matters for both accurate monthly reporting and correct tax treatment.

Not tracking COGS by product. Knowing your overall COGS is useful, but knowing COGS per product lets you identify which products are most and least profitable. A product with a 65% gross margin deserves more advertising investment than a product with a 25% margin, and you cannot make that distinction without product-level cost tracking.

Forgetting to update costs when supplier prices change. If your supplier raises prices from $8.00 to $8.75 per unit and you do not update your inventory cost records, your reported margins are overstated until you catch the error. Review and update product costs whenever you place a new purchase order at different pricing.