If you track inventory, crypto, stock lots, or any assets bought at different prices over time, a FIFO calculator can save you hours and reduce mistakes. Use the tool below to enter buy and sell transactions, then calculate cost of goods sold, ending inventory value, and realized profit using the First-In, First-Out method.
FIFO Calculator
Enter transactions in chronological order. For Sell rows, unit price is the sale price per unit. For Buy rows, unit price is your cost per unit.
| # | Type | Quantity | Unit Price ($) | Action |
|---|
What is FIFO?
FIFO stands for First-In, First-Out. It assumes the earliest units you purchased are the first units you sell. In accounting and investing, FIFO is commonly used to calculate:
- Cost of goods sold (COGS)
- Ending inventory value
- Realized gain or loss on asset sales
Why a FIFO calculator is useful
As transaction history grows, manual matching gets messy fast. You can easily lose track of which lot was sold, especially when purchase prices vary. A FIFO calculator helps you:
- Automatically match sells to oldest available lots
- Reduce spreadsheet and bookkeeping errors
- Create consistent records for tax reporting
- See your profitability with clearer lot-level detail
How this calculator works
1) Add transactions in order
Each row is one transaction. Use Buy for inventory or asset purchases and Sell for disposals. Quantity can be whole or decimal values.
2) FIFO lot matching
When you sell, the calculator pulls quantity from the oldest unsold buy lots first, then moves forward until the sell quantity is fully covered.
3) Final outputs
After calculation, you get:
- Total purchased quantity and cost
- Total sold quantity and sales revenue
- Total FIFO COGS
- Gross profit (revenue minus COGS)
- Ending inventory quantity and value
- Line-by-line sale breakdown and remaining lots
Quick example
Suppose you buy 100 units at $10, then 80 units at $12.50, then sell 120 units at $18:
- First 100 sold come from the $10 lot
- Next 20 sold come from the $12.50 lot
- FIFO COGS = (100 × 10) + (20 × 12.50) = $1,250
- Revenue = 120 × 18 = $2,160
- Gross profit = $910
The remaining 60 units continue at the cost basis of $12.50 under FIFO.
FIFO vs other inventory methods
FIFO vs LIFO
LIFO (Last-In, First-Out) assumes newest units are sold first. During inflation, LIFO often produces higher COGS and lower paper profits compared with FIFO. FIFO tends to show higher inventory values on the balance sheet in rising-cost environments.
FIFO vs Weighted Average
Weighted average blends all purchase costs into one average cost per unit. It is simpler but less precise for lot-level analysis. FIFO preserves the original lot structure, which is often useful for operational and tax detail.
Common mistakes to avoid
- Entering transactions out of chronological order
- Mixing currencies in one calculation
- Forgetting fees, commissions, or shipping costs in unit price
- Selling more quantity than you currently hold
- Using rounded values that distort totals over time
Final note
This FIFO calculator is built for practical planning and bookkeeping support. For tax filings or audited financial statements, confirm treatment with a qualified accountant based on your jurisdiction and reporting rules.