Use our FIFO Calculator to calculate inventory costs and values using the First In First Out accounting method.
Enter purchase prices, purchased units, total units sold, and selling price. This calculator uses FIFO, so the oldest inventory is sold first.
FIFO means First In, First Out. The units purchased first are treated as sold first.
Inventory value = Sum of all purchased units × their purchase price
COGS = Units sold from 1st batch × 1st price + units sold from 2nd batch × 2nd price + units sold from 3rd batch × 3rd price
Revenue = Total units sold × Selling price
Profit/Loss = Revenue − COGS
Gross margin = Profit ÷ Revenue × 100
Whether you run a small retail store, manage a warehouse, or handle business accounting, the FIFO calculator helps you find your Cost of Goods Sold (COGS) and ending inventory value in seconds — no spreadsheet needed.
On this page, you will find a free FIFO calculator, a plain-English explanation of what FIFO means, worked examples, the exact formulas you need, a side-by-side FIFO vs. LIFO comparison, tax and accounting implications, and answers to the most frequently asked questions. Everything is written to be as clear and useful as possible, whether you are a student, a small business owner, or an experienced accountant.
FIFO stands for First In, First Out. It is an inventory valuation method that assumes the oldest items you purchased are the first ones you sell.
Think of a supermarket stocking milk cartons. The store places older cartons at the front of the shelf and newer ones at the back. Customers naturally grab the front ones first. That is FIFO in everyday life — and it is how your accounting should reflect reality.
In accounting, FIFO determines two important numbers:
FIFO is one of the most widely accepted inventory accounting methods globally. It is permitted under both U.S. GAAP and IFRS (unlike LIFO, which is banned under IFRS).
Quick summary: FIFO = oldest stock sold first. Your COGS uses old prices. Your ending inventory uses newer prices.
You only need two formulas to work with FIFO:
COGS = Cost of the Oldest Units Sold (consumed in chronological purchase order)
Ending Inventory = Beginning Inventory + Purchases During the Period − COGS
Or expressed differently:
Ending Inventory Value = (Units Remaining) × (Cost of the Most Recent Purchase Layers)
Cost of Goods Available for Sale = Beginning Inventory + Cost of All New Purchases
And then:
COGS = Cost of Goods Available for Sale − Ending Inventory Value
These three formulas form the backbone of every FIFO calculation. The step-by-step example in Section 4 shows exactly how to apply them.
Our FIFO calculator is designed to be fast and intuitive. Here is exactly what to do:
Let us walk through a realistic example so you can see exactly how the FIFO method works from start to finish.
You own a small electronics shop. During Q1, you made three separate inventory purchases of the same product (wireless headphones):
During Q1, you sold 100 units. Now you need to calculate your COGS and ending inventory.
Cost of Goods Available for Sale = $2,000 + $3,600 + $3,000 = $8,600
You sold 100 units. Using FIFO, you start with the oldest purchase (January) and work your way forward:
COGS = $2,000 + $2,250 = $4,250
After selling 100 units, you have 90 units left (190 − 100 = 90). Using the FIFO method, these are the most recently purchased units:
Ending Inventory = $1,350 + $3,000 = $4,350
That is the complete FIFO calculation. The FIFO calculator above does all of this automatically the moment you enter your numbers.
This is a detail that most other FIFO guides skip entirely — but it matters for your accounting system.
FIFO can be applied using two different inventory tracking systems:
Your inventory records are updated every time a sale or purchase occurs. Each transaction is logged in real time. This is what modern point-of-sale (POS) systems and inventory management software do.
Your inventory records are updated at the end of the accounting period (monthly, quarterly, or annually). You count physical stock at the end and calculate COGS as the difference.
Yes — but only if you make purchases between sales. In most cases, the final COGS will differ slightly between perpetual and periodic FIFO if costs changed during the period and you had interleaved buys and sells. For businesses that only make periodic purchases (like our Q1 example above), the two methods give identical results.
Three main inventory costing methods are commonly used. Here is a complete, side-by-side comparison so you can choose what works best for your situation.
The weighted average method (also called the average cost method) calculates a single blended cost per unit across all purchases in the period, then applies that one number to both COGS and ending inventory. It does not track layers.
Weighted Average Cost per Unit = Total Cost of All Purchases ÷ Total Units Available
Using our earlier headphones example: $8,600 ÷ 190 = $45.26 per unit. COGS for 100 units would be 100 × $45.26 = $4,526 — noticeably different from the FIFO result of $4,250.
FIFO gives the most realistic picture of your current inventory value on the balance sheet because remaining stock is valued at the most recent prices. That is why it is the globally preferred method.
FIFO is the right choice for most businesses, but it is especially well-suited to certain industries. Here is a practical guide:
The economic environment significantly changes what your FIFO numbers look like. Understanding this protects you from being surprised by your own financial statements.
When prices are rising, your oldest purchases cost less than your newest ones. Because FIFO uses those older (cheaper) costs for COGS:
When prices are falling, FIFO has the opposite effect:
In a stable price environment, the difference between FIFO, LIFO, and weighted average is minimal. The gap grows wider as prices move more sharply in either direction. Always consider current economic conditions when choosing your inventory valuation method.
Your choice of inventory method has a real and direct effect on how much tax you pay. Here is what you need to understand before filing.
Because FIFO uses lower, older costs for COGS, your gross profit — and therefore your taxable income — is higher than it would be under LIFO during inflationary periods. This means you pay more income tax in the short term.
When prices are stable or falling, FIFO's tax effect is neutral or even slightly favorable. In deflationary periods, FIFO produces a higher COGS (older units cost more), reducing taxable income.
The IRS (and most tax authorities worldwide) requires consistency. Once you choose FIFO, you must apply it consistently from year to year. Switching methods requires formal approval and may trigger a tax adjustment in the year of the switch. Always consult a qualified accountant before changing your inventory method.
FIFO is also the default method used by the IRS for calculating capital gains on stock and securities sales (see Section 13 for more on this). When you sell shares without specifying which lot you are selling, the IRS assumes you sold the oldest shares first.
If your business operates across borders, keep in mind that LIFO is not permitted under International Financial Reporting Standards (IFRS). This means any multinational company or any business reporting under IFRS effectively has no choice — FIFO or weighted average is what you must use. FIFO is therefore the safest and most internationally compatible method.
Your choice of inventory method does not just affect taxes — it flows through your entire set of financial statements and changes the key ratios that lenders, investors, and analysts use to evaluate your business.
The key takeaway: FIFO makes your business look more profitable and financially stronger on paper during inflation, but comes with a higher tax bill. When comparing businesses in the same industry, always check which inventory method each company uses before drawing conclusions from financial ratios.
If you deal with investors, apply for bank financing, or have international operations, you need to understand which accounting standard applies to you.
If you currently use LIFO and want to expand internationally, attract foreign investors, or list on a foreign stock exchange, you will need to convert to FIFO or weighted average. This conversion can result in significant one-time tax liabilities and balance sheet changes. Plan ahead and consult a certified public accountant or IFRS specialist before making the switch.
Even experienced business owners make these errors when applying the FIFO method. Learn them now so you do not have to learn them the hard way.
FIFO depends entirely on knowing which goods arrived first. If you mix up the dates or enter purchases out of sequence, your entire calculation is wrong. Always record purchase dates accurately — this is non-negotiable.
If you return goods to a supplier or write off damaged inventory, you must adjust the relevant purchase layer. Many people forget this step, which overstates both their available inventory and their COGS.
FIFO tracks both the number of units and the cost per unit for each batch. A common error is entering the total batch cost instead of the per-unit cost — or vice versa. Double-check your inputs every time.
Changing from FIFO to LIFO (or any other method) in the middle of a financial year without proper disclosure violates accounting standards and can trigger IRS penalties. Method changes require a formal accounting policy note and, in the U.S., IRS Form 970.
Your physical stock management and your accounting method do not have to match. However, if you are physically rotating stock using a FIFO system in your warehouse but your accountant is using weighted average for the books, your financial statements will not reflect operational reality. Align your physical and accounting practices wherever possible.
FIFO is not just for physical inventory. The IRS uses FIFO as the default method for calculating capital gains on securities — and understanding this can affect how much tax you pay when you sell shares, ETFs, mutual funds, or cryptocurrency.
If you bought shares of the same company at different times and different prices (called "lots"), and then you sell some shares, the IRS assumes — unless you instruct otherwise — that you sold the oldest shares first.
Imagine you own shares of a company purchased in three lots:
You sell 100 shares in March 2023 at $50 each ($5,000 total). Using FIFO, the IRS assigns these as the January 2022 lot (cost basis: $2,000).
Because those January 2022 shares are over one year old, this qualifies as a long-term capital gain, taxed at a lower rate (0%, 15%, or 20% depending on your income) rather than ordinary income rates.
Unlike inventory accounting (where you must stick with your chosen method), the IRS allows investors to specify which lot they are selling at the time of sale. This is called the "specific identification method." If you specify the highest-cost lot, you can minimize your capital gain — or even create a capital loss if the shares in that lot are now worth less than you paid.
Talk to your broker or a tax professional about how to specify your lots before you sell. Many online brokerage platforms allow you to set your default cost basis method.
The IRS treats cryptocurrency as property, not currency. This means the same capital gains rules — including FIFO as the default lot selection method — apply to Bitcoin, Ethereum, and other digital assets. Crypto tax software typically applies FIFO by default unless you manually select a different method.
The FIFO method is far more than an accounting technicality. It directly affects your business's reported profit, your tax bill, your balance sheet strength, and how investors and lenders perceive your company. Used correctly, FIFO gives you the most accurate and internationally accepted picture of what your inventory is actually worth.
Here is a quick recap of everything you need to remember:
Use the FIFO calculator at the top of this page to get your COGS and ending inventory in seconds. If you have a complex scenario — multiple products, partial returns, or multi-period calculations — feel free to work through the step-by-step example in Section 4 as your template.
Accurate inventory accounting is not just about compliance. It is about understanding your true costs so you can price your products correctly, manage your cash flow, and build a business that grows on solid ground.