foundercalc

COGS Calculator

Calculate Cost of Goods Sold (COGS) from beginning inventory, purchases, and ending inventory.

Reviewed for accuracy

Quick Answer

Calculate Cost of Goods Sold (COGS) from beginning inventory, purchases, and ending inventory.

COGS Calculator Live
Email

Educational estimates only.

What is COGS?

The COGS calculator above computes Cost of Goods Sold — the direct cost of the products a business actually sold during a period. The standard formula takes the inventory you started with, adds what you purchased, and subtracts what’s left at the end. Whatever inventory left the business as sales is your COGS. It is one of the most important figures on an income statement, because it sits directly between revenue and gross profit.

COGS matters because it is the foundation of gross margin, and gross margin determines what kind of business you can build. Get COGS wrong — by miscounting inventory or misclassifying costs — and every profitability number downstream is wrong too. For product businesses especially, accurate COGS is the difference between knowing your real economics and flying blind.

The formula

COGS = Beginning Inventory + Purchases − Ending Inventory
  • Beginning inventory — the value of inventory on hand at the start of the period.
  • Purchases — inventory bought or produced during the period.
  • Ending inventory — the value of inventory still on hand at the end.

The logic is simple: of all the goods available to sell (beginning inventory plus purchases), the portion that’s no longer on the shelf was sold — and its cost is your COGS.

Worked example

Beginning inventory $20,000, purchases $50,000, ending inventory $15,000:

COGS = $20,000 + $50,000 − $15,000 = $55,000

You had $70,000 of goods available to sell ($20,000 + $50,000), and $15,000 remained unsold, so $55,000 worth of inventory left as sales. That $55,000 is your cost of goods sold. If those goods generated $100,000 in revenue, your gross profit is $45,000 and your gross margin is 45%.

Notice how ending inventory affects the result: if you’d sold more and ended with only $5,000 of inventory, COGS would be $65,000 — higher COGS reflecting that more goods were sold. COGS and inventory move inversely for a given level of purchases.

What COGS includes — and what it doesn’t

The line between COGS and operating expenses is where most mistakes happen:

  • Included in COGS (direct costs of production): raw materials, direct labor that makes the product, manufacturing supplies, freight-in on materials, and factory overhead directly tied to production.
  • Excluded from COGS (operating expenses): marketing and advertising, sales commissions, distribution and shipping to customers, administrative salaries, rent for offices, and R&D.

Misclassifying operating expenses as COGS understates your gross margin and can distort decisions about pricing and product mix. The test is whether a cost is directly required to produce the goods — if not, it belongs below gross profit as an operating expense.

How to interpret and use it

COGS is the input to gross margin, so the two should always be read together. Rising COGS as a percentage of revenue compresses gross margin and signals one of a few problems: input costs are climbing, you’re discounting prices, or production has become less efficient. Falling COGS percentage means the opposite — improving product economics.

For service and software businesses, “COGS” is sometimes called “cost of revenue” and the inventory formula doesn’t apply directly. Instead, cost of revenue captures the direct cost of delivering the service: hosting, third-party APIs, payment processing, and support staff tied to delivery. The principle is identical — count only the costs directly required to deliver what you sold.

Accurate COGS also depends on your inventory valuation method (FIFO, LIFO, or weighted average), which affects how beginning and ending inventory are valued and therefore the COGS figure. Be consistent in the method you use so period-to-period comparisons remain meaningful.

Frequently asked questions

What is COGS? Cost of Goods Sold (COGS) is the direct cost of producing the goods a company sold during a period. The standard formula is beginning inventory plus purchases minus ending inventory — the cost of inventory that actually left the business as sales.

What does COGS include? COGS includes direct costs tied to production: raw materials, direct labor, and manufacturing costs. It excludes indirect costs like marketing, distribution, and administrative overhead, which are operating expenses rather than cost of goods.

Did this calculator help you?