Key takeaways
- The moving average formula calculates a new average unit cost after each purchase by dividing the total cost of inventory by the total quantity on hand.
- Unlike FIFO or LIFO, the moving average method doesn’t rely on tracking individual costing layers.
- This costing method smooths out cost fluctuations and provides a unit cost that typically falls between FIFO and LIFO.
- When using moving average costing, you can calculate COGS by multiplying the quantity sold by the current average unit cost.
- Moving average costing can be less accurate for businesses that experience significant price volatility, potentially distorting profit margins.
- Utilizing inventory software like inFlow can automate moving average calculations, reducing manual effort and errors.
Costing methods are important to nail down. This is because each method can report very different profits and cost of goods sold (COGS), even when you calculate from the same stock levels and purchase prices. We’ve discussed FIFO (First in first out) and LIFO (Last in first out) costing methods in other articles, so now it’s time to discuss a third option, the moving average formula. The moving average formula is a solid choice for ensuring your costs are always up to date.
A moving average formula will generate a product cost that falls between what FIFO and LIFO would report. This can be very useful if it isn’t possible or feasible to deal with multiple costing layers.
Be sure to download our handy Inventory Formula Cheat Sheet. It has 7 of the most common inventory formulas all in one convenient location.
Download your inventory cheat sheet now!
What is moving average cost in inventory accounting?
Moving average cost is an inventory valuation method that continuously recalculates the average cost of inventory after each new purchase. Instead of tracking separate costing layers, every unit in stock shares the same current average cost.
Under a perpetual inventory system, businesses use moving average costing to calculate both:
- inventory value
- cost of goods sold (COGS)
Each time inventory is purchased, the average unit cost updates based on:
- the value of inventory already on hand
- the value of the new purchase
- the total quantity available
This creates a continuously updated inventory cost that smooths out price fluctuations over time.
Moving average cost vs weighted average cost
Moving average cost and weighted average cost are closely related inventory costing methods, but they are not always used in the same way.
Weighted average cost is the broader accounting method. It calculates an average inventory cost across all units available for sale during an accounting period.
Moving average cost is the perpetual version of weighted average costing because the average updates after each purchase rather than only at the end of the period.
Weighted average cost (periodic system)
Under a periodic inventory system, businesses calculate an average cost for the entire accounting period.
The average cost remains fixed until the next accounting period.
Moving average cost (perpetual system)
Under a perpetual inventory system, the average cost is recalculated each time inventory is purchased through a purchase order.
This creates a continuously changing average unit cost throughout the accounting period.
Moving average inventory formula
The moving average inventory formula calculates a new average unit cost every time you purchase additional inventory. As mentioned, this method is the perpetual version of weighted average costing because the average cost updates continuously as you receive new stock.

Formula for average unit cost after each purchase
Use this formula whenever new inventory is received:
To calculate the updated moving average cost after a purchase:
- Add the value of inventory already in stock
- Add the value of the new inventory purchase
- Add the total number of units on hand
- Divide the total inventory cost by the total quantity
Formula:
Example:
A business currently has:
- 30 units in stock
- Current average cost: $10.00 per unit
- Current inventory value: $300
The business purchases:
- 40 additional units
- Purchase cost: $10.50 per unit
- New purchase value: $420
The updated moving average cost becomes:
After the purchase, every unit in inventory is now valued at $10.29 per unit.
The business later purchases:
- 30 additional units
- Purchase cost: $11.00 per unit
- New purchase value: $330
The moving average updates again:
After the final purchase, every unit in inventory is valued at $10.50 per unit.
Formula for cost of goods sold under moving average
Under the moving average method, cost of goods sold (COGS) uses the current average unit cost at the time of sale.
Formula
The average cost remains the same until another inventory purchase changes it.
Example
Continuing the previous example:
- Current moving average cost (after March 15 purchase): $10.50 per unit
- Units sold: 40
The cost of goods sold is:
40 × $10.50 = $420.00
The remaining inventory becomes:
60 × $10.50 = $630.00
This approach keeps inventory costing relatively simple because all units share one continuously updated average value instead of being separated into individual cost layers.

Moving average vs FIFO vs LIFO
FIFO, LIFO, and moving average costing are the three most common inventory valuation methods businesses use to calculate:
- cost of goods sold (COGS)
- ending inventory value
- gross profit
The main difference between these methods lies in how they assign inventory costs as prices change over time.
- FIFO assumes the oldest inventory sells first.
- LIFO assumes the newest inventory sells first.
- Moving average uses one continuously updated average cost for all units.
Because each method values inventory differently, the same sales activity can produce different COGS and ending inventory totals.
Cost layers, COGS, and ending inventory differences
The biggest difference between FIFO, LIFO, and moving average costing is how each method handles inventory cost layers.
FIFO (first in, first out)
FIFO assumes the oldest inventory costs are used first when inventory is sold.
Using the example data:
| Date | Quantity | Purchase Price | Inventory Layer Value |
|---|---|---|---|
| Jan 15 | 30 | $10.00 | $300.00 |
| Feb 15 | 40 | $10.50 | $420.00 |
| Mar 15 | 30 | $11.00 | $330.00 |
FIFO sells inventory from the oldest layer to the newest layer.
With the example sales orders:
| Date | Quantity Sold |
|---|---|
| Mar 19 | 30 |
| Mar 23 | 40 |
FIFO uses:
- all 30 units from the January purchase at $10.00
- all 40 units from the February purchase at $10.50
Under FIFO, the remaining inventory consists entirely of the March inventory layer at the newer $11.00 unit cost.

LIFO (last in, first out)
LIFO assumes the newest inventory costs are used first when inventory is sold.
Using the same inventory purchases and sales activity in the above example, LIFO pulls inventory from the newest layer backward.
LIFO uses:
- all 30 units from the March purchase at $11.00
- all 40 units from the February purchase at $10.50
Under LIFO, the remaining inventory consists entirely of the January inventory layer at the older $10.00 unit cost.
Moving average costing
Moving average costing does not track separate inventory layers. Instead, every unit shares the same continuously updated average cost.
Using the same purchases:
| Date | Quantity Purchased | Purchase Price | Purchase Value |
|---|---|---|---|
| Jan 15 | 30 | $10.00 | $300.00 |
| Feb 15 | 40 | $10.50 | $420.00 |
| Mar 15 | 30 | $11.00 | $330.00 |
Total inventory available:
- 100 total units
- $1,050 total inventory value
The moving average cost becomes:
Using the same sales activity:
The remaining inventory becomes:
The moving average method produces results between FIFO and LIFO because it smooths inventory costs across all units instead of assigning costs from specific inventory layers.

Comparing costing methods
Using the moving average formula to derive COGS from Zealot lens sales, you can see that it falls between the figures that FIFO or LIFO report:
- FIFO reported a COGS of $720.00
- Moving Average reported a COGS of $735.00
- LIFO reported a COGS of $750.00
It’s important to remember that the cost of goods sold will not be identical when comparing FIFO vs. moving average vs. LIFO in a particular period of time, like a financial year. This can affect how much revenue your business reports, which in turn affects how much tax you pay. Determining which costing method suits your business and sticking to it is essential.
IFRS and U.S. inventory accounting rules
When thinking about which costing method to adopt in your business, you should keep in mind that Inventory accounting rules differ between IFRS and U.S. accounting standards.
IFRS inventory costing rules
Under International Financial Reporting Standards (IFRS), businesses can generally use:
- FIFO
- weighted average cost
- moving average cost under perpetual inventory systems
However, IFRS does not allow LIFO inventory accounting.
This restriction exists because LIFO can leave outdated inventory costs on the balance sheet during long periods of inflation.
U.S. inventory costing rules
Under U.S. accounting rules and tax regulations, businesses may use:
- FIFO
- LIFO
- weighted average cost
- moving average cost
LIFO remains popular in some industries because rising inventory costs can increase COGS and reduce taxable income during inflationary periods.
When to use moving average costing
Moving average costing works best for businesses that want simpler inventory valuation without tracking separate inventory cost layers.
Since this inventory valuation method continuously updates a shared average cost across all inventory units, businesses commonly use it with perpetual inventory systems, as inventory software can automatically recalculate the average cost after each purchase.
Best-fit inventory and business types
Moving average costing is most effective when inventory items are:
- interchangeable
- difficult to track individually
- purchased frequently at changing prices
- stored together instead of separated into batches
The method is commonly used by businesses that carry large volumes of similar inventory, including:
- wholesale distributors
- manufacturers
- ecommerce businesses
- retailers
- industrial suppliers
- parts and component suppliers
For example, a business selling hundreds of identical bolts, cables, lenses, or packaged products usually does not need to track which exact unit was purchased first. Using one continuously updated average cost simplifies inventory valuation across all units.
Moving average costing also works well for businesses that:
- experience moderate price fluctuations
- want smoother inventory valuation
- rely on automated inventory management software
- need real-time inventory costing updates
Benefits of moving average costing
The moving average costing method comes with a ton of advantages, most of which boil down to simplicity. Let’s take a closer look at all the benefits of moving average costing.
Simplifies inventory accounting
Moving average costing reduces administrative complexity because inventory costs automatically update after each purchase.
Instead of tracking inventory layers from January, February, and March separately like FIFO or LIFO, the business works with one shared moving average cost across all 100 units on hand. This makes the method easier to manage than tracking multiple inventory layers over time.
Smooths price fluctuations
The averaging process reduces the impact of sudden fluctuations in inventory prices.
In the example used throughout this article, purchase prices gradually increased from:
- $10.00 in January
- $10.50 in February
- $11.00 in March
Instead of assigning the lowest or highest costs to specific sales, moving average costing blended those purchases into a shared average cost of $10.50 per unit. This creates more stable COGS, inventory valuation, and gross profit reporting
Works well with perpetual inventory systems
Most inventory management software automatically recalculates moving average cost in real time.
This allows businesses to:
- update inventory value continuously
- calculate accurate COGS immediately after each sale
- reduce manual accounting work
- improve reporting consistency
For businesses with frequent purchasing activity, automation is especially important because the average cost changes after every inventory receipt.
Easier inventory valuation for interchangeable goods
Businesses that sell high volumes of similar products often find moving average costing easier than identifying individual inventory layers.
The method works especially well when inventory units are physically mixed together and cannot realistically be separated by purchase date.
For example, once inventory from the January, February, and March purchases is stored together in the same warehouse bins, distinguishing one specific unit from another often becomes challenging. Moving average costing avoids this problem by assigning all units the same current average cost.
Limitations and common mistakes
Although moving average costing simplifies inventory valuation, the method also has limitations.
Less precise cost matching
Moving average costing blends all inventory costs together instead of matching exact purchase costs to specific sales.
In the FIFO and LIFO examples earlier, inventory sold on March 19 and March 23 used specific purchase layers to calculate COGS. Moving average costing does not preserve those individual cost layers.
During periods of rapid price changes, this can make inventory valuation less precise than FIFO or LIFO.
Can hide cost trends
Because the method smooths inventory costs over time, businesses may have a harder time identifying sudden increases in supplier pricing or purchasing costs.
For example, even though inventory costs increased from $10.00 to $11.00 in the example purchases, the moving average only rose gradually to $10.50. The averaging effect reduces visibility into short-term changes in inventory costs.
Requires accurate perpetual inventory tracking
Moving average costing depends on accurate inventory records. If purchase quantities, receiving records, or inventory counts are incorrect, the average unit cost can become inaccurate across all future sales.
Because each new purchase recalculates the shared inventory cost, even small inventory errors can affect future COGS calculations.
Common implementation mistakes
Businesses often make mistakes by failing to update inventory records after purchases, excluding freight or landed costs from inventory value calculations, or grouping different product types under the same average cost. Problems also commonly occur when businesses rely on manual spreadsheets instead of automated inventory systems or apply moving average costing inconsistently across reporting periods.
To maintain accurate inventory valuation, businesses should use consistent costing procedures and ensure that inventory software updates costs automatically after every purchase.
How inventory software automates moving average costing
Some businesses track their FIFO and LIFO costs on paper, but if you choose to use moving average, you’ll want software to help you keep all the math manageable. Excel can work if you have a formula to keep rolling the totals from a previous cell, but that requires consistent fine-tuning. inFlow handles all of these critical, continuous calculations on the back end so you can focus on other aspects of your business.
This method of cost tracking works very well for many small businesses. For this reason, we’ve made it the default costing method in our software (although you can change this). If you start using inFlow, it will automatically use the moving average formula so that you can see how unit cost has changed over time.

Hi! I’m going to use average moving method. Could you advise,how to calculate average cost if i have sales first than purchases?
Hi Liza,
This sounds like a situation where you are back-ordered or you have to specially order an item in. I think you would need to wait for the purchase order (PO) to arrive, and that would help you to establish your cost.
You can still use the moving average formula provided in the article, but with a slight modification.
Our original formula above tries to factor in existing stock, but you can’t do that in your example, because you sold your item on a sales order (SO) without having any in stock. You would have to create a new PO to actually get that product in so that your customer could take it.
So in cases where you have 0 or negative stock, I’d modify the formula to apply to your very next PO only:
Average unit cost = [Total cost of PO / Total qty ordered on PO]
Once you get back to having a positive amount of stock (over 0), you can go back to using the formula in the article.
– Thomas
Can similar items be reasonably grouped? For example if I have 2-3 types of necklace cords I use for making/selling pendants can I group these under “Necklace Cords” with an averaged price? I do many small batch and one-off projects and tend to buy a lot of different raw materials but in a fairly small number of categories.
Hi Dan,
If I understand that correctly, groiuping 2–3 different pendants would be calculating cost for a category or group. It’s fine to do that if they’re very similar costs and prices, but it’s not the same thing as identifying the moving average cost for one particular kind of pendant.
What about if I have incoming debits and credits and I need to find the latest value?
For example:
Description AMOUNT QTY
Credit -255.15 -1.000000
Credit -255.15 -1.000000
Credit -255.15 -1.000000
Credit -255.15 -1.000000
Debit 289.80 1.000000
Debit 331.80 1.000000
Debit 331.80 1.000000
Debit 67.20 1.000000
Debit 22.22 1.000000
Assuming last transaction is latest date, would MAC be Sum of amount / sum of qty?
Hi BB, in the case of calculating cost based on moving average, we’d only use the quantities and the credits (assuming these represent paying for the product). Any debits from sales of the product would not affect the cost.
Since all your credits in that example were -225.15, then the cost per unit is simply 225.15.
However, since there were only 4 credits and 5 debits, that leaves your stock in an overall quantity of -1.
So you’d need one additional credit in order for any system to properly calculate the cost.
Hi Thomas,
This is a great read!
I was wondering at what periods would you calculate the moving average in my case? For example if I make a new order, the invoices for manufacturing will be in January, inspection in February and freight is in March. When will you calculate the moving average? In January? I only have the manufacturing invoice and estimates of inspection and freight. Or in March? When I receive the goods and have all the invoices to calculate the moving average.
And assuming you calculate the moving average in March, does it prevent you from recording the January/February invoices in your monthly periodic bookkeeping system? Does inventory invoices even recorded into the bookkeeping system in any other way but as COGS when sales occurs?
Thank you!
Hi Tal,
Thanks for stopping by!
That’s a good question; you could record the cost initially in January and then update the PO/cost when you get other inspection/freight charges. Your other method would work too, but at least this way you have partial costs captured, even though you’re waiting for inspection/freight costs to arrive.
I can’t speak for all systems, but if you did this in inFlow Cloud, the product cost would be updated accordingly if you made changes to the original PO. The date used for the updated cost would be the Receive Date for those items on the purchase order.
how do I calculate my unit cost after my sales which has an increased sales cost to my new purchase?
Hi Zina, adjusting cost after-the-fact can be a bit tricky, but generally we suggest adding or modifying the sales order record and making a note of it, so others know why it was changed. In inFlow you can add extra services to the sales order to effectively increase the cost of items sold on that order.
Or if you’re using moving average cost within inFlow, you can add a retroactive cost adjustment to that product. This article can help you with that if you use inFlow Cloud: https://www.inflowinventory.com/support/cloud/my-products-cost-is-wrong-how-do-i-change-it/
That way any report that calculates profit will take this newer, higher cost into account.
If in the moving average inventory method, there are purchases with purchase discounts and allowances, how should we account for that?
Hi Mathia,
Our system (inFlow Inventory) actually recommends moving averages by default. If you make a purchase order and there’s a discount applied, it will automatically deduct from the cost of that product. You can even specify that certain items on a PO have a discount, while others were purchased at full price, and inFlow can account for all of them using the formulas in this article.