How to Calculate Weighted Average Cost: Formula and Example

To calculate weighted average cost, divide the total cost of goods available for sale by the total number of units available for sale. The result is a single per-unit cost that applies to every item in stock, regardless of when it was purchased or what you paid for it. Multiply that per-unit figure by the units remaining at the end of the period to get ending inventory value; whatever cost is left over becomes cost of goods sold. The method is permitted under U.S. GAAP through ASC 330 and under IFRS through IAS 2.1IFRS Foundation. IAS 2 Inventories

The Formula

Weighted Average Cost per Unit = Total Cost of Goods Available for Sale ÷ Total Units Available for Sale

“Total cost of goods available for sale” is your beginning inventory value plus every dollar spent acquiring new inventory during the period. “Total units available for sale” is your beginning inventory count plus every unit received. The quotient is your cost per unit. Multiply it by the units still on hand at period-end to get ending inventory. Subtract that from the total cost pool and you have cost of goods sold.

A Worked Example

Say you run a hardware store and calculate weighted average cost once at the end of the month. Your activity for the period looks like this:

  • Beginning inventory: 200 units at $8.00 each = $1,600
  • First purchase: 300 units at $9.00 each = $2,700
  • Second purchase: 100 units at $10.50 each = $1,050

Step 1. Add up total cost: $1,600 + $2,700 + $1,050 = $5,350.

Step 2. Add up total units: 200 + 300 + 100 = 600 units.

Step 3. Divide: $5,350 ÷ 600 = $8.9167 per unit (rounded to four decimal places).

Step 4. Apply the per-unit cost to your physical count. If 250 units remain on the shelf, ending inventory is 250 × $8.9167 = $2,229.17. The remaining $3,120.83 is cost of goods sold.

Pick a rounding convention (usually the nearest cent or four decimal places) and apply it every period. Small rounding differences compound across thousands of transactions, so consistency matters more than the specific choice.

Which Costs Belong in the Total

The “cost” in weighted average cost is not just the invoice price. Under GAAP, inventory cost includes every expense necessary to bring goods to their present condition and location. Purchase price, freight, handling fees, import duties, and tariffs all get rolled into the total.

For manufacturers, the pool is wider. Direct materials, direct labor, and manufacturing overhead (factory rent, equipment depreciation, utilities for the production floor, indirect materials like adhesives) all belong in inventory cost. A common mistake is treating factory overhead as a period expense instead of capitalizing it. Administrative costs and selling expenses stay out; they are period costs.

Getting this wrong distorts your weighted average from the start, and every downstream number (ending inventory, cost of goods sold, gross profit) will be off. The test: did the cost help get the product to a sellable state? If yes, include it. If it relates to selling or general administration, leave it out.

Calculating in a Periodic vs. Perpetual System

Which system you run changes when the formula gets applied.

In a periodic system, you calculate weighted average cost once at the end of the period. All purchases during the period are pooled, and the single average is applied retroactively to figure out ending inventory and cost of goods sold. You need a physical count to know how many units are actually on hand. Any gap between what your records say and what you count gets absorbed into cost of goods sold, because the formula works backward: total cost minus ending inventory value equals cost of goods sold.

In a perpetual system, the average recalculates after every purchase. This variant is called the moving average method. Each time new units arrive at a different price, the system blends their cost with the existing stock to produce an updated per-unit cost, and sales are recorded at whatever the average is at that moment.

Here is how moving average plays out:

  • Starting inventory: 10 units at $10.00 each = $100.00
  • Purchase 1: 15 units at $12.00 each = $180.00
  • New average: ($100 + $180) ÷ 25 units = $11.20 per unit
  • Sale: 18 units removed at $11.20 = $201.60 in cost of goods sold
  • Remaining: 7 units at $11.20 = $78.40
  • Purchase 2: 20 units at $13.00 each = $260.00
  • New average: ($78.40 + $260.00) ÷ 27 units = $12.53 per unit

The average shifts with every transaction. After the first purchase, cost per unit was $11.20. After selling 18 units and buying 20 more at a higher price, it moved to $12.53. The system never resets; it continuously carries forward the blended cost of whatever remains in stock.

Most businesses running a perpetual system rely on ERP or inventory software to handle the recalculations. One pitfall to watch for: recording a sale before the corresponding purchase has been entered can push inventory balances negative and distort the average. If your software shows negative units on hand, every cost calculation from that point is unreliable until the receiving records catch up.

The same underlying activity will produce different cost-of-goods-sold and ending-inventory figures under the two approaches, because units sold earlier in the period carry a different average under perpetual than under periodic. Neither answer is wrong; they reflect different timing assumptions.

Compare Cost to Net Realizable Value

Running the formula is only the first step. Both GAAP (for methods other than LIFO) and IFRS require you to compare weighted average cost against net realizable value and report inventory at whichever is lower.1IFRS Foundation. IAS 2 Inventories

Net realizable value is the estimated selling price minus any costs needed to complete and sell the item. If your weighted average cost is $12.53 per unit but the product now sells for $11.00 and costs $0.50 to ship, net realizable value is $10.50. You write inventory down from $12.53 to $10.50 per unit and recognize the difference as an expense in that period. This typically comes up when products become obsolete or damaged, or when market prices decline sharply.

Under IFRS, if the circumstances later reverse and the selling price recovers, you can reverse the write-down up to the original cost.1IFRS Foundation. IAS 2 Inventories The write-down only adjusts the reported value; it does not change your underlying weighted average cost calculation for future periods.

Records to Keep Behind the Calculation

Every number feeding your weighted average cost calculation needs to be retained long enough to survive an audit. That includes purchase invoices, freight bills, receiving reports, and physical count sheets.

The IRS requires you to keep records supporting items on your tax return until the statute of limitations expires, generally three years from the filing date.2Internal Revenue Service. How Long Should I Keep Records If you underreport gross income by more than 25%, the window extends to six years. If you never file or file a fraudulent return, there is no limit.

For inventory specifically, keep records for as long as you hold the stock plus the limitation period after you dispose of it. Slow-moving stock carried for years means the supporting purchase documents need to survive that entire time. An auditor wants to trace every line in your weighted average calculation back to a source document, and missing records turn a routine review into a problem.