• Free to use
  • No account needed

Free cost of goods sold (COGS) calculator

This COGS calculator gives cost of goods sold from beginning inventory, purchases and ending inventory, plus gross profit and gross margin.

Your result

USD. Inventory values use cost, not retail selling prices. Keep period and valuation policy consistent.

This reconciles valuations you enter. It does not calculate FIFO, LIFO or weighted-average inventory values.

Gross profit is revenue less COGS, before operating expenses, financing costs and tax.

Calculated in this browser. No signup required to copy or download.

Starting example. Replace these figures with your own.

$27,000.00Cost of goods sold for the entered period

Cost of goods sold for the entered period: $27,000.00

Use inventory and purchase costs, not selling prices. Beginning inventory, purchases and ending inventory must cover the same period.

Your numbers

Reconcile inventory at cost for one period, then optionally see gross profit on revenue from that period.

Use one reporting period for every input. The result uses that same period.

Updates as you type. Replace the example numbers with your own.

Use one reporting period for every input. The result uses that same period.

Opening inventory valuation, not its retail selling value.

Goods bought for sale, or materials and production costs, at the price you paid after trade discounts. Take off purchase returns and allowances and anything you took for personal use. Do not count direct costs twice.

Closing inventory using a consistent valuation policy.

Also show gross profit and marginRevenue for this period (USD): not entered

Optional. Revenue after returns, before sales tax. Leave blank for COGS only.

More options
Beginning inventory
$10,000.00
Purchases
$25,000.00
Goods available for sale
$35,000.00
Ending inventory
$8,000.00
Calculation

COGS = beginning inventory + purchases − ending inventory.

More options

Compare another scenario

Scenario B starts with a copy of your current Scenario A. Change one input to compare the result; edits in either scenario stay separate.

How to calculate COGS

COGS = beginning inventory + purchases − ending inventory

COGS as % of revenue = COGS ÷ revenue × 100

Gross margin = (revenue − COGS) ÷ revenue × 100

Worked examples

  • $10,000.00 + $25,000.00 − $8,000.00 = $27,000.00 COGS
  • $27,000.00 ÷ $45,000.00 = 60% of revenue
  • ($45,000.00 − $27,000.00) ÷ $45,000.00 = 40% gross margin

What counts as COGS

From IRS Publication 334, which sets out the cost of goods sold lines on Schedule C. A service business such as a carpenter or painter figures COGS only if it also sells or charges for materials.

Counts in COGS

  • Merchandise bought for sale, or the raw materials and parts for your product, at the price you paid after trade discounts
  • Freight-in: what you pay to ship those goods and materials to you
  • Containers and packaging that are part of the product
  • If you make the product: the direct and indirect labor, materials and supplies used to make it, and production overhead such as the workshop’s rent, power and insurance

Leave out of COGS

  • Purchase returns and allowances: take them off purchases
  • Goods you took for personal or family use
  • Anything you pay yourself
  • Selling and office labor, and packaging that is not part of the product: these are business expenses
  • Inventory you donate and deduct as a contribution

Source: IRS, Publication 334, How To Figure Cost of Goods Sold: Schedule C, lines 35 to 42, for US sole proprietors, for 2025 returns. Read October 18, 2026.

Reconcile the inventory cost of goods sold

Use inventory values at cost for a single accounting period. This roll-forward is a planning check; it does not choose an inventory valuation method or prepare a tax return.

  1. Start with inventory at cost

    Enter the value of beginning inventory for the period. Use your chosen consistent cost basis, not its expected retail selling value.

  2. Add purchases and subtract what remains

    Enter inventory purchases for the period and the ending inventory value. The difference is the modeled cost of goods sold; reconcile unusual results against your records.

  3. Compare with period revenue

    Optionally add revenue from the same period to see gross profit and gross margin after COGS. Compare a second scenario, then copy or download the reconciliation.

Use a consistent inventory basis

The arithmetic is simple; the values you classify as inventory determine what the result means.

  • A retail stock period

    What to change

    Beginning inventory of 5,000 plus 12,000 purchases less 4,000 ending inventory gives 13,000 COGS.

    Before you use it

    All three inventory values use cost and the same currency.

  • Check gross profit

    What to change

    If that period has 20,000 revenue and 13,000 COGS, gross profit is 7,000 and gross margin is 35%.

    Before you use it

    Gross profit still has to cover operating expenses, financing and any other costs outside the entered COGS.

  • Investigate a mismatch

    What to change

    Ending inventory above beginning inventory plus purchases cannot produce ordinary nonnegative COGS in this simplified model.

    Before you use it

    Review adjustments, omitted purchases, production costs and inventory valuation before changing a figure to force agreement.

Reconcile the inventory and revenue period

  • Beginning and ending inventory refer to the boundaries of the same period.
  • Inventory is valued at cost rather than selling price.
  • Purchases and required cost adjustments use a consistent accounting basis.
  • Optional revenue belongs to the same period.
  • Gross profit is not net profit or a tax calculation.

Find the goods available at cost

Beginning inventory + inventory purchases gives the cost pool available in the simplified roll-forward. Include relevant inventory costs in your entered basis rather than adding sales or retail markups.

Remove the cost still on hand

COGS = beginning inventory + purchases − ending inventory. Goods remaining at the period end are kept in ending inventory rather than automatically expensed as if sold.

Compare COGS with sales

Gross profit = revenue − COGS, and gross margin = gross profit ÷ revenue × 100. At zero revenue the dollar difference can be shown, but gross margin has no defined denominator.

Sources checked on October 9, 2026: IRS Publication 334: figuring cost of goods sold

Questions about this tool

What is the COGS formula?

For this simplified inventory roll-forward, cost of goods sold equals beginning inventory plus inventory purchases minus ending inventory. Use cost values from the same period and currency.

Should inventory be entered at cost or selling price?

Use the cost basis in your inventory records. Selling price includes an intended markup and does not represent the cost of goods held or sold. Mixing the two bases distorts both COGS and gross profit.

Are purchases the same as cost of goods sold?

No. Some goods purchased during the period may still be on hand at its end. Ending inventory removes that remaining cost from the simplified goods-sold calculation.

Does this support manufacturing and inventory adjustments?

The tool uses three entered inventory totals. Manufacturing, freight, returns, write-downs and other adjustments must already be reflected correctly in your chosen cost basis. It does not maintain an inventory ledger or choose which costs your accounting requires.

What is the difference between gross profit and net profit?

Gross profit subtracts COGS from revenue. Net profit also depends on the other business expenses and applicable accounting treatment. The optional revenue comparison does not add operating costs, financing costs or tax.

Why is a negative COGS result a problem?

It means ending inventory exceeds beginning inventory plus entered purchases in this simplified model. That calls for reconciliation of the records or missing adjustments; it should not be presented as a normal negative inventory expense.

Does the calculator choose FIFO, LIFO or weighted average?

No. Use consistent values produced by the method appropriate to your records. The calculator checks the roll-forward and optional gross-profit arithmetic; it does not select an inventory or tax method.

How do I calculate COGS in Excel?

Put beginning inventory in B1, purchases in B2 and ending inventory in B3, then =B1+B2-B3 gives COGS. With revenue in B4, =(B1+B2-B3)/B4 gives COGS as a share of revenue; format it as a percentage. Google Sheets takes the same formulas. Download CSV, under More options, opens in Excel with your figures.

Use it from an AI browser

This page has site tools: actions an AI agent can call directly, with no plugin or API key. The ChatGPT desktop app’s browser can use them where site tools are available, and so can Chrome with WebMCP turned on. The agent works on this page, with the same steps and limits as its buttons, so you can check the result before you use it.

Try this prompt
Open doany.ai/tools/cogs-calculator and calculate COGS from USD 10,000 beginning inventory, USD 8,000 net additions and USD 6,000 ending inventory, all at cost. Use USD 20,000 revenue for the same period.

Site tools work only while this page is open. They never send messages, invoices or payments for you.

View agent skill on skills.sh