The COGS formula, stated exactly
Cost of goods sold (COGS) is the direct cost of the products you sold during a period — not what you bought, not what's sitting in a warehouse, only what left the door.
The standard inventory formula is:
COGS = Beginning Inventory + Purchases − Ending Inventory
You start with the stock you had, add everything you bought or produced during the period, then subtract what's still unsold at the end. What's left is the cost of the goods that were actually sold. The IRS uses exactly this logic: if selling merchandise produces income, you subtract COGS from gross receipts to figure gross profit, and unsold inventory is carried out rather than expensed.
Every top-ranking accounting guide gives you this one formula and stops. That's fine if you run a bookkeeping close once a quarter. It's not enough if you're trying to decide whether an order made you money — so the rest of this page connects COGS to the profit it controls.
The direct-cost version for ecommerce and POD
If you hold little or no inventory — dropshipping, print-on-demand, made-to-order — beginning and ending inventory are near zero. The inventory formula still works, but it collapses to a cleaner form:
COGS = the sum of direct product costs for every unit sold
For a print-on-demand order, that's the blank garment, the print/decoration charge, and the supplier's base fulfillment cost baked into the item. It does not include shipping to the customer, payment fees, or ad spend — those are real costs, but they live below the gross-profit line, not inside COGS.
Say you run a POD apparel store and your average order is one $40 tee. The blank plus print plus base fulfillment charge from your supplier runs $16. Then:
- COGS per order = $16
- Across 1,000 orders in a month: $16 × 1,000 = $16,000 COGS
That $16 is the number that flows into every margin calculation that follows.
What goes in COGS — and what doesn't
The most common mistake is scope: pulling costs into COGS that don't belong, or leaving out ones that do. Get this wrong and your gross margin lies to you.
Include (direct costs)
- Raw materials or the finished blank you decorate
- Direct labor tied to producing the specific unit
- Print, embroidery, or decoration charges
- Inbound freight to acquire the goods
- The supplier's per-item base fulfillment fee
Exclude (these are operating expenses, not COGS)
- Outbound shipping to the customer
- Payment processing fees
- Marketing and ad spend
- Rent, software subscriptions, and salaries
- Customer support and admin overhead
The dividing line is simple: a cost is COGS if it scales one-for-one with each unit produced and would vanish if you made one fewer item. Rent doesn't vanish; the blank garment does.
One POD-specific judgment call: is the supplier's flat print fee part of COGS or part of fulfillment? Either is defensible — but pick one and hold it every month, or your margin will drift for reasons that have nothing to do with your business.
From COGS to gross profit and gross margin
COGS only matters because of what it reveals about profit. Subtract it from revenue and you get gross profit; express that as a share of revenue and you get gross margin.
- Gross profit = Revenue − COGS = $40 − $16 = $24 per order
- Gross margin = Gross profit ÷ Revenue = $24 ÷ $40 = 60%
Flip it and you get your COGS ratio: $16 ÷ $40 = 40%. A store spending 40 cents of every revenue dollar on product has 60 cents left to cover everything else. If you want to pressure-test that number or reverse-engineer a target price, our gross margin calculator walks the arithmetic both directions.
Gross margin is where most accounting articles quietly end. But 60% gross margin does not mean you kept 60% — it means you kept 60% before shipping, fees, and ads. That gap is where profit actually lives or dies.
The profit angle the SERP skips
Here's what a generic COGS definition never tells you: your COGS number silently sets the ad efficiency you must hit just to break even.
Keep going down the same $40 order. After COGS you had $24. Now subtract the variable costs that aren't COGS:
- Gross profit: $24.00
- − Shipping (carrier): −$5.00
- − Payment processing (4% of $40): −$1.60
- − Pick/pack labor: −$1.40
- = Contribution margin before ads: $16.00 (a 40% ratio)
That 40% is the honest margin — the money left to pay for advertising and still profit. And it dictates your break-even ROAS through a clean identity:
Break-even ROAS = 1 ÷ contribution-margin ratio = 1 ÷ 0.40 = 2.5
Any ad campaign returning less than $2.50 per dollar spent is losing money on this product — even though the 60% gross margin looked comfortable. Lower your COGS and that break-even bar drops; let COGS creep up and you need ever-hotter ads just to stand still. This is why COGS is a marketing number, not only an accounting one. To see how the ad side connects, the CPM formula breakdown shows what actually drives the spend on the other side of that ratio.
If you want the full chain — COGS, margin, ROAS, CAC, LTV — worked against one consistent example store, the ecommerce metrics guide is the hub that ties them together.
COGS and inventory costing: FIFO vs LIFO
When you do hold stock and unit costs change over time, the formula's "Purchases" and "Ending Inventory" pieces depend on which units you assume you sold.
- FIFO (first in, first out): assumes your oldest stock sold first. When costs are rising, FIFO leaves cheaper old costs in COGS and pricier new stock on the balance sheet — so COGS is lower and reported profit higher.
- LIFO (last in, first out): assumes newest stock sold first. Rising costs push the newer, higher costs into COGS — raising COGS and lowering taxable profit.
Most print-on-demand and dropship sellers never touch this: with no inventory buffer, cost is simply whatever the supplier charged for that specific order. FIFO/LIFO only bites when you buy in batches and hold them.
A full worked example
Pull it together for one month at the same POD store:
| Line | Amount |
|---|---|
| Revenue (1,000 orders × $40) | $40,000 |
| − COGS (1,000 × $16) | −$16,000 |
| = Gross profit | $24,000 |
| − Shipping, fees, pick/pack ($8/order) | −$8,000 |
| = Contribution margin before ads | $16,000 |
| − Ad spend | −$10,000 |
| = Contribution margin after ads | $6,000 |
COGS was the single largest cost line — bigger than ads. Shaving product cost from $16 to $14 an order would add $2,000 straight to the bottom line at this volume, without selling a single extra unit or touching the ad budget. That's the leverage a precise COGS number unlocks: it tells you where a dollar saved is worth more than a dollar earned.
Where per-order COGS gets hard in real stores
The formula is trivial. Getting a true per-order COGS across a real store is not — because your product cost, shipping, fees, and ad allocation live in different systems that don't talk to each other. Your supplier knows the print cost, Stripe knows the fee, Meta and Google know the ad spend, and none of them reconcile to a single order.
This is the problem PodVector is built for. It connects Shopify, Meta Ads, Google Ads, Printify, and Printful, then computes the true per-order profit — COGS, shipping, fees, and ad cost netted against each order's revenue, not averaged across the month. Victor, its AI employee, analyzes that live data and can act on it Shopify-side with your approval — while leaving your ad accounts untouched. PodVector isn't a dashboard you log in to read; it's the layer that keeps the COGS-to-profit math honest for every order.
Once your per-order profit is clean, the next lever is usually conversion. The CTR calculator and our revenue formula walkthrough pick up where the cost side leaves off.
FAQs
What is the basic COGS formula?
COGS = Beginning Inventory + Purchases − Ending Inventory. You take the stock you started with, add what you bought or produced during the period, and subtract what's left unsold at the end. The result is the direct cost of the goods you actually sold.
Does COGS include shipping and marketing?
No. COGS is only the direct cost of producing or acquiring the product — materials, direct labor, decoration, and inbound freight. Outbound shipping to the customer, payment processing, and ad spend are operating or variable selling costs that sit below the gross-profit line, not inside COGS.
How do I calculate COGS for print-on-demand or dropshipping?
Because you hold little to no inventory, skip the beginning/ending inventory math and just add the direct product costs of every unit you shipped: the blank, the print or decoration charge, and the supplier's base per-item fee. For an order costing $16 to produce, that order's COGS is $16.
What's the difference between COGS and gross margin?
COGS is a dollar amount — the cost of what you sold. Gross margin is a percentage: (Revenue − COGS) ÷ Revenue. If an order sells for $40 with $16 COGS, gross profit is $24 and gross margin is 60%. COGS feeds the calculation; gross margin expresses the result.
Why does COGS affect my ad break-even?
Your contribution-margin ratio (what's left after COGS and other variable costs) sets your break-even ROAS through the identity Break-even ROAS = 1 ÷ margin ratio. A 40% margin means you must return at least $2.50 per ad dollar to avoid a loss. Higher COGS shrinks that margin and raises the ad efficiency you need just to break even.
Is COGS tax-deductible?
COGS isn't a "deduction" in the usual sense — it's subtracted from gross receipts to arrive at gross profit before other expenses, which the IRS treats as the correct way to figure gross profit when selling merchandise produces your income. Unsold inventory carries over to the next period rather than being expensed now.