cogs calculation

COGS Calculator

Estimate Cost of Goods Sold using the merchandising formula and optionally calculate gross profit.

Formula: COGS = Beginning Inventory + Purchases + Freight-In − Purchase Returns − Purchase Discounts − Ending Inventory
Inventory value at the start of the period.
Total inventory purchases during the period.
Shipping costs to bring goods into inventory.
Amounts deducted for returned/defective purchases.
Supplier discounts taken on purchases.
Inventory remaining at the end of the period.
Include this to calculate gross profit and gross margin.
Enter values and click Calculate COGS.

Cost of Goods Sold (COGS) is one of the most important numbers in business finance. If you sell products, your COGS tells you what it cost to acquire or produce the items you actually sold during a period. When this figure is accurate, profit analysis gets clearer, pricing decisions improve, and tax reporting is more reliable.

What is COGS?

COGS represents the direct costs tied to goods sold. For retailers and wholesalers, that usually means inventory purchases (plus freight-in and adjustments). For manufacturers, COGS can include direct materials, direct labor, and manufacturing overhead assigned to sold units.

COGS is reported on the income statement and deducted from net sales to calculate gross profit:

  • Gross Profit = Net Sales − COGS
  • Gross Margin = Gross Profit ÷ Net Sales

Core COGS formula (merchandising business)

This calculator uses the common merchandising approach:

  • Start with Beginning Inventory
  • Add Purchases and Freight-In
  • Subtract Purchase Returns and Purchase Discounts
  • Subtract Ending Inventory

That gives you the cost of inventory that left stock and was sold during the period.

Why ending inventory matters so much

Ending inventory is often the largest estimate in COGS calculation. If ending inventory is overstated, COGS will be understated and profit will look inflated. If ending inventory is understated, COGS will be overstated and profit will appear weaker than reality.

How to use the calculator

  1. Enter required values: beginning inventory, purchases, and ending inventory.
  2. Add optional adjustments: freight-in, returns, discounts.
  3. Optionally enter net sales to compute gross profit and gross margin.
  4. Click Calculate COGS to get a full breakdown.

For monthly reporting, use monthly numbers. For quarterly or annual reporting, use the matching period totals. Keep periods consistent across all inputs.

Worked example

Assume the following for a quarter:

  • Beginning inventory: $20,000
  • Purchases: $60,000
  • Freight-in: $2,000
  • Purchase returns: $1,000
  • Purchase discounts: $500
  • Ending inventory: $25,000

Calculation:

  • Goods available for sale = 20,000 + 60,000 + 2,000 − 1,000 − 500 = 80,500
  • COGS = 80,500 − 25,000 = 55,500

If net sales were $95,000, then gross profit would be $39,500 and gross margin would be 41.58%.

COGS vs. operating expenses

Businesses often confuse COGS with operating expenses. A quick rule:

  • COGS: direct costs of goods sold (inventory-related).
  • Operating expenses: costs to run the business (rent, admin salaries, software, marketing, utilities).

Separating these correctly gives cleaner gross margin analysis and more useful management reporting.

Common COGS mistakes to avoid

  • Mixing different reporting periods (monthly purchases with quarterly ending inventory).
  • Forgetting freight-in, which can materially affect margins.
  • Not recording purchase returns and discounts consistently.
  • Using inaccurate inventory counts at period end.
  • Classifying non-inventory expenses (like office supplies) as COGS.

How to improve COGS over time

1) Negotiate smarter purchasing terms

Supplier discounts, bulk pricing, and lower inbound freight can reduce unit cost significantly, especially at scale.

2) Reduce shrinkage and write-offs

Better inventory controls, cycle counts, and handling practices can prevent unnecessary loss that eventually increases effective COGS.

3) Optimize product mix

When you understand COGS at the product level, you can prioritize items with stronger contribution margins and reprice low-margin products.

4) Tighten forecasting

Over-ordering ties up cash and risks markdowns, while under-ordering can miss sales. Better forecasts improve both turnover and gross profit.

Final takeaway

COGS is not just an accounting figure; it is a management signal. Accurate COGS helps you set prices confidently, understand gross margin, and make better strategic decisions. Use the calculator above each reporting period, then compare trends month-over-month or quarter-over-quarter to spot where purchasing, inventory, or sales execution can improve.

🔗 Related Calculators