inventory management

Ending Inventory Formula — How to Calculate Your Closing Stock

Wondering how to calculate your ending inventory? Our article explains the formula in simple terms — including a worked example, FIFO vs weighted average table, and FAQ for small manufacturers.

Ending Inventory Formula — How to Calculate Your Closing Stock

Inventory management is crucial for any business, but it can be particularly challenging for small manufacturers, both raw materials and finished products need to be tracked simultaneously, across every accounting period.

One of the calculations that often stumps small business owners is ending inventory: the value of stock that remains unsold at the end of an accounting period. Many operators are left scratching their heads wondering how exactly to arrive at this number. Fortunately, there is a straightforward method that most small manufacturers use, the COGS (Cost of Goods Sold) method.

In this article we’ll cover what ending inventory is, how to calculate it step by step, and walk through a worked example so you can see exactly how the numbers fit together.

Instantly calculate your closing stock

Try Stocksmith — inventory and manufacturing software built for small-batch product businesses. Track raw materials and finished goods in real time, and pull beginning inventory, purchases, COGS and ending inventory as one report at period end.
Start your free 14-day trial.

What is Ending Inventory?

Ending Inventory is the value of unsold goods at the end of an accounting period, it’s also commonly referred to as your “Closing Inventory”.

This ending total includes the cost to obtain or produce:

  • Raw materials that haven’t yet been used
  • Work-in-progress (WIP) products currently being made
  • Finished products that have not yet been sold

It is important to accurately calculate your ending inventory. If you under-calculate this amount, you’ll be under-claiming the expense, which will have a significant impact on your tax liability. On the other hand, over-calculating it will reduce your COGS, resulting in a higher gross profit, and therefore more taxes to pay.

The Ending Inventory Formula

The standard formula for calculating ending inventory using the COGS method is:

Ending Inventory Formula

Ending Inventory = Beginning Inventory + Purchases − COGS

Where COGS = Cost of Goods Sold for the period (the total cost of all products sold)

Breaking down each component:

  • Beginning Inventory — the value of your stock at the start of the period (equal to last period’s ending inventory)
  • Purchases — the cost of all raw materials and goods acquired during the period
  • Cost of Goods Sold — the total cost of all products sold during the period

Read more about how to calculate COGS here.

Worked Example: A Candle Producer’s Ending Inventory

Let’s say you run a small candle-making business. Here’s how your numbers might look for the quarter:

Item Amount
Beginning inventory (wax, fragrance, wicks, finished candles) $1,200
Raw material purchases during the quarter $850
Cost of goods sold (candles sold during the quarter) $1,400

Applying the formula:

Ending Inventory = $1,200 + $850 − $1,400 = $650

That $650 represents the value of all raw materials still on your shelves plus any finished candles that haven’t shipped yet. This is the figure you’d carry into next quarter as your new beginning inventory, and the figure that flows into your balance sheet and tax return.

Tip: Make sure all material costs are reflected as “landed costs”, the total cost to acquire them, including shipping, tariffs, handling, and any other direct costs. Worth double-checking if you source fragrance oils or wax internationally.

How to Calculate Ending Raw Materials Inventory

If you track materials separately, you can break the calculation down by inventory layer:

  1. Start with your beginning raw materials inventory value for the period.
  2. Add all purchases of raw materials during the period.
  3. Subtract the cost of raw materials consumed to produce goods that were sold during the period.
  4. The resulting number is your ending raw materials inventory value.

It’s also worth building out a bill of materials (BOM) for each product you make. A BOM lists every ingredient or component that goes into a finished product, which makes it much easier to calculate exactly how much raw material was consumed for each unit sold.

How to Include Work-in-Progress in Your Ending Calculation

In addition to finished goods, many small manufacturers have work-in-progress (WIP) inventory that needs to be accounted for. This includes any partially completed products or materials that are currently being produced.

To calculate ending WIP inventory using the COGS method, you’ll need to know how much of your stock is in progress and its value at the close of the period. Value it at cost: the materials consumed so far plus any labour applied, never the selling price.

In Stocksmith, a manufacturing run moves through not started, in progress, and completed states. Material stock and cost transfer out of raw materials and into finished goods when you mark the run completed — so anything still in progress is sitting in your raw materials inventory, valued at its material cost, until you close it off. If you have runs open at period end, complete the ones that are genuinely finished before you pull your figures, and value the rest by the materials already committed to them.

Stocksmith also handles component assembly situations: you can manufacture sub-components (like pre-poured wax bases or fragrance blends) and hold them in material inventory until they’re needed in a finished product run.

How to Calculate Ending Inventory Using Weighted Average

When using the COGS method, you can calculate your ending inventory using the weighted average cost method. This takes into account the cost of each item in inventory and calculates an average cost per unit based on all available stock.

To determine your weighted average inventory value:

  1. Calculate the total cost of all units in beginning inventory plus all units purchased during the period.
  2. Determine the total number of units across both beginning inventory and purchases.
  3. Divide total cost by total units to get your weighted average cost per unit.
  4. Multiply by the number of units in ending inventory to get your ending inventory value.

This method works well for businesses that buy materials in varying lot sizes at fluctuating prices, common when purchasing lye or fragrance oils in bulk.

How to Calculate Ending Inventory Using FIFO

FIFO (first-in, first-out) is another method commonly used to calculate ending inventory. It assumes that the first items purchased or produced are also the first items sold.

To calculate your ending inventory using FIFO:

  1. List all purchases and production runs during the period in chronological order, starting with the earliest.
  2. Calculate the value of each purchase using original material and labour costs.
  3. Work through the list chronologically, assigning those costs to units sold first.
  4. Whatever remains un-allocated at the end of the period is your FIFO ending inventory.

FIFO can be useful if you sell perishable goods (like bath bombs or food-safe products) or if you experience significant fluctuations in material costs, since it assigns the oldest (usually lower) costs to goods sold first.

FIFO vs. Weighted Average — Side-by-Side Comparison

Both methods are accepted, but they produce different ending inventory values from the same underlying data. Here’s how they compare:

  FIFO Weighted Average
How it works Oldest costs assigned to goods sold first; newest costs remain in ending inventory Average cost calculated across all units available; applied to all units sold and remaining
Ending inventory value Usually higher (newer, often pricier stock stays on the books) Smoothed out, less sensitive to price swings
Best for Perishables; businesses with rising material costs Bulk purchases; stable or variable-lot pricing
Complexity Higher: requires tracking costs by purchase lot Lower: one calculation per period
Common for Bath bomb, food-safe, or fragrance producers Soap, wax, and dye producers buying in bulk

Neither method is universally “better”, it depends on how your material costs fluctuate and what your accountant recommends. Stocksmith uses the rolling weighted average cost method, which keeps things simple when you buy the same materials repeatedly at shifting prices.

What if You’re Not Using the COGS Method?

Your ending inventory calculation is entirely dependent on using the COGS method to value your stock. If you are using indirect expensing for all raw materials (i.e. writing off materials as purchased rather than when used), you’ll likely want to record your ending inventory as $0 on tax filings. It’s important to discuss this approach with your accountant to ensure it suits your specific business structure.

Tracking inventory using COGS has real advantages: it gives you an accurate understanding of profitability, lets you see the true value of your stock on hand at any time, and helps you make informed purchasing decisions.

Using Software to Calculate Your Ending Inventory

Doing this manually (across multiple products, production runs, and material purchases) quickly becomes unwieldy. Stocksmith automates the entire process: it tracks your raw material purchases, records material consumption as you log manufacturing runs, and calculates your COGS and ending inventory in real time.

At the end of any accounting period, you can pull a COGS report directly from Stocksmith and hand it to your accountant, with beginning inventory, purchases, COGS, and ending inventory already calculated, broken down by product or material.

Frequently Asked Questions

What is ending inventory?

Ending inventory is the total value of unsold goods (including raw materials, work-in-progress, and finished products) that remain in your business at the close of an accounting period. It is also called closing inventory. This figure flows directly into your balance sheet and your Cost of Goods Sold calculation for tax purposes.

How do you calculate ending inventory?

The standard formula is: Ending Inventory = Beginning Inventory + Purchases − Cost of Goods Sold. Start with the value of your inventory at the beginning of the period, add any new purchases made during the period, then subtract the cost of all goods you sold. The result is the value still sitting in your inventory at period-end.

Does ending inventory include work-in-progress (WIP)?

Yes, ending inventory includes raw materials, work-in-progress, and finished goods that haven't been sold. WIP typically includes batches currently in production, partially assembled products, and cured or cooling goods not yet packaged. It's important to value WIP at cost (materials consumed plus labour applied) rather than selling price.

What's the difference between ending inventory and COGS?

COGS (Cost of Goods Sold) is the total cost of goods that were actually sold during the period — an income statement expense. Ending inventory is the cost of goods that were not sold — a balance sheet asset. They are two sides of the same coin: the more accurately you track one, the more accurate the other will be.

How does Stocksmith calculate ending inventory?

Stocksmith tracks every material purchase, manufacturing run, and sale in real time. When you mark a production run complete, the material costs are automatically moved from raw materials inventory to finished goods. When a sale is recorded, those costs shift to COGS. At the end of any accounting period, Stocksmith can generate a COGS report showing your beginning inventory, purchases, COGS, and ending inventory, ready to hand to your accountant.

Should I use FIFO or weighted average to value my ending inventory?

For most small manufacturers, weighted average is the simpler and more practical choice. It smooths out price swings across bulk purchases and doesn't require tracking individual batch costs. FIFO makes more sense if you sell perishable goods or if your material costs rise significantly over time, since it assigns older (cheaper) costs to goods sold, leaving newer stock on your books at current value. Talk to your accountant before switching methods, as consistency across periods matters for tax purposes.

Nicole Pascoe Nicole Pascoe - Profile

Written by Nicole Pascoe

Nicole is the co-founder of Stocksmith, inventory and manufacturing software designed for small-batch product businesses. She has been working with, and writing articles for, small manufacturing businesses for the last 12 years. Her passion is to help product businesses scale with confidence — with accurate costs, controlled inventory, and systems their team can actually follow.