1. Home
  2. Tools
  3. COGS calculator

Cost of goods sold, counted the way your accountant will

Margin looks better than it is when inbound freight, duties and packaging sit in the wrong column, or when unsold stock is counted as a cost. Enter your stock counts and purchases for the period to get cost of goods sold and gross margin. Then build a landed cost per unit for pricing.

Some links may earn us a commission at no cost to you. Drafted with AI, checked by a human. How we earn.

  • Your own numbers
  • Every formula shown
  • Runs in your browser
Illustration of customs and duties

Period and unit costs

Your own numbers

Use cost values, not retail prices, for every inventory figure.

1For the period
2Per unit (optional)

How the math works

The period calculation follows the cost-of-goods-sold steps in IRS Publication 334, opened 14 Nov 2026 (Asia/Kuala_Lumpur / MYT): beginning inventory, plus purchases less items withdrawn for personal use, plus cost of labor, materials and supplies, and other costs such as containers and freight-in. That total is the cost of goods available for sale; subtract ending inventory to get cost of goods sold. Gross profit = net sales − COGS.

Freight on goods coming in is part of COGS. Shipping to customers is normally a selling expense. The per-unit section adds product cost, inbound freight, duties and packaging so you can price from a landed cost; the profit margin calculator turns that into a price. This is a calculator, not tax advice.

Record cost per item in Shopify

FAQ

What goes into COGS for an online store?

What you paid for the stock you sold, plus inbound freight, duties and the packaging that is part of the product. Ad spend, apps and shipping to customers are operating expenses.

What if I dropship?

Your COGS is mainly what the supplier charges per order, including their shipping to the customer, because you never hold stock. Beginning and ending inventory are zero.

Why does ending inventory reduce COGS?

Stock still on the shelf has not been sold yet, so its cost moves to the next period instead of counting now.

Is the Shopify link an affiliate link?

Yes. The Shopify /go/ link is a sponsored link. StoreVetted may earn a commission at no extra cost to you.