ForHosting KIT · Finance & money

Ending inventory calculator

Start with 10,000 of inventory, add 25,000 of net purchases and sell goods that cost 20,000, and 15,000 should still be on the books, out of 35,000 available for sale. Enter the three totals for the period. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Beginning inventory
10,000
Net purchases
25,000
Cost of goods sold
20,000
You get
Goods available for sale
35,000
Ending inventory
15,000

Ending inventory — also called closing stock or closing inventory — is the merchandising identity that ties the balance-sheet stock figure to the period's purchases and cost of goods sold. Every retailer, wholesaler, and manufacturer that keeps a perpetual or periodic inventory book eventually has to answer the same close question: after this period's purchases and this period's cost of goods sold, what value is still sitting in the warehouse? The figure is not a warehouse count. It is a closed-form identity: beginning inventory plus net purchases minus cost of goods sold. This ending inventory calculator accepts those three ledger totals, rejects any negative input, and returns the ending inventory value together with goods available for sale as the intermediate.

How ending inventory, closing stock, and goods available for sale are computed

The merchandising inventory identity is the same textbook equation written under several classroom names: ending inventory, closing stock, and closing inventory. Start with beginning inventory on the balance sheet — the stock that was already on hand at the start of the window, also called opening inventory or opening stock. Add net purchases for the same window.

Net purchases is purchases of merchandise minus purchase returns and allowances minus purchase discounts, plus freight-in when that is the convention your close already uses; this calculator does not split those four lines for you — you send the already-netted total. The sum of beginning inventory and net purchases is cost of goods available for sale, the pool of merchandise that could have been sold during the period. Subtract cost of goods sold from that pool.

The remainder is ending inventory, the stock that should still be on the books at the close. Equivalently, ending inventory equals beginning inventory plus net purchases minus cost of goods sold; both routes are algebraically identical and this capability uses that form while also reporting goods available for sale as the intermediate. Zero beginning inventory is a legitimate first-period case: the warehouse starts empty and ending inventory is just net purchases minus cost of goods sold.

Zero net purchases is a legitimate no-buying window. Zero cost of goods sold is a legitimate no-sales window, in which ending inventory equals goods available for sale. The arithmetic is a handful of finite additions and one subtraction; there is no SKU aging, no FIFO or LIFO layer, no physical count, and no forecast of what will leave the warehouse next week.

If cost of goods sold exceeds goods available for sale the identity still returns a negative ending inventory rather than failing: that is a books inconsistency the caller can see, not an input-validation error.

Where an ending inventory calculator earns its keep

Controllers and bookkeepers use an ending inventory calculator at close to turn three trial-balance lines into the closing-stock figure they post before the pack is locked, then compare that book figure with a physical count so shrinkage is visible as a difference rather than as a silent plug.

Merchandisers and buyers check the same identity when they plan the next order: if beginning inventory plus expected net purchases minus expected cost of goods sold would leave the warehouse too thin or too heavy, the purchase plan changes before the goods ship. Auditors and lenders drop the same three totals into a working-paper or covenant worksheet so a closing-stock number that does not follow from purchases and cost of goods sold is caught before it becomes a restatement.

This is a different search and a different job from days inventory outstanding, from inventory turnover, from a FIFO layer, and from a physical count: those tools start from different inputs and answer different questions. Failed validation does not consume balance. Keep all three fields non-negative and finite, pin the rounded ending inventory in tests, and you get a reproducible closing-stock figure for close checklists, classroom oracles, and edge workers without standing up a warehouse engine of your own.

Month-end and year-end close

Turn beginning inventory, net purchases, and cost of goods sold into the closing-stock figure posted before the close pack is locked, then compare it with a physical count.

Purchase and replenishment planning

Project ending inventory from opening stock, planned net purchases, and expected cost of goods sold before you change an order quantity or a markdown cadence.

Audit working papers and lender worksheets

Drop the same three ledger totals into a working paper so a closing-stock number that does not follow from purchases and cost of goods sold is visible before it is signed off.

How is ending inventory calculated?

Equivalently, add beginning inventory and net purchases to obtain goods available for sale, then subtract cost of goods sold. Both routes are the same identity.

What happens if an input is negative?

Beginning inventory, net purchases, and cost of goods sold must each be a finite number greater than or equal to zero; a negative ledger total is not billed.

What is net purchases? Do I send gross purchases?

Send the already-netted figure: purchases minus purchase returns and allowances minus purchase discounts, plus freight-in if that is in your close. The calculator does not split those lines.

Can ending inventory come out negative?

Yes, if cost of goods sold exceeds beginning inventory plus net purchases. That result is returned rather than rejected so you can see the books inconsistency. Negative inputs, by contrast, are rejected.

Does the calculator use FIFO or LIFO?

Neither. It applies the inventory identity to totals you already have, with no cost layers, no item aging and no physical count. Whatever costing method you use is already reflected in the totals you enter.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/fin/ending-inventory

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/fin/ending-inventory \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"beginning_inventory":10000,"net_purchases":25000,"cost_of_goods_sold":20000}'
{
  "beginning_inventory": 10000,
  "net_purchases": 25000,
  "cost_of_goods_sold": 20000
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "fin.ending_inventory",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How ending inventory, closing stock, and goods available for sale are computed

Negative beginning inventory, negative net purchases, or negative cost of goods sold is rejected: a ledger total cannot be negative for this identity, and the task fails with invalid_input instead of inventing a signed warehouse.

Input contract, response shape, and error behaviour

Zero is allowed on every field. Example: ten thousand of beginning inventory, twenty-five thousand of net purchases, and twenty thousand of cost of goods sold yield thirty-five thousand of goods available for sale and fifteen thousand of ending inventory. POST a JSON body with three required finite numbers in one currency. beginning_inventory is the opening stock for the window; aliases beginning_stock, opening_inventory, and opening_stock map to the same field so a worksheet can keep its column names. net_purchases is the already-netted merchandise purchases for the same window; aliases purchases, net_purchase, and merchandise_purchases are accepted. cost_of_goods_sold is cost of goods sold for the same window; aliases cogs, cost_of_sales, and cogs_sold are accepted so ledgers can keep their column names. Each numeric field may arrive as a JSON number or a numeric string. Missing fields, empty strings, and non-finite values — NaN, Infinity, or text that does not parse as a number — fail with invalid_input naming the field. On success the body echoes beginning_inventory, net_purchases, and cost_of_goods_sold, then reports goods_available_for_sale as beginning inventory plus net purchases and ending_inventory as that subtotal minus cost of goods sold, both rounded half-up to two decimal places, plus a formula string restating the identity. Pair the JSON with your own physical count or FIFO layers if you need a warehouse-level story; this endpoint returns the period identity, not a schedule of lots, not a unit cost, and not a currency conversion.

What does the ending inventory calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →