Anyday CalculatorAnydayCalculator

COGS Calculator

Cost of goods sold (COGS) is the direct cost of the products a business actually sold during a period — the inventory that left the shelves. It is the single largest expense for most product businesses and the figure you subtract from revenue to reach gross profit. This calculator derives COGS from three inventory numbers, in any currency.

USD
USD
USD
Cost of goods sold
$55,000.00
  • Cost of goods sold
  • Ending inventory
Beginning inventory
$20,000.00
Purchases
$50,000.00
Ending inventory
$15,000.00
COGS
$55,000.00

You had 70000 of goods available to sell and 15000 left on the shelf, so 55000 worth flowed out as cost of goods sold. Subtract this from revenue to get your gross profit.

How it works

You start a period holding some inventory (beginning inventory), you buy more during the period (purchases), and you finish holding whatever did not sell (ending inventory). Add the first two together and you have the cost of all goods that were available to sell. Subtract what is still sitting in the warehouse at the end, and what remains is the cost of the goods that walked out the door — your COGS.

This matters because COGS sits directly below revenue on the income statement. Revenue minus COGS is gross profit, and gross profit divided by revenue is your gross margin — the headline measure of how profitable your core product is before overhead. Get COGS wrong and every profitability number downstream is wrong too.

The accuracy of the result depends entirely on accurate inventory counts and on the costing method (FIFO, LIFO, or weighted average) you use to value those counts. The arithmetic here is currency-agnostic, so you can switch the currency at the top and the relationship between the three inputs holds exactly.

Formula

COGS = Beginning inventory + Purchases − Ending inventory. Beginning inventory plus purchases is the cost of goods available for sale; whatever is not still in stock at period end was sold.

Worked example

Imagine you start the quarter with 20,000 of inventory, buy another 50,000 in stock, and finish with 15,000 still unsold. Goods available for sale were 20,000 + 50,000 = 70,000. Subtract the 15,000 ending inventory and your COGS is 55,000. If revenue for the quarter was 90,000, gross profit is 90,000 − 55,000 = 35,000, a gross margin of about 39%.

Things to watch out for

COGS includes only direct costs — the purchase or production cost of the goods themselves, plus directly attributable freight-in. It excludes overhead, marketing, and distribution, which belong to operating expenses. The figure also depends on your inventory valuation method: in a period of rising prices, FIFO reports lower COGS (and higher profit) than LIFO. If ending inventory exceeds the goods available for sale, the formula returns a negative number, which signals a counting or data-entry error rather than a real result.

Frequently asked questions

What is included in COGS?+

The direct cost of the goods you sold: raw materials, purchased stock, direct labor for production, and freight-in. It excludes overhead, marketing, sales commissions, and shipping to customers, which are operating expenses.

How does COGS relate to gross profit?+

Gross profit = Revenue − COGS. Dividing gross profit by revenue gives your gross margin, the core measure of product profitability. A lower COGS lifts both figures directly.

Why does my inventory valuation method change COGS?+

FIFO, LIFO, and weighted-average assign different costs to the units sold. When prices are rising, FIFO charges the older, cheaper costs to COGS (raising profit), while LIFO charges the newer, higher costs (lowering profit).

Can a service business have COGS?+

Service firms usually report "cost of services" or "cost of revenue" instead — the direct labor and materials consumed in delivering the service. The inventory-based formula here is aimed at businesses that hold stock.

Related calculators

Disclaimer: This calculator is for educational and informational purposes only and provides estimates, not financial advice. Interest rates, taxes, fees, and local rules vary and change over time. Confirm figures with a qualified professional before making any financial decision.

Last reviewed: 2026-06-22

We use cookies for analytics and to show relevant ads, which keep our calculators free. You can accept or decline non-essential cookies. Learn more.