Cogs Calculator - Inventory Cost Rollforward

Use this cogs calculator to combine beginning inventory, purchases, direct costs, withdrawals, ending stock, and revenue into COGS and gross profit.

Updated: June 6, 2026 • Free Tool

Cogs Calculator

$

Inventory value on hand at the start of the period.

$

Inventory value still on hand at the end of the period.

$

Inventory purchases before personal-use or nonbusiness withdrawals.

$

Items removed from purchases for personal use, gifts, or other nonbusiness use.

$

Labor directly tied to producing or preparing the goods sold.

$

Product materials, production supplies, and similar direct inputs.

$

Freight-in, production overhead, and other costs directly tied to inventory.

$

Sales or net receipts for the same period; used for gross profit and margin.

Results

Cost of Goods Sold
$0
Goods Available for Sale $0
Net Purchases $0
Gross Profit $0
Gross Margin 0%
COGS Ratio 0%

What Is Cogs Calculator?

A cogs calculator turns inventory and direct product-cost records into cost of goods sold for one accounting period. Use it when you prepare a monthly close, review Schedule C inputs, estimate gross profit, compare product lines, or check whether ending inventory agrees with purchases and production costs.

  • Monthly close: Combine beginning inventory, net purchases, production costs, and ending inventory before posting gross profit.
  • Reseller bookkeeping: Separate purchases still sitting in inventory from the cost of items actually sold.
  • Manufacturing review: Add direct labor, materials, freight-in, and production overhead to the inventory rollforward.
  • Pricing check: Compare COGS with revenue so gross profit and gross margin are visible before operating expenses.

COGS is not the same as total expenses. It focuses on product costs that move through inventory and become an expense when the goods are sold. Rent for a retail office, advertising, loan interest, and general administrative payroll usually belong elsewhere in the income statement unless they are directly tied to production or inventory handling.

Use the result as a bookkeeping check, not as a substitute for your accounting method. The calculator uses a periodic rollforward: it does not choose FIFO, weighted average, specific identification, tax elections, or inventory write-down rules for you.

If your business changes accounting systems, supplier records, or count procedures midyear, keep a note with the period. A clean note explains why beginning inventory, purchases, or ending inventory moved and helps you avoid treating a recordkeeping change as a real margin change.

After COGS is clean, use the profit calculator to move from gross profit into operating profit, net profit, and broader expense review.

How Cogs Calculator Works

The calculation starts with goods available for sale, then removes ending inventory that remains unsold at period end.

COGS = beginning inventory + purchases - withdrawals + direct labor + materials and supplies + other direct costs - ending inventory
  • Beginning inventory: The cost assigned to inventory on hand at the start of the period.
  • Purchases: Inventory bought during the period before subtracting withdrawals or personal-use items.
  • Direct labor: Production labor that is directly necessary to make or prepare goods for sale.
  • Materials and supplies: Product materials and production supplies used in goods that move through inventory.
  • Other direct costs: Freight-in, production overhead, or similar costs directly attributable to inventory.
  • Ending inventory: The cost assigned to unsold inventory still on hand at period end.

Ending inventory lowers COGS because those unsold goods have not yet become the cost attached to revenue. If ending inventory is overstated, COGS is understated and gross profit looks higher. If ending inventory is understated, COGS is overstated and gross profit looks lower.

The revenue field is optional for the COGS result, but it makes the output easier to review. Gross profit equals revenue minus COGS, gross margin equals gross profit divided by revenue, and the COGS ratio equals COGS divided by revenue.

Retail year-end example

Beginning inventory is $37,845, purchases are $285,900, withdrawals are $2,650, ending inventory is $32,955, and net receipts are $385,060.

Net purchases are $283,250. Goods available for sale are $321,095. COGS equals $321,095 - $32,955 = $288,140.

Cost of goods sold is $288,140 and gross profit is $96,920.

About 74.83% of revenue was consumed by product cost, leaving a 25.17% gross margin before operating expenses.

According to IRS Publication 334, cost of goods sold is the remainder after subtracting closing inventory from the cost of goods available for sale.

If you need revenue minus explicit business costs beyond inventory, the accounting profit calculator extends the same records into an accounting-profit view.

Key Concepts Explained

The same COGS number can mean different things depending on inventory method, production process, and reporting purpose.

Goods available for sale

This is the pool of inventory cost that could be assigned either to sold goods or to ending inventory. It includes beginning inventory, net purchases, and direct production costs.

Net purchases

Purchases should be reduced for items withdrawn for personal use or other nonbusiness use. Keeping this adjustment separate makes the rollforward easier to audit.

Gross profit

Gross profit is revenue minus COGS. It shows how much revenue remains after product costs, before operating expenses, interest, income taxes, and owner distributions.

Inventory method

FIFO, weighted average, specific identification, and tax inventory methods can assign different costs to ending inventory. This calculator uses your entered inventory values rather than selecting a method.

For a reseller, COGS may be mostly purchase cost plus freight-in. For a manufacturer, it may include direct labor, raw materials, production supplies, and factory overhead. Service businesses often have no inventory-based COGS, although they may track direct service costs separately.

The calculator is most useful when your inputs come from consistent records: the prior period ending inventory, purchase ledger, production-cost detail, and a physical or system inventory count.

Retail teams that compare gross margin with inventory investment can pair this result with the GMROI calculator.

How to Use This Calculator

Use one accounting period at a time so inventory, purchases, costs, and revenue line up.

  1. 1 Enter beginning inventory: Use the inventory value at the start of the month, quarter, or year. It should usually match the previous period's ending inventory.
  2. 2 Enter purchases and withdrawals: Add inventory purchases, then remove items taken out for personal use, gifts, samples, or nonbusiness use.
  3. 3 Add direct production costs: Include direct labor, product materials, supplies, freight-in, and other costs that belong in inventory or production.
  4. 4 Enter ending inventory: Use the cost assigned to unsold inventory on hand at the end of the same period.
  5. 5 Add revenue when needed: Revenue is not needed to calculate COGS, but it is needed for gross profit, gross margin, and COGS ratio.
  6. 6 Review the warning signs: If ending inventory exceeds goods available for sale or withdrawals exceed purchases, fix the records before relying on the result.

A shop that starts May with $18,000 in inventory, buys $42,000, withdraws $500 for samples, adds $3,000 of freight-in, and ends with $16,500 in stock has COGS of $46,000. If May revenue is $80,000, gross profit is $34,000 and gross margin is 42.5%.

When you already know COGS and revenue and only need the margin percentage, the gross margin calculator gives a focused shortcut.

Benefits of Using This Calculator

A clean COGS rollforward helps you catch recordkeeping errors before they distort profit.

  • Checks margin pressure: Compare COGS with revenue to see whether supplier increases, freight-in, or production costs are absorbing more sales.
  • Separates product cost from overhead: COGS belongs before gross profit, while rent, marketing, and most administrative costs are usually reviewed later.
  • Supports inventory review: Ending inventory that does not reconcile with purchases and sales becomes visible before financial statements are closed.
  • Improves pricing conversations: The gross margin output gives a starting point for price changes, discount limits, and product mix decisions.
  • Creates a tax-workpaper check: Small businesses can compare the rollforward with the cost-of-goods-sold lines used in common U.S. tax worksheets.

COGS is also useful for scenario planning. You can test how a new supplier price, freight charge, or inventory count adjustment changes gross profit before you change selling prices or purchasing plans.

For businesses with seasonal inventory, run the calculator for comparable periods. A December result may look different from a slow month because the business intentionally builds or draws down stock.

Use the cogs calculator output as the first checkpoint, then review supplier invoices, freight terms, production waste, and stock counts before assuming the sales team has a pricing problem.

Once unit cost and gross margin are stable, the break-even calculator can translate those economics into required sales volume.

Factors That Affect Your Results

The formula is simple, but the quality of the result depends on how inventory costs are measured.

Inventory valuation

FIFO, weighted average, specific identification, and tax methods can assign different costs to the same physical units.

Freight-in and production overhead

Costs directly attributable to acquiring or producing inventory may belong in COGS rather than general expenses.

Physical counts

Shrinkage, damage, obsolete stock, and count errors change ending inventory and therefore change COGS.

Period matching

Revenue, purchases, production costs, and inventory counts should cover the same period for the margin outputs to be meaningful.

  • This calculator does not choose an inventory accounting method or determine whether a tax inventory exception applies to your business.
  • It does not estimate write-downs to net realizable value, abnormal waste, lower-of-cost-or-market adjustments, or cost-capitalization elections.
  • For tax filings, financial statements, loans, or investor reporting, reconcile the result to your accounting records and professional guidance.

Financial reporting rules also care about timing. COGS should be recognized in the same period as the related revenue, which is why an inventory value can sit on the balance sheet until the goods are sold.

If your business sells both goods and services, keep the inputs separate. Mixing inventory product costs with service labor or general operating expenses can make gross margin hard to compare across periods.

According to IFRS IAS 2 Inventories, when inventories are sold, their carrying amount is recognized as an expense in the period when the related revenue is recognized.

If inventory timing is the issue, the cash conversion cycle calculator connects COGS with inventory days, receivables, and payables.

cogs calculator showing inventory cost of goods sold and gross profit outputs
cogs calculator showing inventory cost of goods sold and gross profit outputs

Frequently Asked Questions

Q: How do you calculate COGS?

A: Calculate COGS by adding beginning inventory, net purchases, direct labor, materials, and other direct product costs, then subtracting ending inventory. The core idea is that unsold ending inventory remains on hand, while the remaining cost is assigned to goods sold.

Q: What costs should be included in COGS?

A: Include costs directly tied to acquiring or producing inventory, such as purchase cost, freight-in, direct labor, materials, production supplies, and direct production overhead. Do not mix in ordinary selling, marketing, financing, or administrative expenses unless your accounting method specifically treats them as product costs.

Q: Does COGS include labor?

A: COGS can include labor when the labor is directly tied to producing or preparing goods for sale. Factory labor is often relevant; owner draws, sales commissions, and general office payroll usually belong outside COGS. The correct treatment depends on your records and accounting method.

Q: How does ending inventory affect cost of goods sold?

A: Ending inventory is subtracted from goods available for sale. A higher ending inventory lowers COGS because more cost remains attached to unsold goods. A lower ending inventory raises COGS because more of the available inventory cost is treated as sold.

Q: Can COGS be higher than revenue?

A: Yes. COGS can exceed revenue when products are sold below cost, inventory costs rise sharply, write-offs are included, or revenue is incomplete for the period. The calculator will show a negative gross profit and a gross margin below zero when that happens.

Q: Is COGS the same as operating expenses?

A: No. COGS is the direct cost of goods sold, while operating expenses are costs of running the business, such as many rent, marketing, software, and administrative costs. Separating them helps gross profit show product economics before overhead.