Skip to content
Popular Calculators
Browse Business calculators

COGS Calculator

Cost of goods sold from beginning inventory, purchases, direct costs and ending inventory, with gross margin and inventory turnover.

Value of stock at the start of the period.

Stock bought during the period, net of returns to suppliers.

Optional. Inbound freight, direct labour and other costs of getting goods ready to sell.

Value of stock counted at the end of the period.

Optional. Net sales for the period, to see gross profit.

About the COGS Calculator

Cost of goods sold — COGS — is the direct cost of the products a business sold during a period. It is the biggest single cost for most retailers, wholesalers and manufacturers, and it drives gross profit, gross margin and ultimately tax. But it is rarely recorded directly. Instead, it is worked out from what was in stock at the start, what was bought, and what is left at the end.

This COGS calculator uses that standard method. From beginning inventory, purchases, any other direct costs and ending inventory, it gives the cost of goods sold and the goods available for sale. Add your revenue and it also shows gross profit and gross margin, and it works out inventory turnover from the average stock held.

How to Use the COGS Calculator

Enter beginning inventory: the value of stock at the start of the period. It is the same as the ending inventory of the previous period.

Enter purchases: stock bought during the period, less any returns to suppliers and discounts received.

Enter other direct costs, such as inbound freight, import duty and direct labour for manufacturers.

Enter ending inventory: the value of stock counted at the end of the period.

Optionally, enter revenue for the same period.

How Cost of Goods Sold Is Calculated

  goods available  =  beginning inventory + purchases + other direct costs
  COGS             =  goods available − ending inventory
  gross profit     =  revenue − COGS
  turnover         =  COGS ÷ average inventory
  average stock    =  (beginning + ending inventory) ÷ 2

Step-by-Step Example

Beginning inventory 40,000, purchases 120,000, freight 5,000, ending inventory 35,000 and revenue of 200,000.

  Goods available:  40,000 + 120,000 + 5,000   =  165,000
  COGS:             165,000 − 35,000           =  130,000
  Gross profit:     200,000 − 130,000          =  70,000   (35%)
  Average stock:    (40,000 + 35,000) ÷ 2      =  37,500
  Turnover:         130,000 ÷ 37,500           =  3.47 times

What Belongs in COGS

IncludeLeave out
Stock bought for resaleRent and utilities for the shop or office
Raw materials and componentsSales and admin salaries
Direct labour in productionMarketing and advertising
Inbound freight and import dutyOutbound delivery to customers (usually)
Factory overheads (manufacturers)Interest and tax

Service businesses usually talk about "cost of sales" instead: the direct costs of delivering the service, such as subcontractors and billable staff.

Why the Stock Count Matters

Because COGS is what is left after subtracting ending inventory, any error in the stock count flows straight through to profit, one for one. Count 1,000 of stock that is not really there and COGS falls by 1,000, while gross profit and taxable profit rise by 1,000.

The error then reverses next period, because this period's ending inventory is next period's beginning inventory. Two wrong years can look right together, but each year on its own is misstated. Careful counts, and writing off damaged or obsolete stock, keep the figures honest.

Valuation Methods

When purchase prices change during the period, the value placed on ending inventory depends on the method used:

FIFO (first in, first out) assumes the oldest stock is sold first, so ending inventory is valued at the latest prices.

Weighted average values all units at the average cost of what was available.

LIFO (last in, first out) assumes the newest stock is sold first. It is allowed in some countries, such as the US, but not under international standards.

The formula here works with whichever values your chosen method produces. Use the same method consistently from year to year.

COGS for Manufacturers

A business that makes its own products has more to include in cost of goods sold than a shop that buys finished stock. As well as raw materials, the cost of production usually includes the wages of the people who make the product and a share of factory overheads such as power for the machines, factory rent and equipment depreciation.

Manufacturers also carry three kinds of inventory: raw materials, work in progress and finished goods. The same principle applies to each — opening stock, plus what was added, less closing stock — and the finished goods figure feeds into cost of goods sold. The "other direct costs" field is the place to add production labour and overheads when using this calculator for a simple manufacturing business.

Using COGS to Spot Problems

Comparing cost of goods sold with sales over several periods can reveal problems early.

Rising COGS ratio. If COGS grows faster than sales, margins are being squeezed by supplier prices, discounting or waste.

Unexpected jumps. A sudden rise in COGS without a matching rise in sales can point to stock losses, theft or an error in the stock count.

Slowing turnover. If inventory turnover falls, stock is building up faster than it sells, tying up cash and increasing the risk of items becoming obsolete.

Understanding Your Result

Cost of goods sold is the direct cost of what was sold in the period.

Goods available for sale is everything you could have sold.

Share sold is COGS as a share of the goods available.

Gross profit shows the profit and margin if you entered revenue.

Inventory turnover is how many times average stock was sold and replaced.

Worth knowing explains how a stock count error affects profit.

When Should You Use This Calculator?

Preparing year-end or monthly accounts.

Working out gross profit when you have not recorded COGS directly.

Checking stock levels against sales.

Estimating tax on trading profits.

Comparing turnover between periods or product lines.

Common Mistakes

Using the wrong opening figure. Beginning inventory must equal last period's ending inventory.

Leaving out freight and duty on goods bought in.

Including overheads that belong in operating expenses.

Skipping the stock count and guessing ending inventory.

Forgetting returns to suppliers, which reduce purchases.

Frequently Asked Questions

How do I calculate cost of goods sold?

Add beginning inventory, purchases and other direct costs to get the goods available for sale, then subtract ending inventory. 40,000 + 120,000 + 5,000 − 35,000 gives a cost of goods sold of 130,000.

Why subtract ending inventory?

Everything that was available during the period was either sold or is still on the shelf. Whatever is still in stock at the end has not been sold, so taking it away leaves the cost of what was sold.

What goes into cost of goods sold?

The cost of the stock itself plus the direct costs of getting it ready to sell, such as inbound freight, import duty and, for manufacturers, raw materials and direct labour. Selling, marketing and office costs are operating expenses instead.

How does a stock count error affect profit?

One for one. If ending inventory is overstated by 1,000, cost of goods sold is understated by 1,000 and gross profit is overstated by the same amount. That is why accurate stock counts at the end of each period matter so much.

What is inventory turnover?

Cost of goods sold divided by average inventory, showing how many times stock was sold and replaced in the period. In the example, 130,000 ÷ 37,500 is 3.47. Higher turnover generally means less money tied up in stock.

Is COGS the same under FIFO and LIFO?

No. When prices change, the method used to value stock changes both ending inventory and cost of goods sold. FIFO assumes the oldest stock is sold first; LIFO, where permitted, assumes the newest is. The formula here works with whichever values your method produces.

Last reviewed September 28, 2026 by the CalculatorPeak editorial team.