How to Calculate Ending Inventory: Formula and Methods
Ending inventory = beginning inventory + purchases - cost of goods sold. See one example worked through FIFO, weighted average, LIFO and estimates.
On this page
- What is the ending inventory formula?
- What you need before you start
- How to calculate ending inventory step by step
- How do you calculate ending inventory using FIFO?
- How do you calculate ending inventory using weighted average?
- How do you calculate ending inventory using LIFO?
- How do you work backwards to beginning inventory?
- How do you check ending inventory against net realisable value?
- How do you estimate ending inventory without a count?
- Gross profit method
- Retail method
- How do you verify the figure?
- Common mistakes and how to fix them
TL;DR: Ending inventory = beginning inventory + purchases - cost of goods sold (COGS). In practice you count the units on hand and multiply by a unit cost from your costing method (FIFO or weighted average; LIFO only under US rules), then check that cost against net realisable value. The method alone can move the figure by 15% or more.
Ending inventory, also called closing inventory or closing stock, is the value of goods a business still holds at the end of a period. The ending inventory formula is ending inventory = beginning inventory + net purchases - COGS. A distributor that opened October with ₹20,000 of stock, bought ₹80,000 more and sold goods costing ₹68,800 has ₹31,200 of ending inventory. Below, one month of real-looking numbers is carried through every method, so you can see exactly where the answers differ and why.
What is the ending inventory formula?
The ending inventory formula is an identity: everything you had available to sell, minus what you sold, is what is left.
| Formula | What it gives you |
|---|---|
| Beginning inventory + purchases = cost of goods available for sale | Total cost you could have sold |
| Cost of goods available - COGS = ending inventory | The closing stock figure |
| Units counted × unit cost = ending inventory | The same figure, built from a physical count |
| Ending inventory + COGS - purchases = beginning inventory | Backs out the opening figure |
"Purchases" means net purchases: invoice price minus returns and discounts, plus freight in. IRS Publication 538 defines the cost of merchandise bought during the year as "the invoice price minus appropriate discounts plus transportation". GST you can claim as input tax credit is not part of cost.
The identity holds under every costing method. What changes between FIFO, weighted average and LIFO is how the same cost of goods available is split between COGS and ending inventory.
What you need before you start
- Opening stock at cost, from last period's closing figure or balance sheet.
- Every purchase in the period, with quantity, unit cost and date (the GRN or purchase register).
- Units sold, or a physical count of units on hand at the period end.
- Your costing method. Under IAS 2 and India's Ind AS 2, interchangeable items use FIFO or weighted average; unique items use specific identification. LIFO is not a permitted formula. In the US, LIFO is allowed for tax if you file Form 970 (IRS Pub 538).
How to calculate ending inventory step by step
The worked example: a Pune pipe distributor tracks one item, 1-inch PVC pipe (6 m length), for October 2026.
| Date | Movement | Units | Unit cost | Total |
|---|---|---|---|---|
| 1 Oct | Opening stock | 100 | ₹200 | ₹20,000 |
| 5 Oct | Purchase | 200 | ₹220 | ₹44,000 |
| 18 Oct | Purchase | 150 | ₹240 | ₹36,000 |
| Available for sale | 450 | ₹1,00,000 | ||
| Oct | Sold | 320 |
- Add up goods available for sale. Opening ₹20,000 + purchases ₹80,000 = ₹1,00,000 for 450 units.
- Find units on hand. 450 available - 320 sold = 130 units. Confirm with a physical count (step 6).
- Pick the costing method your books already use. Switching methods between periods breaks comparability.
- Value the 130 units under that method (the next three sections).
- Check cost against net realisable value and write down if NRV is lower.
- Reconcile to the count. If the shelf shows fewer units than the books, record the shortage as a loss before closing.
- Post the figure: ending inventory goes to the balance sheet as a current asset and becomes next period's opening stock.

How do you calculate ending inventory using FIFO?
FIFO (first in, first out) assumes the oldest stock is sold first, so the units left are the newest. The 130 units on hand all come from the 18 October lot at ₹240.
- Ending inventory = 130 × ₹240 = ₹31,200
- COGS = ₹1,00,000 - ₹31,200 = ₹68,800
If you had more units left than the last lot holds, take the rest from the next-newest lot, and so on back in time.
How do you calculate ending inventory using weighted average?
Weighted average spreads cost evenly across all units available. Under the periodic version:
- Average unit cost = ₹1,00,000 ÷ 450 = ₹222.22
- Ending inventory = 130 × ₹222.22 = ₹28,889
- COGS = ₹1,00,000 - ₹28,889 = ₹71,111
The perpetual (moving average) version recomputes the average after each purchase and values each sale at the average on that date. It gives a slightly different figure when sales happen between purchases; use whichever your stock ledger runs.
How do you calculate ending inventory using LIFO?
LIFO (last in, first out) assumes the newest stock is sold first, so the units left are the oldest. It is allowed for US tax only, not under IFRS or Ind AS.
- 130 units = 100 opening units at ₹200 + 30 units from 5 October at ₹220
- Ending inventory = ₹20,000 + ₹6,600 = ₹26,600
- COGS = ₹73,400

When prices rise, FIFO gives the highest ending inventory and the lowest COGS (so the highest profit); LIFO gives the opposite. FIFO is 17% above LIFO here on the same 130 pipes. For a deeper side-by-side, see FIFO vs LIFO.
How do you work backwards to beginning inventory?
Rearrange the same identity: beginning inventory = ending inventory + COGS - purchases.
With the FIFO figures: ₹31,200 + ₹68,800 - ₹80,000 = ₹20,000, which matches the opening stock. Use this when you have this year's books but lost last year's closing figure, or to check that your opening balance was carried forward correctly. For the COGS side of the equation, see the COGS formula guide.
How do you check ending inventory against net realisable value?
IAS 2 and Ind AS 2 measure inventory "at the lower of cost and net realisable value". Net realisable value (NRV) is the estimated selling price less the costs to complete and sell (IFRS Foundation). Most top-ranking calculators skip this step, and it is the one auditors ask about.
Suppose a competitor's price cut means the pipe now sells for ₹235, and delivery and commission cost ₹10 a length. NRV = ₹225 a unit.
| Method | Cost per unit | NRV | Carry at | Ending inventory | Write-down |
|---|---|---|---|---|---|
| FIFO | ₹240 | ₹225 | ₹225 | ₹29,250 | ₹1,950 |
| Weighted average | ₹222.22 | ₹225 | ₹222.22 | ₹28,889 | nil |
The write-down is an expense in the period and is usually done item by item. US GAAP uses a similar "lower of cost or net realizable value" test for FIFO and average cost, and the IRS allows "lower of cost or market" for tax (Pub 538).
How do you estimate ending inventory without a count?
Use an estimate for monthly or quarterly reports, insurance claims after a fire or theft, or a sanity check before the year-end count. Estimates do not replace a physical count for the annual accounts.
Gross profit method
- Take net sales: 320 pipes × ₹300 = ₹96,000.
- Apply your historical gross margin (say 25%): estimated COGS = ₹96,000 × 75% = ₹72,000.
- Estimated ending inventory = goods available ₹1,00,000 - ₹72,000 = ₹28,000.
The estimate is only as good as the margin. If you discounted heavily this month, the real margin is lower and the method overstates stock.
Finally Learn works a gross profit method example: with a 40% gross profit, COGS is 60% of sales, and subtracting estimated COGS from goods available gives an estimated closing stock of 6,700.
- 0:46 why estimate: floods, fires, theft
- 1:08 the inputs: opening stock, purchases, sales, margin
- 2:43 goods available of 1,03,900
- 3:51 estimated ending inventory of 6,700
Retail method
Retailers who price at a consistent markup use a cost-to-retail ratio: (goods available at cost ÷ goods available at retail) × ending stock at retail. If goods available cost ₹1,00,000 and were priced at ₹1,35,000, the ratio is 74%; ₹39,000 of stock left at shelf price is estimated at ₹28,889 at cost.
How do you verify the figure?
- Count it. Ending units in the books must match the shelf. A rolling cycle counting programme catches gaps before year end.
- Recalculate the identity. Opening + purchases - COGS must equal the closing figure to the rupee.
- Compare with turnover. A sudden jump in closing stock with flat sales lowers your inventory turnover ratio and is worth explaining.
- Use average inventory for ratios, not the closing figure alone: see average inventory.
Common mistakes and how to fix them
| Mistake | Symptom | Fix |
|---|---|---|
| Valuing stock at selling price | Closing stock and profit both overstated | Value at cost, then apply the NRV test |
| Leaving freight out of purchases | Unit cost too low | Add freight in to the purchase cost |
| Including recoverable GST in cost | Unit cost too high | Exclude input tax credit you can claim |
| Ignoring the shortage | Books show 130, shelf shows 124 | Book 6 units (₹1,440 at FIFO) as a loss |
| Changing method mid-year | Margins jump without a reason | Keep one method; disclose any change |
| Counting goods in transit twice | Same lot in supplier and your stock | Use the delivery terms to decide ownership |
If you keep stock in spreadsheets, the shortage and freight mistakes are the ones that creep in. LuckPanda's Inventory module records every stock movement against the same items your purchase orders and invoices use, so on-hand quantities and their cost are already there when you close the month. Try the Inventory module.
Questions
What is the formula for ending inventory?
Ending inventory = beginning inventory + net purchases - cost of goods sold. With a physical count, it is units on hand × unit cost under your costing method.
Is closing inventory the same as ending inventory?
Yes. Closing inventory, closing stock and ending inventory all mean the value of goods on hand at the end of the period.
Does FIFO or weighted average give a higher ending inventory?
When purchase prices are rising, FIFO gives the higher ending inventory because the newest, costliest units stay on the books. When prices fall, weighted average gives the higher figure.
Is ending inventory an asset?
Yes. Ending inventory is reported as a current asset on the balance sheet and becomes the next period's opening inventory.
Can a small business skip inventory accounting?
In the US, a business with average annual gross receipts of $26 million or less (indexed for inflation) over the 3 prior years may choose not to keep an inventory, but must still use a method that clearly reflects income (IRS Pub 538). In India, closing stock still appears in the books and the stock statement your bank may ask for.
How often should ending inventory be calculated?
At least once a year for the accounts. Monthly is common for businesses that borrow against stock or track margins closely, using an estimate between full counts.