Skip to calculator
themoneysheet logothemoneysheet

Cost of Goods Sold (COGS) Calculator

Compute your cost of goods sold for the period from inventory movement — and keep operating expenses out of it, the mix-up that bites at tax time.

Written by Dorothy Ibrahim, 10+ years in banking & finance

Loading calculator…

How we calculate this

This calculator computes your cost of goods sold for a period from inventory movement: what you started with, what you added, and what was left at the end. COGS is the number that determines your gross profit, and it is also where many small owners go wrong at tax time by mixing in operating expenses that belong elsewhere. Add revenue for the same period and the tool shows your gross margin too.

The formulas
Goods available for sale
beginning inventory + purchases + freight-inFreight-in is shipping to YOU — it counts in COGS. Shipping to customers is an operating expense, not COGS.
Cost of goods sold (periodic method)
goods available for sale − ending inventory
Gross profit and gross margin (if revenue entered)
gross profit = revenue − COGS; gross margin = gross profit ÷ revenue
Worked example
  1. Say beginning inventory is $40,000, purchases during the period are $120,000, freight-in is $0, and ending inventory is $35,000.
  2. Goods available for sale = $40,000 + $120,000 + $0 = $160,000.
  3. COGS = $160,000 − $35,000 = $125,000 — the cost of everything that left inventory as sales during the period.
  4. If revenue for the same period were $200,000, gross profit would be $200,000 − $125,000 = $75,000 — a 37.5% gross margin.
Rates, benchmarks & sources
  • COGS = beginning inventory + purchases + freight-in − ending inventory Standard periodic-inventory accounting definition
  • Warning threshold: COGS above 70% of revenue (gross margin under 30%) flags a pricing/cost review Rule of thumb (spec §2.3)

Figures current as of 2026-07-02. See our methodology & editorial standards for how constants are versioned and verified.

What this tool doesn’t model
  • This is the periodic method — it infers COGS from inventory counts, so it also silently absorbs shrinkage, theft, and damaged goods into COGS rather than isolating them.
  • It assumes your inventory values use a consistent costing method (FIFO, weighted average, etc.); switching methods mid-period distorts the result.
  • Direct labor and manufacturing overhead belong in COGS for producers, but this tool only counts what flows through the inventory inputs you enter.
  • It computes an accounting figure, not a tax filing — how COGS lands on your return depends on your inventory method and entity type, and state treatment varies.

Frequently asked questions

What counts as COGS and what is an operating expense?

COGS is the cost tied to the products you sold: inventory, raw materials, freight-in, and direct labor for producers. Rent, marketing, software, insurance, and office payroll are operating expenses — they are deducted separately and never belong in COGS. The distinction matters because gross margin, pricing decisions, and parts of your tax return all depend on keeping the two apart.

Does shipping count in COGS?

It depends on the direction. Freight-in — shipping that brings inventory or materials to you — is part of the cost of the goods and belongs in COGS. Shipping outbound to customers is a selling expense, which is an operating expense. Lumping outbound shipping into COGS understates your true gross margin on the product itself.

Why did the calculator flag my inputs as impossible?

Your ending inventory came out larger than everything you had available to sell — beginning inventory plus purchases plus freight-in. Inventory cannot appear from nowhere, so one of the numbers is off: a miscount, a period mismatch between the two inventory snapshots, or purchases recorded in the wrong period are the usual culprits.

What does a negative COGS mean?

Mechanically it means your ending inventory grew by more than you purchased, which is impossible for a real period — you cannot sell negative goods. In practice it almost always signals an input error: the beginning and ending counts are from mismatched dates, a purchase was double-counted elsewhere, or a revaluation moved the inventory numbers. The tool flags it rather than presenting a misleading figure.

How often should I calculate COGS?

The formula works for any period with an inventory count at each end — monthly, quarterly, or yearly. More frequent counts catch margin drift and shrinkage sooner; annual-only counts mean a whole year passes before you see that product costs crept up. Many product businesses run it monthly against revenue to watch the gross margin trend.

Related calculators

themoneysheet provides educational estimates, not financial, tax, or legal advice. Figures use published rates and formulas current as of the date shown, but your situation may differ. Consult a qualified professional (CPA, attorney, or licensed advisor) before making financial decisions.