Most FIFO guides stop at shirts and lamps. If you already run a store — say 340 orders a month at a $31 average order value, with real supplier invoices stacking up — you need the version that survives contact with messy purchase history, feeds a correct margin, and tells you where it quietly distorts your profit. This is that version.
The FIFO formula, stated plainly
FIFO stands for first in, first out. The accounting assumption is simple: the first units you bought are the first ones you "sold," at least on paper.
The formula for a single sale is:
FIFO COGS = units sold × cost of the oldest available inventory layer (rolling to the next layer when one runs out).
For a whole period, the identity accountants actually reconcile to is:
Beginning inventory + purchases − ending inventory = COGS.
Those two are the same thing seen from different ends. The first builds COGS up layer by layer; the second backs into it once you know what's left. A correct FIFO calculation makes both agree to the penny — that reconciliation is your proof the math is right.
Step by step, with real store numbers
Say you stock your best-selling hoodie — you buy it in bulk from a supplier and hold it, rather than printing it on demand. Your supplier raised prices twice this year, so you have three cost layers:
| Purchase layer | Units | Cost per unit | Layer cost |
|---|---|---|---|
| January | 200 | $12.00 | $2,400 |
| March | 300 | $13.50 | $4,050 |
| June | 250 | $14.20 | $3,550 |
| Total available | 750 | — | $10,000 |
(The numbers above are an illustrative example, not market data.)
Now you sell 600 of those hoodies over the quarter. FIFO says the first 600 units out the door carry the oldest costs, in order:
- First 200 units → January layer: 200 × $12.00 = $2,400
- Next 300 units → March layer: 300 × $13.50 = $4,050
- Final 100 units → June layer: 100 × $14.20 = $1,420
Add the layers: $2,400 + $4,050 + $1,420 = $7,870 FIFO COGS.
That is the whole method. You did not touch the June layer's remaining 150 units, because FIFO never reaches them until the older stock is exhausted.
Ending inventory falls out of the same calculation
You don't calculate ending inventory separately — it's whatever's left after FIFO drains the oldest layers. Here, 150 units remain, all from the June layer:
150 × $14.20 = $2,130 ending inventory.
Run the reconciliation to prove it: $0 beginning + $10,000 purchases − $2,130 ending = $7,870, which matches the COGS you built up by hand. When those two numbers don't tie, you've either double-counted a layer or mis-dated a purchase.
One payoff worth noticing: your average FIFO cost on the 600 units sold was $7,870 ÷ 600 = $13.12, even though your most recent unit cost $14.20. FIFO keeps older, cheaper costs in COGS and pushes newer, pricier costs onto the balance sheet. In a period of rising supplier prices, that reports a lower COGS and a higher profit than the alternatives — which is exactly why the method you pick is not a neutral choice.
FIFO vs. weighted average vs. LIFO
Take the same $10,000 of hoodies and 600 units sold, and the three standard methods diverge:
- FIFO: oldest costs first → COGS of $7,870 (calculated above).
- Weighted average: one blended cost of $10,000 ÷ 750 = $13.33 per unit → 600 × $13.33 = $8,000 COGS.
- LIFO (last in, first out): newest costs first → 250 × $14.20 + 300 × $13.50 + 50 × $12.00 = $8,150 COGS.
Same inventory, same sales, a $280 swing in reported COGS between FIFO and LIFO — and a matching swing in taxable profit. The direction is predictable: when costs rise, FIFO shows the highest profit and LIFO the lowest.
Method choice is also constrained by the rules you report under. FIFO is accepted under both U.S. GAAP and IFRS, while LIFO is permitted under U.S. GAAP but banned under IFRS, which only allows FIFO and weighted average (ERP Research — FIFO vs. LIFO inventory costing). For most small Shopify sellers that makes FIFO or weighted average the practical pair to choose between. If you want the mechanics of posting these numbers into your books each period, our walkthrough on recording cost of goods sold picks up where this calculation ends.
Where FIFO actually bites for a POD store
Here is the part the generic guides skip. If you sell print-on-demand, most of your catalog has no FIFO layers at all. A printed-on-demand item is produced after the order, and your supplier charges a known, specific cost for that exact unit — so its COGS is specific identification, not FIFO. You don't guess which layer it came from; the invoice tells you.
FIFO only enters the picture for the goods you actually hold: bulk blanks, pre-printed bestsellers you stock for faster shipping, kitting supplies, or inventory you bought ahead to beat a price increase. More operators hold some stock than admit it, and that's where the layered math above applies.
The trap is mixing the two in one profit number. Blend a specific-identification POD cost with a FIFO-averaged stocked cost and your per-order margin drifts — usually in the flattering direction when supplier prices are climbing, which is the worst time to be fooled. To see why your true cost per order is almost always higher than the supplier line item alone, the ecommerce ops economics hub lays out the full stack of fees, shipping, and ad spend that FIFO COGS is only one input to.
Worth being precise about: cost of goods sold is a subset of your costs, not all of them. Advertising, apps, and overhead live elsewhere, which is why SG&A and operating expenses aren't the same thing, and why net revenue doesn't net out COGS the way many sellers assume.
From COGS to true per-order profit
A FIFO COGS of $13.12 on a hoodie that sells for $42 looks like a $28.88 margin. It isn't. Subtract payment processing, the shipping you actually paid, app fees, and the ad spend that acquired the buyer, and the real number is smaller — often dramatically so once you push the roughly $2,800 of monthly Meta spend from our opening example down to the order level.
Doing that by hand across 340 orders a month, each with its own supplier cost layer and its own slice of ad spend, is where spreadsheets fall apart. Victor, the AI employee from PodVector AI, computes true per-order profit from your live data — pulling Shopify, Meta Ads, Google Ads, Printify, Printful, Gelato, and Klaviyo into one accurate cost per order, with reports delivered to your Google Drive and every write action gated behind your approval. If you're calculating FIFO COGS by hand to find your real margin, let Victor run the numbers on your live store instead.
FAQs
What is the FIFO cost of goods sold formula?
For a single sale, FIFO COGS = units sold × the cost of your oldest available inventory layer, rolling into the next-oldest layer each time one is depleted. For a full period, it also equals beginning inventory + purchases − ending inventory. A correct calculation makes both results match.
How do I calculate ending inventory under FIFO?
You don't compute it separately — it's whatever units remain after FIFO assigns the oldest costs to everything you sold. Those leftovers are valued at your most recent purchase costs. In the worked example, 150 unsold units at the newest $14.20 cost gave $2,130 of ending inventory, and $0 beginning + $10,000 purchases − $2,130 ending reconciled back to the $7,870 COGS.
Does FIFO give higher or lower profit than LIFO?
When your costs are rising, FIFO reports lower COGS and higher profit, because it keeps the older, cheaper costs in COGS and leaves the newer, expensive ones in inventory. LIFO does the reverse. In the example, the same 600 units produced $7,870 of COGS under FIFO versus $8,150 under LIFO — a $280 profit swing from method alone.
Does FIFO even apply to print-on-demand products?
Usually not. A print-on-demand unit is made for a specific order and billed at a specific cost, so its COGS is specific identification, not FIFO. FIFO applies to any inventory you hold and buy in batches — bulk blanks, stocked bestsellers, or supplies — where you can't tell which batch a sold unit came from.
Can I switch from FIFO to another method whenever I want?
No. Accounting standards expect you to apply a cost-flow method consistently period over period, and changing it is a formal accounting-policy change rather than a monthly toggle. Pick the method that fits what you report under — FIFO works under both U.S. GAAP and IFRS — and stay with it so your margins stay comparable across periods.
Why is my FIFO margin still wrong even when the COGS is right?
Because COGS is only one line in your real cost of an order. A correct FIFO COGS still ignores payment processing, actual shipping, app fees, and the ad spend that won the customer. True per-order profit subtracts all of those — which is the full operating picture, not just the inventory layer.