Skip to content
OverCalculator
  1. Home
  2. Financial
  3. Cost of Goods Sold (COGS) Calculator
Financial

Cost of Goods Sold (COGS) Calculator

Calculate cost of goods sold from beginning inventory, purchases, and ending inventory, then connect COGS to gross profit and income-statement analysis.

By OverCalculator Editorial Team, Updated

Cost of goods sold
COGS for the period
$27,000.00
Goods available for sale
$35,000.00
Ending inventory deducted
$8,000.00
Gross profit
$13,000.00
Gross margin
32.5%

$10,000.00 beginning inventory + $25,000.00 purchases − $8,000.00 ending inventory = $27,000.00 COGS.

$
$
$
$

Results update as you type.

Cost of Goods Sold (COGS) Calculator

COGS is the first cost line that cuts into the top line. This calculator follows the standard inventory rollforward: start with beginning inventory, add purchases or production cost, subtract ending inventory, and the remaining cost is assigned to goods sold during the period. If you also enter sales revenue, the tool shows gross profit and gross margin so the inventory movement connects directly to the income statement.

Use it for a monthly close, a quick retailer margin check, a restaurant food-cost review, a manufacturing class exercise, or a small-business forecast. The result is deliberately narrow: it does not measure every expense, it does not calculate net income, and it does not decide whether the business is healthy by itself. It answers one important question: how much inventory cost left the balance sheet and became an expense because goods were sold?

How the calculator matches the income statement

An income statement starts with revenue, often called the top line. COGS comes next for companies that sell products or inventory-based services. Subtracting COGS from revenue gives gross profit. That subtotal is still before payroll for sales teams, advertising, rent, software, management salaries, interest, and taxes.

The next step is operating analysis. If you subtract operating expenses from gross profit, you reach operating income, which is the same operating-profit line used by the EBIT calculator when interest and tax are excluded. Divide operating income by revenue and you have the metric in the operating margin calculator. Continue below operating income by subtracting interest and taxes and the path ends at the net income calculator. COGS therefore does not stand alone; it is the bridge between sales volume and the first profit subtotal.

Formula

The calculator uses the inventory flow shown in the form and rejects negative COGS:

goods available for sale=beginning inventory+purchases\text{goods available for sale} = \text{beginning inventory} + \text{purchases}

COGS=beginning inventory+purchasesending inventory\text{COGS} = \text{beginning inventory} + \text{purchases} - \text{ending inventory}

When sales revenue is greater than zero, it also calculates:

gross profit=sales revenueCOGS\text{gross profit} = \text{sales revenue} - \text{COGS}

gross margin=gross profitsales revenue×100%\text{gross margin} = \frac{\text{gross profit}}{\text{sales revenue}} \times 100\%

The optional revenue input is not part of the COGS formula. It only allows the calculator to show how COGS affects gross profit and gross margin after the direct inventory cost is known.

Worked example matching the calculator

Suppose a shop enters beginning inventory of USD 10,000, purchases of USD 25,000, ending inventory of USD 8,000, and sales revenue of USD 40,000. The calculator first finds goods available for sale:

goods available for sale=USD 10,000+USD 25,000=USD 35,000\text{goods available for sale} = \text{USD }10{,}000 + \text{USD }25{,}000 = \text{USD }35{,}000

Then it subtracts ending inventory:

COGS=USD 35,000USD 8,000=USD 27,000\text{COGS} = \text{USD }35{,}000 - \text{USD }8{,}000 = \text{USD }27{,}000

Because revenue was entered, the tool also computes gross profit:

gross profit=USD 40,000USD 27,000=USD 13,000\text{gross profit} = \text{USD }40{,}000 - \text{USD }27{,}000 = \text{USD }13{,}000

Finally, it divides gross profit by revenue:

gross margin=USD 13,000USD 40,000×100%=32.5%\text{gross margin} = \frac{\text{USD }13{,}000}{\text{USD }40{,}000} \times 100\% = 32.5\%

Those numbers match the default form values exactly: the primary result is USD 27,000 of COGS, with USD 35,000 of goods available for sale, USD 8,000 of ending inventory deducted, USD 13,000 of gross profit, and a 32.5% gross margin.

Benchmarks and interpretation

COGS benchmarks vary widely by industry. A grocery store can operate with a high COGS percentage and thin margins because inventory turns quickly. A software company may report little or no traditional COGS for licenses, although cloud hosting, support, and implementation costs may still appear as cost of revenue. A manufacturer usually has a more complex COGS line because direct labor and factory overhead are capitalized into inventory before being expensed.

The practical benchmark is your own history plus peers with similar economics. Track COGS as a percentage of revenue by month, product line, location, or customer segment. A rising COGS percentage may point to supplier price increases, freight changes, shrinkage, spoilage, discounting, warranty replacements, or an unfavorable sales mix. A falling percentage may indicate better purchasing, price increases, production efficiency, or a shift toward higher-margin products. Always compare like with like: annual COGS divided by annual revenue is meaningful, but monthly COGS divided by quarterly revenue is not.

Tips for accurate COGS

Use cost, not selling price, for inventory. A unit that sells for USD 50 might cost USD 31; only the USD 31 belongs in COGS. Match the period carefully: beginning inventory should equal the prior period’s ending inventory unless there was a correction. Include freight-in, duties, direct labor, or manufacturing overhead only when your accounting policy treats those costs as inventory. Keep abnormal waste, selling costs, and administrative overhead out of COGS unless your accountant has classified them there.

The formula also depends on a reliable ending inventory count. If ending inventory is too low, COGS is overstated and profit is understated. If ending inventory is too high, COGS is understated and profit looks better than it is. Cycle counts, SKU-level reconciliations, and consistent valuation methods such as FIFO, weighted average, or specific identification help prevent misleading results.

Sources

Frequently asked questions

What does COGS include?
COGS includes inventory costs that are assigned to goods sold during the period. For a retailer, that usually means merchandise purchases plus freight-in and other costs needed to get inventory ready for sale. For a manufacturer, it can include direct materials, direct labor, and factory overhead that becomes part of inventory.
How is COGS different from operating expenses?
COGS sits directly below revenue and measures the cost of the products sold. Operating expenses come later and cover selling, general, administrative, software, rent, marketing, and management costs. Keeping the two separate makes gross profit meaningful before evaluating the broader operating cost structure.
Why can this calculator reject a COGS result?
The calculator marks the entry invalid when ending inventory is greater than beginning inventory plus purchases. That would create negative COGS, which is not normal for a standard inventory rollforward. Recheck the period, count, returns, write-downs, and whether purchases were entered as inventory cost instead of selling price.
Does COGS use cash paid or inventory cost?
COGS is an accrual accounting measure, not simply the cash paid to vendors this month. It assigns inventory cost to the goods actually sold in the same reporting period. Cash timing can differ because inventory may be bought earlier, sold later, or paid for under supplier credit terms.
How does COGS affect margins?
Higher COGS lowers gross profit and gross margin when revenue is unchanged. That can happen because supplier costs rise, discounting increases unit volume but changes product mix, waste grows, or inventory valuation changes. The margin should be compared with similar products and periods, not judged in isolation.
Where does COGS appear on the income statement?
COGS appears immediately after revenue. Revenue minus COGS equals gross profit, which is the first major subtotal on many income statements. Operating expenses are then subtracted from gross profit to reach operating income, followed by interest, taxes, and finally net income.

Related calculators

Cost of Goods Sold (COGS) Calculator updated at