Inventory Cost Calculator: FIFO, LIFO, Weighted Average and COGS (US)
Calculate your cost of goods sold and ending inventory with this free tool. Apply FIFO, LIFO, or weighted average methods for accurate US business reporting.
Last updated: 18 October 2026
Inventory Cost Calculator
This inventory valuation calculator shows what the goods you sold cost and what your remaining stock is worth under FIFO, LIFO and weighted average. It also applies the cost of goods sold formula and estimates annual inventory carrying cost in US dollars, so you can see the true cost of inventory on hand—not only the cost of what left the warehouse.
Short answer
Enter beginning inventory, each purchase layer (units and unit cost), and units sold. The calculator reports goods available for sale, cost of goods sold (COGS), and ending inventory under FIFO, LIFO and weighted average, with a side-by-side comparison. A separate module computes the cost of goods sold formula from dollar balances, and a third module estimates how much holding inventory costs you each year.
What this tool does not do: it is a periodic costing tool for one product at a time. It does not decide which method is allowed for tax, does not apply LCM or NRV write-downs, and does not replace an accountant.
Inventory cost calculator
Choose a module. All numbers stay in your browser and are not sent anywhere. Use the FIFO calculator or LIFO calculator tabs for layer costing, or the weighted average cost calculator tab when you prefer one blended rate for the whole period.
Cost of goods sold calculator — layers by units
Use the example values or replace them with your own. Unit costs are per unit in USD. Add up to 10 purchase layers.
Cost of goods sold formula — dollar balances
If you already track inventory in dollars (for example from a bookkeeping system), enter the period balances. Hypothetical example uses $8,000 beginning inventory, $22,000 purchases, $6,500 ending inventory.
Inventory carrying cost module
Enter your own annual percentage for each component. There are no official default rates in this tool; the example percentages are hypothetical only.
Method and sources
- Time basis: periodic (end-of-period) costing; no tax year is applied to the arithmetic
- Currency: USD; money shown half up to the cent for display
- Privacy: calculation runs in your browser; nothing is sent or stored unless you use browser local features yourself
- Informational only; no eligibility is stated
Reference starting points readers can check (official bodies): IRS Publication 538 (Accounting Periods and Methods) at irs.gov/publications/p538; IRS Publication 334 (Tax Guide for Small Business) at irs.gov/publications/p334; IRS Form 970 (Application to Use LIFO Inventory Method) at irs.gov/forms-pubs/about-form-970; United States Code sections on inventories at uscode.house.gov (Internal Revenue Code sections 471 and 472); OpenStax Principles of Accounting (inventory chapter) at openstax.org for textbook definitions of cost-flow assumptions.
Varnda is an independent educational tool. No government agency endorses or operates this page. Tax method choices, including any LIFO election and conformity requirements, must be confirmed with a qualified tax professional against current official text.
How to use this cost of goods sold calculator
- List your layers. Record beginning inventory units and unit cost, then each purchase (or production) layer with its own units and unit cost. Order purchases from oldest to newest.
- Enter units sold for the whole period. Units sold cannot exceed total units available; the calculator rejects that input.
- Read the side-by-side results. FIFO sells the oldest layers first, LIFO sells the newest first, and weighted average blends every layer into one average unit cost.
- Optional: use the COGS by formula module if you already have dollar balances, and the carrying-cost module to estimate inventory holding cost per year and per month.
For a pure dollar-path check without layers, use the COGS formula module. That path answers how to calculate cost of goods sold when you already know beginning inventory, purchases, and ending inventory.
Cost of goods sold formula and ending inventory formula
COGS formula
COGS = Beginning inventory + Purchases − Ending inventory
Every symbol: Beginning inventory is the value of stock at the start of the period; Purchases is the cost of goods bought (or produced) in the period; Ending inventory is the value of unsold stock at period end. The same statement can be read as beginning inventory plus purchases minus ending inventory.
Ending inventory formula
Ending inventory = Cost of goods available for sale − COGS
Cost of goods available for sale equals beginning inventory plus purchases. After a method assigns cost to goods sold, whatever remains stays in ending inventory, so the two sides always add back to goods available.
Inventory carrying cost formula
Annual carrying cost = Average inventory value × Total carrying-cost rate
Monthly carrying cost is the annual figure divided by 12. Component rates (capital, storage, insurance, shrinkage and obsolescence, other) are user-entered percentages; this tool supplies no official default rates.
Weighted average unit cost
Average unit cost = Total cost of goods available ÷ Total units available
Also called the average cost inventory method. COGS is average unit cost × units sold (display rounded half up to the cent); ending inventory is goods available minus COGS so the two always reconcile.
How to calculate ending inventory — worked example (hypothetical)
All numbers below are clearly labeled hypothetical teaching figures. They test arithmetic, not law.
| Layer | Units | Unit cost | Layer cost |
|---|---|---|---|
| Beginning inventory | 100 | $10.00 | $1,000.00 |
| Purchase 1 | 200 | $12.00 | $2,400.00 |
| Purchase 2 | 150 | $14.00 | $2,100.00 |
| Goods available | 450 | — | $5,500.00 |
Units sold = 300. Substitution step by step:
- FIFO periodic: sell 100 @ $10 + 200 @ $12 → COGS $3,400.00; ending inventory 150 @ $14 = $2,100.00.
- LIFO periodic: sell 150 @ $14 + 150 @ $12 → COGS $3,900.00; ending inventory 100 @ $10 + 50 @ $12 = $1,600.00.
- Weighted average: $5,500.00 ÷ 450 = $12.222222 average unit cost; COGS $3,666.67; ending inventory $1,833.33.
- Invalid case: units sold 500 against 450 units available is rejected (cannot sell more units than available).
- COGS formula path: beginning $8,000 + purchases $22,000 = goods available $30,000; less ending $6,500 → COGS $23,500.00.
- Carrying cost path: average inventory $50,000 × (8% + 4% + 1% + 2% = 15%) = $7,500 per year, or $625 per month.
Inventory valuation methods compared
| Method | What it assumes | Effect when costs rise | Typical output vs other methods (same layers) |
|---|---|---|---|
| FIFO (first-in, first-out) | Oldest layers are sold first; ending inventory keeps recent costs | Lower COGS, higher ending inventory | COGS sits at the low end of the three methods |
| LIFO (last-in, first-out) | Newest layers are sold first; ending inventory keeps older costs | Higher COGS, lower ending inventory | COGS sits at the high end of the three methods |
| Weighted average cost method | Every unit in the period shares one average unit cost | COGS and ending inventory fall between FIFO and LIFO | Blended result; less sensitive to a single layer |
Descriptions follow standard financial-accounting teaching of cost-flow assumptions (textbook starting point: OpenStax Principles of Accounting, inventory chapter). No method is presented as best; the choice for reporting is a business decision.
| Point of comparison | FIFO | LIFO |
|---|---|---|
| Which units leave inventory first | Oldest cost layers | Newest cost layers |
| Ending inventory on the balance sheet | Reflects more recent purchase costs | Reflects older purchase costs when prices moved |
| Physical flow vs cost flow | Often matches how perishable or fashion goods move | Cost flow need not match physical flow |
| US federal tax note | Widely used for financial reporting | May require a specific election and conformity rules under federal law |
How cost flows through your layers
Shown by this tool
- Periodic FIFO, LIFO, and weighted average COGS
- Ending inventory units and dollars per method
- Layer-by-layer trace of sold vs remaining units
- User-entered inventory carrying cost estimate
Not shown (out of scope)
- Tax eligibility for LIFO or any method
- Perpetual timing differences
- LCM or NRV write-downs
- Multi-product warehouse optimization
Common mistakes when calculating inventory cost
- Assuming one method is always allowed for tax. Federal rules on inventories and any LIFO election are outside this calculator’s verified scope; confirm before filing.
- Mixing units and dollars. Keep unit counts in one column and unit costs in USD in another; do not enter a layer total in the unit-cost field.
- Forgetting beginning inventory. Goods available for sale always includes beginning inventory plus purchases; dropping the opening layer understates both COGS capacity and ending inventory.
- Letting units sold exceed units available. The calculator blocks that input; if your books show it, recheck period boundaries or returns.
- Ignoring carrying costs. Storage, capital, insurance, and shrinkage can quietly erase margin; run the carrying-cost module with rates you can defend.
- Comparing methods without the same inputs. Side-by-side numbers are only meaningful when every method sees the same layers and the same units sold.
FAQ — inventory cost calculator
What is the cost of goods sold formula?
COGS = beginning inventory + purchases − ending inventory. In words: start with what you had, add what you bought (or produced), then subtract what you still have. That difference is the cost of the goods you sold. A parallel reading is beginning inventory plus purchases minus ending inventory.
How do you calculate ending inventory with FIFO?
FIFO (the FIFO method) assigns the oldest costs to goods sold first. Remaining units in ending inventory are valued using the most recent layer costs. In the hypothetical example, after 300 of 450 units sell, the 150 units left are the newest layer at $14, so ending inventory is $2,100.
How is LIFO different from FIFO?
The LIFO method takes the newest costs to goods sold first, so ending inventory holds older costs. When purchase prices are rising, LIFO usually produces higher COGS and lower ending inventory than FIFO on the same layers. This calculator shows both side by side and does not claim which method a taxpayer may use.
What is the weighted average cost method?
The weighted average cost method divides the total cost of goods available for sale by total units available to get one average unit cost for the period. COGS is that average times units sold; ending inventory is the residual. It is sometimes called the average cost inventory method.
What is inventory carrying cost?
Inventory carrying cost (also called inventory holding cost) is what it costs to keep stock on hand for a year—capital tied up, storage, insurance, shrinkage and obsolescence, and related items. This tool multiplies average inventory value by the total percentage you enter. No official default rate is asserted; enter rates that match your business.
Can I use LIFO for US federal tax?
LIFO for federal income-tax purposes is generally associated with Internal Revenue Code section 472 and an election filed with IRS Form 970, with conformity requirements that also sit in federal law. Nothing on this page states whether you qualify. Read the current IRS Publication 538 and the Code text at uscode.house.gov, or ask a qualified tax professional, before choosing a method for tax.
Does this calculator handle shrinkage or write-downs?
No. Shrinkage and obsolescence can be entered only as annual percentages in the carrying-cost module. Lower-of-cost-or-market or net-realisable-value write-downs, returns timing, and perpetual-inventory timing differences are outside this tool’s scope.
Glossary
- Cost of goods available for sale
- Beginning inventory plus purchases for the period, in units and in dollars.
- Cost of goods sold (COGS)
- The cost assigned to units sold during the period under the chosen cost-flow method.
- Ending inventory
- The value of unsold units at period end; equals goods available minus COGS.
- FIFO
- First-in, first-out: oldest layer costs move to COGS first.
- LIFO
- Last-in, first-out: newest layer costs move to COGS first.
- Weighted average unit cost
- Total cost of goods available divided by total units available.
- Inventory holding cost
- Another name for inventory carrying cost: the annual cost of keeping stock.
- Periodic inventory system
- Costing done at the end of a period from layer or balance data, not after every sale (perpetual).
Limitations, exclusions, and assumptions
- Supported now: periodic FIFO, LIFO and weighted-average COGS and ending inventory from unit layers; COGS from dollar balances; user-entered carrying cost.
- One product at a time; costs are per unit in USD; no write-downs, returns, or shrinkage inside the valuation modules.
- Disabled until verified: tax eligibility for any method; section 471(c) simplified-method thresholds; economic order quantity; perpetual timing differences.
- Rounding: exact decimal handling on unit costs; money half-up to the cent for display; weighted average unit cost shown to 6 decimals in the steps panel. Ending inventory is always goods available minus COGS so the two reconcile.
- Corrections: use the contact path published on varnda.com when available.
Final summary
This free inventory cost calculator helps US retailers, sellers, manufacturers, and bookkeepers value a single product under FIFO, LIFO and weighted average, apply the COGS formula, and estimate inventory holding cost. Results are educational estimates within the scope above—always confirm method choices for tax or financial reporting with current official sources and a qualified professional.