COGS calculator
Cost of goods sold from opening inventory, purchases and closing stock.
Fill in the fields and the result will appear here automatically.
This basic inventory-cost reconciliation adds purchases to opening inventory and subtracts closing inventory. Paying a supplier does not turn unsold stock into cost of goods sold. Use one consistent cost-valuation basis rather than retail prices. Write-offs, damage, returns or other movements can enter the difference without being sales, so reconcile those separately before treating the whole result as sales COGS.
How it works
Formula and logic
COGS = opening inventory + purchases − closing inventory. The intermediate figure, goods available for sale, is the sum of the first two: everything that could have been sold during the period. The formula assumes no additional unreconciled movements. Purchases represent received inventory cost with applicable allocations, not merely cash paid. Negative amounts and closing inventory exceeding available inventory are rejected.
Example
Opening stock 320,000, purchases 780,000, closing stock 415,000 — cost of goods sold is 685,000. Opening 100, purchases 50 and closing 150 give COGS 0 and available inventory 150.
Fields and units
- Opening inventory — $
- Purchases during the period — $
- Closing inventory — $
How to use
- — Enter the value of the stock the period started with.
- — Enter how much inventory was purchased during the period.
- — Enter the value of the stock left at the end of the period.
- — Use the same prices for all three figures — purchase prices, not retail.
- — Reconcile losses and other movements separately: the inventory difference cannot distinguish sales from write-offs. Amounts use one currency without conversion.
Method and limitations
- Calculation method
- Formula and logic
- Data or methodology source
- IFRS IAS 2: public overview of inventory costs and recognised losses IRS Publication 334, United States: opening, purchases and closing reconciliation; not local tax rules
- Limitation
- Basic reconciliation of inventory carrying cost. Does not replace valuation, separating write-offs or accounting and tax rules.
FAQ
Why is closing stock subtracted rather than added?
Closing inventory remains outside the cost removed during the period. With consistent valuation and no other movements, the difference relates to goods sold; losses and write-offs need to be separated first.
Do inbound freight costs count as purchases?
Yes, when they increase the value of the goods on the shelf. Outbound delivery to the customer is a selling expense and does not belong in this formula.
What if the stock was never counted?
Without a closing figure the calculation only gives goods available for sale. Estimating the closing stock from bookkeeping records is acceptable, but any error in it passes straight into COGS — it is subtracted one for one.
Why is COGS higher than my purchases?
The warehouse shrank during the period: you sold not only what you bought but also what was carried over. That is a normal situation, not an input error.