COGS (Cost of Goods Sold) Calculator

Quickly see how your beginning inventory, purchases, and ending inventory translate into COGS and gross margin potential. Switch between basic, detailed, and manufacturing methods to align the calculation with how your business actually creates value.

By CalcMastery Editorial Team

Cost of Goods Sold (COGS) Calculator

Compute COGS using Basic, Detailed (with freight and purchase adjustments), or Manufacturing methods. Optionally enter revenue to see gross profit and gross margin.

BasicDetailedManufacturing
$

Inventory value at the start of the period.

$

Cost of goods purchased for resale or production during the period.

$

Inbound shipping costs that are part of acquiring inventory.

$

Reductions in purchase cost due to returns or supplier allowances.

$

Cash or early‑payment discounts reducing the cost of purchases.

$

Inventory value at the end of the period.

$

Finished goods on hand at the start of the period.

$

Total manufacturing cost for goods completed during the period.

$

Finished goods remaining at the end of the period.

$

If provided, gross profit and gross margin are computed.

Scenarios
Examples: Retail (Basic) / Retail with Adjustments / Manufacturing / Clearance Season
Retail (Basic)Retail with AdjustmentsManufacturingClearance Season

Results

  • COGS$
  • Gross Profit$
  • Gross Margin %
  • Method Used

Enter your inputs above to calculate the results.

What is COGS (Cost of Goods Sold)?

Cost of Goods Sold (COGS) is the total direct cost of the products you actually sold during a period — materials, direct labor, and production-related overhead tied to those units.

On the income statement, COGS sits right under revenue and directly drives gross profit and gross margin, making it a core lever for pricing, unit economics, and value creation.

Lower, well-controlled COGS (for the same revenue) means stronger gross profit, more cash for growth, and a healthier return on invested capital.

Formula

At a high level, COGS is computed as the cost of goods available for sale minus what’s left in ending inventory:

General COGS formula (with direct costs):

COGS = Beginning Inventory + Purchases + Direct Production Costs-Ending Inventory

Retail / merchandising (basic method):

COGS = Beginning Inventory + Purchases-Ending Inventory

Manufacturing method (finished goods focus):

COGS = Beginning Finished Goods Inventory + Cost of Goods Manufactured (COGM)-Ending Finished Goods Inventory

Here, COGM bundles all direct materials, direct labor, and factory overhead for goods completed in the period.

How to Use the COGS (Cost of Goods Sold) Calculator

This calculator lets you compute cost of goods sold using three common approaches—basic, detailed, and manufacturing—based on the inputs you already track in your accounting system.

Choose the appropriate method tab

  • Select Basic, Detailed, or Manufacturing at the top, depending on whether you’re a reseller/retailer or a manufacturer and how granular your records are.

Enter the required inventory and cost data

  • In the chosen tab, fill in the beginning and ending inventory (or beginning/ending finished goods), purchases, COGM, and any optional fields such as freight-in, returns, and discounts exactly as they appear in your accounts.

Let the calculator compute COGS using the correct formula

    • As you type, the Results panel updates using these formulas:
beginalignedCOGSBasic & = Beginning Inventory + Purchases − Ending Inventory COGSDetailed & = Beginning Inventory + Purchases + Freight-in -Returns / Allowances − Discounts − Ending Inventory COGSManufacturing & = Beginning Finished Goods + COGM- Ending Finished Goodsendaligned

Review the Results and method label

  • Check the COGS value and the Method Used line in the Results box to confirm which approach was applied and whether the output matches your expectations.

Test scenarios, revenue impact, and reset

  • Optionally enter Revenue to compare COGS against sales, switch between methods to see how different assumptions change COGS, and use Reset when you want to clear the fields and start a new scenario.

Frequently Asked Questions

Which COGS method should I use: Basic, Detailed, or Manufacturing?

Use Basic if you only track beginning inventory, purchases, and ending inventory. Use Detailed if you also track freight-in, purchase returns/allowances, and purchase discounts. Use Manufacturing when you produce goods and have a Cost of Goods Manufactured (COGM) schedule and finished goods inventories.

How does the calculator treat freight-in, returns, and discounts in the Detailed method?

Freight-in is added to the cost of purchases because it increases the cost of getting inventory ready for sale. Purchase returns/allowances and purchase discounts are subtracted because they reduce your net inventory cost. The calculator applies these automatically once you enter the amounts.

How will changing ending inventory affect my COGS and profit in this calculator?

A higher ending inventory lowers COGS and increases gross profit, because more cost is left on the balance sheet instead of expensed. A lower ending inventory raises COGS and reduces gross profit. You can quickly test scenarios by adjusting the ending inventory fields in each method.

Sources & Methodology