Shipfusion Blog

How To Calculate the Ending Inventory Formula for Ecommerce

Handling ending inventory can be tricky, especially since it comes at the end of the financial year when ecommerce businesses are also trying to maximize end-of-year sales and putting together inventory reports. However, mastering the ending inventory formula can bring a lot of value to your ecommerce business.

Using the ending inventory formula can provide insights and data that ecommerce businesses can leverage to optimize stock levels, forecast future sales, and enhance overall financial planning, setting the year up for success.

It can be easy to get a little lost when calculating ending inventory. That’s why we’ve assembled this guide outlining what is actually included in ending inventory, calculating the ending inventory formula, and how doing so can benefit your ecommerce business. We’ve also included a free downloadable template that will automatically calculate your company’s ending inventory using all three methods, so your business can use these insights right away.

What is Ending Inventory? 

The clue’s in the name! Ending inventory is the inventory that’s left over at the conclusion of an accounting period. For most ecommerce businesses, especially in the retail or wholesaling sectors, ending inventory typically represents finished goods that are ready for sale.

However, for manufacturing companies, ending inventory can be more complex. It generally consists of: 

  • Raw Materials: These are the basic materials and components that will be used in the production process but haven’t been used yet.
  • Work-in-Progress (WIP): This category includes goods that are in various stages of the production process but aren’t yet complete. It represents the raw materials, labor, and overhead costs that have been applied so far.
  • Finished Goods: These are fully completed products ready for sale.

In determining the value of ending inventory, a company would typically account for the costs associated with each category. For example:

  • The cost of raw materials would include the purchase price, freight, import duties, and other costs directly attributable to bringing the materials to their current location and condition.
  • The value of WIP inventory would consider raw material costs, as well as a portion of labor and manufacturing overhead based on the production stage.
  • The value of finished goods would include the total manufacturing cost, which consists of raw materials, labor, and manufacturing overhead.

You can include your ending inventory as an asset on your balance sheet, and it’s also useful for gauging the overall performance of your business. A change in ending inventory from one period to the next can indicate growth or highlight problems. 

You’ll sometimes see the term ‘closing inventory,’ which can be used interchangeably with ending inventory. Both terms represent the value of sellable goods at the close of an accounting period. 

This is the formula used to calculate ending inventory:

Ending Inventory = Beginning Inventory + Purchases – Cost of Goods Sold (COGS) 

We’ll run through what each of these terms means next. 

Beginning Inventory

Where ending inventory denotes the products left at the end of an accounting period, beginning inventory refers to the products a business begins the accounting period with. This figure is the total monetary value of goods that were in stock and ready to sell at the start of the accounting period and should match the ending inventory of the previous period. 

While some businesses include raw materials and parts in their beginning inventory, for ecommerce businesses, beginning inventory always refers to products that are actually available for sale. Having a clear sense of your beginning inventory is essential for calculating ending inventory, but it also helps inform other areas of ecommerce reporting, such as calculating your average stock levels and investigating shrinkage.


To calculate ending inventory, you’ll also need to know the net purchases figure. This is defined as the value of the goods your business bought during the accounting period and excludes discounts, allowances, and item returns. Essentially, it’s the amount your business spent purchasing new inventory minus any deductions. 

To calculate your net purchases figure, take the amount your business spent on stock during the accounting period and deduct any returns. For example, if you bought $10,000 of stock but returned $1000, your net purchase figure would be $9000.

Cost of Goods Sold (COGS)

Cost of Goods Sold refers, in essence, to the cost of doing business. It’s a business expense that includes the cost of buying the goods before selling. This figure is included in the income statement of a business, and it’s also a tax requirement; you’ll need to report your COGS to the IRS, which can help reduce your tax bill.

There are many expenses that you can include in the COGS figure. Some of the most commonly included expenses are:

  • Labor costs
  • Supplies used to sell the product
  • Shipping costs
  • Container/warehouse costs
  • Cost of items the business plans to sell
  • Overhead costs, such as rental agreements and utilities 
  • Cost to purchase products/parts from suppliers

COGS isn’t an asset or a liability. It’s the costs and expenses of producing products. Having a high COGS can help to reduce the amount of tax owed, but it’ll also impact profits. To increase your chances of maximizing profits, it’s best to have a low COGS figure.


Ending Inventory Formula Examples

Calculating the value of ending inventory accurately is foundational for any business. Your chosen method will influence your financial outlook, inventory decisions, and profit margins. It’s important to remember that once a method is chosen, especially for tax purposes, consistency is key to ensuring accurate and compliant reporting. There are three methods for calculating your ending inventory:

FIFO Method (First In, First Out)

Under FIFO, it’s assumed that the items bought earliest are sold first. This means that the costs of the most recent inventory purchases remain on the books until later sales.


Suppose you acquired 8 units of a product at $12 each. Later on, you purchased another 7 of the same product at $17 each. If you were to sell 6 units under FIFO, you’d record the cost based on your initial acquisition of $12/per unit:

6 units x $12 = $72 in COGS.

Ending Inventory under FIFO:

(8 – 6) units x $12 + 7 units x $17 = $2 x $12 + $119 = $143.

Ending Inventory FIFO method

During times of rising prices, the FIFO method results in higher ending inventory values, with a lower cost of goods sold, leading to potentially higher reported profits.

LIFO Method (Last In, First Out)

LIFO proposes that the items added to inventory most recently are the first ones sold. Hence, older stock remains as part of the ending inventory.


With the previous buying pattern of 8 units at $12 followed by 7 units at $17, if you sold 6 units while adhering to LIFO, you’d be expensing the newer stock at $17:

6 units x $17 = $102 in COGS.

Ending Inventory under LIFO:

8 units x $12 + (7 – 6) units x $17 = $96 + $17 = $113.

Ending Inventory LIFO method

In scenarios where prices are on an upward trajectory, LIFO can be advantageous from a taxation standpoint. It yields higher COGS and subsequently lower reported earnings, potentially mitigating tax burdens.

Weighted Average Cost Method

The weighted average cost (WAC) method calculates an average cost for all items in the inventory, forming the basis for the value of items sold and the ending inventory.


Suppose you start the fiscal year with an inventory of 8 units priced at $12 each. Later in the year, you acquire 7 more of the same items, but this time they were purchased at $17 each. To find the average cost, combine the total cost of both purchases and divide by the total number of items:

(8 units x $12) + (7 units x $17) ÷ (8 units + 7 units)

$96 + $119 ÷ 15 units = $215 ÷ 15 = $14.33 (rounded to nearest cent)

So, the average cost per unit is $14.33. If you sell 6 units, your COGS would be:

6 units x $14.33 = $86.

Ending Inventory under WAC:

($96 + $119) – $86 = $129

Ending Inventory WAC method

The weighted average method is particularly useful when handling inventory items that are similar to one another, making it challenging to assign specific costs to individual units.





Download your ending inventory formula template here: 




Why Use the Ending Inventory Formula 

Calculating your ending inventory isn’t going to be the most exciting part of running your business, but it is an important part. Having your ending inventory figure can help to unveil a whole host of valuable information that can help gauge the performance of your ecommerce business.

Inventory Management

Having a clear understanding of how much stock you have available for sale is crucial in running a successful business. In doing so, you can ensure that you have products available when customers want to buy them. It can also help to reduce the likelihood of overstocking (having too many of one item), stockouts (not having products available for purchase), and aid in managing the allocation of warehouse space.

Financial Reporting

The ending inventory figure can be included on the company’s balance sheet, helping businesses have a clear sense of their financial position. The figure forms part of the company’s total assets, making it a valuable part of the overall valuation of the company.

Profitability Analysis

It’s crucial to know whether your company is profitable or not — and, if so, how profitable. The ending inventory will impact the future calculation of your COGS, which you’ll then subtract from sales revenue to determine the gross profit made during the accounting period. It’s a vital tool in assessing the overall profitability of a business, which can then impact strategic decisions. For instance, you may decide to adjust your pricing strategy or change your marketing approach.

Cash Flow Planning

Since cash flow problems are the leading cause of business failure, maintaining a healthy cash flow is vital for all businesses. If you have an understanding of your ending inventory, then you’ll be in a stronger position to manage your cash flow moving forward. For instance, you may find that you have too much inventory, which could indicate that too much cash is tied up in stock. You can adjust your stock levels going forward to free up cash to spend elsewhere.

Supply Chain Management

Ending inventory also plays a significant role in supply chain management. You can use ending inventory to identify trends in your inventory levels, which can influence your purchasing decisions and your supply chain management. If your ending inventory is high year after year, then the business may decide to change its purchasing strategy.

For Investors 

A potential investor will look at a company’s financial reporting before deciding to invest. If you plan on seeking investment from outside sources to help fund the growth of your ecommerce business, then accurate ending inventory reporting is essential since it can inspire confidence in investors that the business is profitable. 

Ending Inventory Formula FAQ 

Why is Ending Inventory Important?

Ending inventory highlights the company’s gross and net profit, and is important for properly handling accounting, taxation, and business management.

What is Ending Inventory Used For?

Businesses use ending inventory to help gauge their financial health. It can also highlight cash flow issues and plays an important role in ecommerce inventory management and supply chain management.

What Problems Can Arise from Inaccurate Ending Inventory? 

If ending inventory is misreported, it will affect the cost of goods sold (COGS) and, subsequently, gross profit and net income figures. This can mislead stakeholders about the financial health of a company. An inaccurate inventory valuation can also lead to incorrect budgeting and purchasing decisions. Companies might end up overstocking or understocking, leading to tied-up capital or missed sales opportunities.

What Products Are Included in the Ending Inventory Formula?

You should include products that are available for purchase. Damaged goods or other items you cannot sell, such as parts that haven’t yet been assembled into sellable products, should not be included.

Do You Include Ending Inventory on a Balance Sheet?

Ending inventory is an asset, not a liability, since it represents stock that can be sold. You’ll record ending inventory on the asset side of your company’s balance sheet.

Are Ending Inventory and Beginning Inventory The Same?

Ending inventory and beginning inventory are the same if they connect the accounting period. For instance, the beginning inventory figure is typically the same as the ending inventory figure for the accounting period that preceded it. 

As we’ve seen, having an accurate ending inventory figure is an essential part of running a well-managed ecommerce business. But you can only create accurate ending inventory figures if you know how much stock you have. 

At Shipfusion, our proprietary ecommerce inventory management software takes the stress out of inventory management. Our software helps businesses sync their inventory data across multiple channels in real time, ensuring you always have a clear idea of your stock levels. Our inventory management system is an essential part of our turnkey ecommerce fulfillment services, helping to avoid spoilage, improve cash flow, and enhance customer satisfaction, among many other benefits. 

If you’re interested in optimizing your inventory management and order fulfillment without the stress of managing your own logistics, contact one of our fulfillment experts today.