Skip to main content
True MarginTrue Margin
How to Calculate Cost of Goods Sold (COGS) for Ecommerce
← Back to blog

How to Calculate Cost of Goods Sold (COGS) for Ecommerce

By Jack·March 10, 2026·11 min read

COGS = Beginning Inventory + Purchases - Ending Inventory. That's the formula. But for most ecommerce founders, the problem isn't the math — it's knowing what actually belongs in that number. Get COGS wrong and every margin calculation downstream is fiction.

This guide covers exactly what counts as COGS (and what doesn't), how the calculation differs for dropshipping vs private label vs manufacturing, worked examples at different revenue scales, and the mistakes that cause founders to significantly undercount COGS.

The COGS Formula

Cost of goods sold measures the direct cost of the products you actually sold during a period. Not what you bought. Not what's sitting in your warehouse. What left the door.

COGS = Beginning Inventory + Purchases During Period - Ending Inventory

If you started the month with $10,000 in inventory, bought $25,000 more, and ended with $12,000 on hand, your COGS is $23,000. That's how much product value walked out the door as orders.

ComponentAmountWhat It Represents
Beginning inventory$10,000Value of unsold products at start of period
+ Purchases$25,000All inventory bought during the period
- Ending inventory$12,000Value of unsold products at end of period
= COGS$23,000Direct cost of products sold

COGS is not a cash flow number. You might have paid for that inventory two months ago. COGS captures when the product was sold, not when you paid for it. This distinction matters for calculating your profit margin accurately.

What Counts as COGS (And What Doesn't)

This is where most founders get it wrong. COGS includes every cost directly tied to getting the product into a sellable state. If you removed the cost and couldn't sell the product, it's COGS.

Included in COGS

  • Product cost — wholesale price, raw materials, or manufacturing cost per unit
  • Inbound shipping / freight — sea freight, air freight, or trucking from supplier to your warehouse
  • Customs duties and tariffs — import taxes paid to bring product into your country
  • Packaging materials — boxes, poly mailers, inserts, labels, tissue paper, stickers
  • Manufacturing labor — if you produce the product yourself, direct labor costs
  • Quality inspection — third-party inspection fees at the factory
  • Warehousing pick/pack fees — if your 3PL charges per unit to pick and pack (this is debatable, but most accountants include it)

NOT Included in COGS

  • Advertising / ad spend — Facebook Ads, Google Ads, TikTok Ads. These are selling expenses.
  • Outbound shipping to customers — this is a fulfillment/selling expense, not a product cost
  • Platform fees — Shopify subscription, Amazon referral fees, marketplace commissions
  • Payment processing — Stripe/Shopify Payments fees (2.9% + $0.30)
  • Returns and refunds — these reduce revenue, they don't increase COGS
  • Office rent, software, salaries — overhead/operating expenses
  • Influencer payments — marketing expense

The rule of thumb: if the cost exists regardless of whether you sell the product, it's not COGS. Ad spend happens whether or not a sale occurs. Your Shopify subscription runs whether you sell 0 or 10,000 units. Those are operating expenses. COGS only counts costs baked into the product itself.

COGS by Business Model

The calculation changes depending on how you source and fulfill. Here's how COGS works across the three most common ecommerce models.

ModelWhat Goes Into COGSInventory Tracking?Typical COGS %
DropshippingSupplier cost per unit (usually includes their shipping)No — no inventory held30-50%
Private LabelManufacturing + inbound freight + duties + packagingYes — you hold inventory25-40%
ManufacturingRaw materials + labor + production overhead + packagingYes — raw materials + finished goods20-35%
Wholesale / ResellingWholesale purchase price + inbound shippingYes — you hold inventory50-70%
Print on DemandBase product cost + printing cost from providerNo — fulfilled per order40-60%

Dropshipping COGS

Dropshipping is the simplest COGS calculation because you never hold inventory. Your COGS is whatever your supplier charges per unit, multiplied by units sold.

If AliExpress charges $8 per unit including ePacket shipping, and you sold 200 units this month, your COGS is $1,600. No beginning/ending inventory math needed.

Watch out for: some suppliers quote a product price ($5) and a separate shipping price ($3). Both are COGS. If you only track the $5, you're undercounting COGS by 37% on every unit. Use our dropshipping profit calculator to see how this affects your real margin.

Private Label COGS

Private label COGS has more layers because you're importing product in bulk. A typical breakdown:

  • Factory price per unit: $4.00
  • Packaging and labeling: $0.80
  • Quality inspection: $0.15 (prorated across the order)
  • Sea freight to US warehouse: $1.20 per unit
  • Customs duty (say 7.5% on $4.00 declared value): $0.30
  • Customs broker fee: $0.10 (prorated)
  • Total COGS per unit: $6.55

Most founders only look at the $4.00 factory price and think their COGS is $4. The real number is $6.55 — 64% higher. That gap destroys your profit margin if you price based on the wrong COGS.

Manufacturing COGS

If you manufacture your own product (common in food, supplements, beauty), COGS includes raw materials, direct production labor, and manufacturing overhead (the portion of facility costs tied to production — not admin offices).

A supplement brand making capsules might break down like this: raw ingredient powder ($1.50), capsule shells ($0.20), bottle and label ($0.60), labor to fill and seal ($0.40), shrink wrap ($0.05). Total COGS: $2.75 per bottle. Selling at $39.99 gives a gross margin of 93%. This is why supplements have some of the highest margins in ecommerce.

Know your real COGS. See your real margin.

Most founders undercount COGS by 15-30% because they ignore freight, duties, and packaging. Plug in your actual landed cost and see what you really keep per order.

Open Profit Margin Calculator →

Worked Examples at Different Scales

COGS doesn't just change by business model — it shifts as you scale. Here's the same private label product at three revenue levels.

$5K/month (50 orders, $100 AOV)

COGS ComponentPer UnitMonthly Total
Factory cost$12.00$600
Packaging$2.50$125
Inbound freight (air — small qty)$4.00$200
Customs duty (8%)$0.96$48
Total COGS$19.46$973
COGS as % of revenue19.5%

At low volume, inbound freight per unit is high because you're air-shipping small batches. That $4.00/unit in freight is 33% of factory cost.

$50K/month (500 orders, $100 AOV)

COGS ComponentPer UnitMonthly Total
Factory cost (volume discount)$10.00$5,000
Packaging$2.00$1,000
Inbound freight (sea — larger qty)$1.50$750
Customs duty (8%)$0.80$400
Total COGS$14.30$7,150
COGS as % of revenue14.3%

At scale, sea freight drops the per-unit shipping cost by 62%, and volume discounts knock the factory price down. COGS per unit dropped from $19.46 to $14.30 — a 26% improvement that goes straight to your gross margin.

$200K/month (2,000 orders, $100 AOV)

COGS ComponentPer UnitMonthly Total
Factory cost (deep volume discount)$8.00$16,000
Packaging (bulk rates)$1.50$3,000
Inbound freight (FCL sea container)$0.80$1,600
Customs duty (8%)$0.64$1,280
Total COGS$10.94$21,880
COGS as % of revenue10.9%

Same product, same selling price, but COGS dropped from 19.5% to 10.9% of revenue. That 8.6-point improvement at $200K/month is an extra $17,200/month in gross profit. This is why scaling matters — and why pricing your product correctly from the start gives you room to improve as you grow.

Why Most Founders Undercount COGS

Almost every founder I talk to undercounts COGS. The supplier quote is $8, so they call their COGS $8. Here are the costs they forget:

  1. Inbound freight. Getting product from your supplier to your warehouse isn't free. Sea freight from China to the US runs $1-3 per unit depending on product size and quantity. Air freight runs $3-8 per unit. This alone can add 15-40% to your "COGS."
  2. Customs duties and tariffs. Most product categories carry a 2-25% import duty. A $10 product with a 10% duty has $1 in tariff cost that should be in COGS. With recent tariff changes, some categories are now 25-50%.
  3. Packaging materials. Custom boxes, tissue paper, thank-you cards, poly mailers, void fill, tape — these add $0.50-3.00 per order depending on how you package. Most founders lump this into "overhead" instead of COGS.
  4. Quality inspection costs. If you're paying a third party to inspect goods at the factory ($200-400 per inspection), that cost should be prorated across the batch and added to COGS.
  5. Customs broker fees. Someone clears your shipment through customs. They charge $100-300 per shipment. Prorate it across units.

Add these up and your real COGS is typically 15-30% higher than the supplier invoice. That means your profit margin is 15-30% lower than you think.

COGS Benchmarks by Industry

COGS as a percentage of revenue varies dramatically by niche. Here's where each industry typically lands:

Industry / NicheTypical COGS %Why
Beauty & Skincare25-35%Low production cost, high perceived value
Supplements20-30%Cheap raw materials, premium pricing
Jewelry & Accessories25-40%Small, lightweight, high markup
Pet Products35-50%Moderate production cost, emotional buying
Fashion & Apparel40-55%Higher manufacturing cost, size variants increase waste
Home & Garden45-55%Bulky items increase freight cost per unit
Food & Beverage40-55%Perishability, cold chain, compliance costs
Fitness Equipment50-65%Heavy, expensive to ship, competitive pricing
Consumer Electronics60-75%High component cost, price-sensitive buyers
Wholesale / Reselling60-75%No manufacturing markup, thin margins by design

If your COGS exceeds 50% of revenue, scaling with paid ads is going to be painful. You need enough gross margin to absorb a $10-20 customer acquisition cost and still have room for shipping, fees, and profit. A 50% COGS on a $50 product leaves you $25 — and after a $15 CPA, $5 shipping, and $1.75 in processing fees, you're at $3.25 net. That's 6.5% net margin with zero room for error.

How to Track COGS in Shopify

Shopify doesn't have a native COGS tracking system that captures landed cost automatically. Here's what most brands do:

Option 1: Use the "Cost per item" Field

Shopify has a "Cost per item" field on every product and variant. Go to Products → select a product → Pricing section → enter your cost. Shopify will then show you margin and profit in reports.

Problem: most founders enter only the supplier price. They don't include freight, duties, or packaging. So Shopify's profit report overstates margin by 15-30%.

Option 2: Calculate True Landed Cost

Before entering the "Cost per item" in Shopify, calculate the full landed cost:

  • Supplier unit price + (total freight / units in shipment) + (duties / units) + packaging cost per unit
  • Enter THIS number as your cost per item
  • Update it every time you place a new purchase order (freight and duty rates change)

Option 3: Use an Inventory App

Apps like Stocky (free on Shopify Plus), Inventory Planner, or SKULabs let you track purchase orders with landed cost breakdowns. They calculate COGS automatically as orders ship.

Regardless of which option you use, the key is entering your true landed cost — not just the factory price. Every dollar you miss in COGS shows up as phantom profit in your reports.

COGS vs Total Cost: Understanding the Difference

COGS is one piece of your total cost structure. Confusing COGS with total cost is how founders convince themselves their margins are healthy when the business is barely breaking even.

Cost CategoryExamplePart of COGS?Part of Total Cost?
Product cost from supplier$8.00/unitYesYes
Inbound freight$1.50/unitYesYes
Customs duties$0.80/unitYesYes
Packaging materials$1.20/unitYesYes
Facebook Ads (CPA)$14.00/orderNoYes
Outbound shipping$5.50/orderNoYes
Payment processing$1.75/orderNoYes
Shopify subscription$39/monthNoYes
Klaviyo / email software$45/monthNoYes

Revenue minus COGS = gross profit. Revenue minus everything = net profit. A business can have a 70% gross margin and a 5% net margin. If you only look at gross margin, you think you're crushing it. If you look at net margin, you realize you're one bad month away from losing money. For a deeper dive on this gap, see our markup vs margin breakdown.

COGS and Shipping: The Inbound vs Outbound Rule

This trips up more founders than anything else. Here's the rule:

  • Inbound shipping (supplier to you) = COGS. This is the cost of getting the product ready to sell.
  • Outbound shipping (you to customer) = NOT COGS. This is a selling/fulfillment expense.

Why does it matter? Because if you dump outbound shipping into COGS, your gross margin looks worse than it is — and you might make bad sourcing decisions based on inflated COGS. Keep them separate.

For a full breakdown of outbound shipping costs and how to factor them into your unit economics, check our guide on how to calculate shipping costs.

How to Use COGS to Set Prices

Once you know your true COGS (landed cost, not just supplier price), you can work backward to set the right selling price. The standard approach: multiply COGS by 3-5x.

  • 3x COGS = ~67% gross margin. Works if you have organic traffic or low ad costs.
  • 4x COGS = ~75% gross margin. The sweet spot for most DTC brands running paid ads.
  • 5x COGS = ~80% gross margin. Necessary for products with high CPA or heavy return rates.

A product with $11 in true landed COGS should sell for $33-55 depending on your acquisition channel. If the market won't support that price, you either need to find a cheaper supplier or accept that the product won't be profitable at scale with paid ads. Use the product pricing calculator to model different price points against your COGS.

Common COGS Mistakes (And How to Fix Them)

  1. Only counting the supplier invoice. Your supplier quotes $8. You write down $8. But freight adds $1.50, duties add $0.80, packaging adds $1.20. Your real COGS is $11.50 — 44% higher than what you recorded.
  2. Mixing COGS with operating expenses. Ad spend is not COGS. Platform fees are not COGS. If you lump everything into one "cost" bucket, you can't tell whether your product has a sourcing problem or a marketing efficiency problem.
  3. Not updating COGS when costs change. Freight rates doubled in 2021-2022. Tariffs change with trade policy. If you're still using COGS from your first purchase order, your margin calculations are stale.
  4. Ignoring currency fluctuations. If you pay suppliers in RMB or EUR, exchange rate shifts change your COGS in USD. A 5% currency swing on a $100K purchase order is $5,000 in unexpected cost.
  5. Forgetting shrinkage and damage. If 3% of your inventory arrives damaged or gets lost in the warehouse, your effective COGS per sellable unit is 3% higher. On a 1,000-unit order, you paid for 1,000 but can only sell 970.

COGS for Tax Purposes

COGS directly reduces your taxable income. Revenue minus COGS equals gross profit, and you pay taxes on profit — not revenue. Every dollar you accurately capture in COGS is a dollar that reduces your tax bill.

This is another reason not to undercount COGS. If you report $8 COGS per unit when the true landed cost is $11.50, you're overstating profit by $3.50 per unit and paying taxes on money that was already spent. On 10,000 units sold per year, that's $35,000 in phantom profit you're paying tax on.

Keep receipts for every COGS component: supplier invoices, freight bills, customs entry documents, packaging supplier invoices. Your accountant needs these to defend the COGS deduction.

Putting It All Together

COGS is the foundation of every margin calculation in your business. Get it right and your gross margin, net margin, pricing, and profitability forecasts are all accurate. Get it wrong and you're making decisions based on numbers that don't reflect reality.

The three things to do right now:

  1. Pull up your last supplier invoice and add inbound freight, duties, and packaging cost per unit. That's your true COGS.
  2. Update the "Cost per item" field in Shopify with this landed cost number.
  3. Run your profit margin calculation with the corrected COGS and see what your real gross margin is.

You might not like what you see. But at least you'll be making decisions based on real numbers — and that's the difference between founders who scale and founders who wonder where their money went.

Frequently Asked Questions

What is the formula for cost of goods sold?

COGS = Beginning Inventory + Purchases During the Period - Ending Inventory. For ecommerce businesses that don't hold inventory (like dropshipping), COGS is simply the per-unit cost from your supplier multiplied by units sold, plus any inbound shipping and duties.

What counts as COGS in ecommerce?

Everything directly tied to producing or acquiring the product: wholesale purchase price, raw materials, inbound freight, customs duties, packaging materials, manufacturing labor, and quality inspection fees. Advertising, outbound shipping, platform fees, and overhead are NOT COGS.

Is shipping cost included in COGS?

Inbound shipping (from supplier to your warehouse) is COGS. Outbound shipping (from you to the customer) is not. Inbound freight is part of getting the product ready to sell. Outbound shipping is a fulfillment expense that happens after the sale.

How do I calculate COGS for dropshipping?

For dropshipping, COGS = supplier cost per unit x units sold. Since you don't hold inventory, there's no beginning/ending inventory to track. If your supplier charges $12 per unit including their shipping, your COGS is $12 per sale. Make sure you include any shipping surcharges or upgrades your supplier charges.

What is a good COGS percentage for ecommerce?

It depends on your niche. Beauty and supplements run 20-35%. Fashion runs 40-55%. Electronics run 60-75%. As a general rule, keep COGS below 50% of revenue if you plan to scale with paid advertising — otherwise there's not enough margin left to cover acquisition costs and still profit.

Why do most ecommerce founders undercount COGS?

Because they only record the supplier's unit price and ignore inbound freight, customs duties, packaging, and inspection costs. These "hidden" components typically add 15-30% on top of the base product cost. A product quoted at $8 often has a true landed cost of $10-12 after everything is included.

Stop guessing. Start calculating.

True Margin gives ecommerce founders the tools to make data-driven decisions.

Try True Margin Free