Free Tool
COGS Calculator
Calculate your cost of goods sold using the standard accounting formula. Enter your beginning inventory, purchases, and ending inventory to get your COGS and gross margin instantly.
Researched by the ShelfMerge Research Team
Inventory value at the start of the period
All inventory purchased or manufactured this period
Inventory value remaining at period end
Add revenue to calculate gross margin
What COGS actually measures
Cost of goods sold is the direct cost of the inventory you moved during a period. The formula has three inputs: what you had at the start, what you added, and what you still had at the end. Everything in the middle — the goods that left your possession through sales, damage, or shrinkage — becomes COGS.
The formula is: COGS = Beginning Inventory + Purchases − Ending Inventory. This works for product-based businesses regardless of whether you manufacture, wholesale, or dropship. The key is consistent valuation: use cost price throughout, never retail price.
What counts — and what does not
COGS includes: supplier invoice cost, inbound freight and customs duties, packaging materials that ship with the product, and direct manufacturing labor. It does not include Shopify subscription fees, advertising spend, warehouse rent, customer service payroll, or merchant processing fees. Those belong in operating expenses, below the gross profit line.
Getting this line wrong — putting ad spend into COGS, for instance — inflates your apparent COGS ratio and makes products look less profitable than they are. The reverse mistake (leaving out inbound freight) understates COGS and overstates gross margin, which can lead to pricing decisions that erode margin at scale.
Why Shopify merchants need to track COGS precisely
Shopify's native analytics shows revenue and orders, but it does not automatically calculate COGS unless you enter product costs manually for every SKU. Most merchants skip this step. The result: they know their top-line revenue but have no reliable gross margin figure — which means they cannot tell whether their ad spend is profitable or which product categories actually make money.
A Shopify store running $200,000/month in revenue with a 60% COGS ratio has $80,000 in gross profit. That $80,000 needs to cover all operating expenses. If COGS is actually 70% because inbound freight and duties were excluded, gross profit drops to $60,000 — and the business math looks completely different. Small percentage errors on high-volume stores create large cash mismatches.
Common COGS mistakes in ecommerce
- Using retail price instead of cost price when valuing ending inventory
- Forgetting inbound shipping costs — especially for international suppliers
- Mixing cash accounting and accrual accounting within the same period
- Not adjusting for returns — returned goods that go back to stock should reduce COGS
- Ignoring damaged or shrinkage inventory that never sold but leaves cost behind
Common questions about cost of goods sold
How to use this cost of goods sold tool
Install and connect
OAuth takes 30 seconds. ShelfMerge requests read_products and read_orders scopes — nothing more. No credit card required to get your first health score.
Five engines run in parallel
ShelfMerge syncs your order history and product catalog, then runs five analysis engines. Your first health score appears in under 60 seconds.
Act on what you find
See which products are dead weight, which variants to cut, and which products are stealing each other's sales. Act on insights or let ShelfMerge alert you weekly.
Common questions about cost of goods sold
What does the health score measure?
The health score is a weighted 0–100 number built from five signals: dead inventory percentage, products missing images, dead variants (zero sales), duplicate product count, and cannibalization severity. A score above 80 is healthy. Below 60 means real revenue is leaking somewhere in your catalog.
How does dead inventory detection work?
ShelfMerge analyzes sales velocity, days since last sale, and current inventory levels for every product. Each product is classified as thriving, slowing, dying, or dead. The dead inventory report shows the total dollar value tied up in stock that hasn't moved.
What is product cannibalization?
Cannibalization happens when two products in your catalog compete for the same buyer — one gets a sale and the other loses one. ShelfMerge detects this using Pearson correlation on weekly sales data. A high negative correlation between two products is a strong cannibalization signal.
Will ShelfMerge delete my products?
No. ShelfMerge is advisory only. Every insight is a recommendation, not an automated action. The Cleanup tab lets you merge duplicate products with a full undo option, but nothing is ever auto-deleted or archived without your explicit confirmation.
Automate COGS tracking for your entire Shopify catalog
ShelfMerge connects directly to your Shopify store and runs this analysis automatically — across your entire catalog, updated daily.
Free plan — no credit card required.