FIFO Inventory Calculator
FIFO is the inventory method that answers a very specific question: if the oldest costs in stock are assigned to sales first, what are cost of goods sold and ending inventory after the sale? This calculator uses two purchase layers, a sales quantity, and a selling price. It then removes units from the first batch before touching the second batch. The result is not a generic average-cost estimate; it is the exact first-in, first-out allocation used by the form’s compute logic.
Use this page when you have two recorded purchases and need a clean FIFO schedule for a worksheet, small-business margin check, class assignment, or pricing review. If you need the opposite cost flow, use the LIFO inventory calculator. If the result is part of a merchandising review, compare the margin with the GMROI calculator and the inventory turnover calculator. For broader profit planning, the accounting profit calculator can help connect gross profit with other business costs.
Inputs this calculator uses
The form has six numeric inputs. First units purchased and first unit cost describe the oldest layer. Second units purchased and second unit cost describe the newer layer. Units sold is the sale quantity you want to cost. Selling price per unit is used only for revenue, gross profit, and margin; it does not change FIFO COGS.
All quantities and costs must be nonnegative. The calculator accepts decimal costs and whole-unit steps, but the formula works the same if you use fractional units for a weight-based inventory. If the units sold input is greater than first units plus second units, the calculator sets sold units equal to total units available. It reports the largest sale it can support from the inventory entered rather than returning an invalid result.
FIFO method and formula
First-in, first-out is a cost-flow assumption. It does not require a warehouse to physically ship the oldest item, although many perishable or dated products are managed that way. For accounting, the key point is that older costs move to cost of goods sold before newer costs. Ending inventory therefore represents the unsold remainder after the oldest layer has been consumed.
The calculator first caps sold units at available units:
It then assigns the sale across the two layers:
FIFO COGS, ending inventory, and margin are calculated as:
If revenue is zero, the form displays a zero gross margin rather than dividing by zero.
Example: valuing inventory with FIFO
Suppose the oldest purchase has 100 units at 10.00 each, the second purchase has 80 units at 12.00 each, 120 units are sold, and the selling price is 15.00 per unit. Total inventory is 180 units, so the sale is not capped. FIFO uses all 100 units from the first batch, then 20 units from the second batch.
The COGS calculation is 100 · 10.00 plus 20 · 12.00, which equals 1,240.00. Ending inventory is zero first-batch units plus 60 second-batch units at 12.00, or 720.00. Revenue is 120 · 15.00, or 1,800.00. Gross profit is 1,800.00 minus 1,240.00, or 560.00. Gross margin is 560.00 divided by 1,800.00, multiplied by 100, which is 31.11% when rounded to two decimals.
Now test the cap behavior. With the same purchases but 250 units sold, only 180 units are available. The calculator uses 180 sold units, not 250. FIFO COGS becomes 100 · 10.00 plus 80 · 12.00, or 1,960.00. Ending inventory is 0.00. Revenue is 180 · 15.00, or 2,700.00. The note explains that results were capped at inventory on hand.
When FIFO is useful
FIFO is especially intuitive for food, medicine, cosmetics, parts with revision dates, and any item where older inventory is normally moved first. In rising-cost periods, FIFO often leaves newer, higher costs in ending inventory and sends older, lower costs to COGS. That can make gross profit look stronger than a last-in, first-out calculation using the same sale.
Managers use FIFO to see how price changes flow through margin. If the second batch cost is much higher than the first, a small sale may still look profitable because it is costed from the old layer. Once sales reach the new layer, COGS jumps. That timing matters for reorder pricing, promotions, and gross margin targets.
Tips for accurate FIFO results
- Keep purchase layers in chronological order: first batch means oldest batch.
- Use cost per selling unit, not case cost, unless units sold are also cases.
- Enter selling price net of discounts if you want margin after markdowns.
- Reconcile inventory before relying on the cap behavior; selling more than recorded stock signals a records issue.
- Compare FIFO, LIFO, and GMROI together when cost inflation or slow-moving stock could distort merchandising decisions.
Sources
- IRS, Publication 946: How to Depreciate Property — useful context for distinguishing inventory from depreciable property.
- CFI, First-In First-Out FIFO — overview of FIFO inventory costing.
- CFI, Inventory Valuation — inventory accounting methods and reporting context.
- AccountingTools, Accounting for manufacturing businesses — inventory costing context for manufacturing records.