COGS Calculator

Calculate cost of goods sold, gross profit, gross margin, inventory turnover, and days inventory outstanding from beginning inventory, purchases, ending inventory, and revenue.

Last updatedHow we build & check our tools

The Number That Decides Whether You Have a Business or a Hobby

A shop owner sells $200,000 of product in a year and feels successful. Money is moving. Then their accountant asks a simple question they can't answer: what did that product cost you to acquire? Without that number, the $200,000 in sales is meaningless, because it might have cost $80,000 or $180,000 to produce, and those are two completely different businesses.

That cost is Cost of Goods Sold, or COGS, and it's the most important number on the income statement after revenue. It captures the direct cost of the products you actually sold during the period: the inventory, the raw materials, the direct labor that went into them. It does not include rent, marketing, or your salary; those are operating expenses that come later.

The inventory formula is clean and only needs three numbers:

COGS = Beginning Inventory + Purchases − Ending Inventory

Say you started the year with $30,000 of inventory, bought $120,000 more during the year, and finished with $40,000 still on the shelf. Your COGS is 30,000 +120,000 − $40,000 = $110,000. That's what the goods you actually sold cost you.

Now the numbers come alive. With $200,000 in revenue and $110,000 in COGS:

  • Gross profit: $200,000 − $110,000 = $90,000.
  • Gross margin: $90,000 ÷ $200,000 = 45 percent.

That 45 percent is the heartbeat of the business. It tells you how much of every sales dollar is left to cover rent, payroll, marketing, and profit. A retailer might run 30 to 50 percent, a software company 70 percent or higher, a grocery store under 30 percent. Knowing yours tells you whether you can afford to hire, discount, or expand, or whether you're one slow month from trouble.

COGS also drives your tax bill. It's a deductible cost, so a higher COGS lowers your taxable income, which is exactly why the IRS cares how you value inventory. This calculator runs the inventory formula and instantly shows your gross profit and margin, turning a pile of sales into the one number that says whether the business actually works.

How to Calculate COGS and Read Your Margin

The inventory method works for any business that buys or makes physical products. You need three figures from your records: the value of inventory you started the period with, everything you purchased or produced during the period, and the inventory left unsold at the end. Subtract ending inventory from the sum of the first two, and you have COGS.

Be precise about what counts as a direct cost. COGS includes the cost of the merchandise itself, raw materials, freight to get inventory to you, and direct labor for manufacturers. It excludes indirect costs: rent, utilities, office salaries, marketing, and shipping to customers. Mixing operating expenses into COGS understates your gross margin and distorts the picture. When in doubt, ask whether the cost would disappear if you sold nothing. Direct product costs would; rent would not.

Your inventory valuation method changes the number. Whether you use FIFO (first-in, first-out), LIFO (last-in, first-out), or weighted average affects your ending inventory value and therefore your COGS, especially when prices are rising. FIFO generally produces a lower COGS and higher profit in an inflationary period; LIFO does the opposite. Pick a method, apply it consistently, and know that the IRS expects consistency from year to year.

Turn COGS into the metrics that guide decisions. Gross profit is revenue minus COGS. Gross margin is gross profit divided by revenue, expressed as a percentage. Margin is more useful than the raw dollar figure because it lets you compare periods and benchmark against your industry. If your margin slips from 45 percent to 38 percent, something changed: suppliers raised prices, you discounted too aggressively, or theft and waste crept in. The percentage catches problems the revenue number hides.

Use margin to make real choices. A 45 percent gross margin tells you that a 20 percent across-the-board discount would erase nearly half your gross profit. It tells you how much room you have to absorb a supplier price increase before you have to raise prices. It tells you whether you can afford a new hire. The margin isn't an accounting curiosity; it's the constraint every other decision lives inside.

This calculator provides estimates based on the information you enter. For advice tailored to your situation, consult a qualified financial professional.

Frequently Asked Questions

Common questions about the COGS Calculator

Use the inventory formula: beginning inventory plus purchases minus ending inventory. If you start with $30,000 of inventory, buy $120,000 during the period, and end with $40,000 unsold, your COGS is $110,000. That figure represents the direct cost of the goods you actually sold. It excludes rent, marketing, and other operating expenses, which are accounted for separately below gross profit on the income statement.

Sources & References

Business and investing fundamentals

Definitions of common business finance, valuation, and investing terms.