Business and Freelancing

COGS Calculator

Work out the cost of goods sold for a period from your inventory figures.

Your numbers

The cost of inventory on hand at the start of the period.

Optional. Shipping you paid to bring the inventory in.

Optional. Purchase returns and allowances that reduce what you paid.

The cost of inventory still on hand at the end of the period.

Optional. Adds gross profit and COGS as a share of sales.

Result

Cost of goods sold

$38,000.00

$50,000.00 available for sale less $12,000.00 left in inventory

Cost of goods sold
$38,000.00
Goods available for sale
$50,000.00
COGS as a share of sales
63.33%
Gross profit
$22,000.00
Gross margin
36.67%
How this was calculated
  1. Goods available = beginning inventory + purchases + freight in - returns and discounts = $10,000.00 + $40,000.00 + $0.00 - $0.00 = $50,000.00.
  2. COGS = goods available - ending inventory = $50,000.00 - $12,000.00 = $38,000.00.
  3. Gross profit = sales - COGS = $60,000.00 - $38,000.00 = $22,000.00.
  • This is the standard periodic inventory formula applied to the amounts you enter. It does not choose a costing method such as FIFO or average cost, count direct labor or overhead, or write down damaged stock. Ask an accountant how your books and taxes treat inventory.

Calculated using SumPanda.com · https://sumpanda.com/cogs-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the cogs calculator

  1. Enter your beginning inventory at cost for the period.
  2. Enter purchases during the period. Add freight in and returns and discounts if they apply.
  3. Enter your ending inventory at cost.
  4. Optionally enter sales to see gross profit and COGS as a share of sales.

Formula

Goods available for sale = beginning inventory + purchases + freight in - returns and discounts

Cost of goods sold = goods available for sale - ending inventory

Gross profit = sales - cost of goods sold

COGS percent of sales = COGS / sales x 100%

This is the periodic inventory method. It uses the inventory counts you enter and does not pick a costing method such as FIFO.

$10,000 + $40,000 - $12,000

A shop starts the period with $10,000 of inventory, buys $40,000 more and ends with $12,000 on hand. Goods available for sale are $50,000, so cost of goods sold is $50,000 - $12,000 = $38,000.

With sales of $60,000, gross profit is $22,000, COGS is 63.33% of sales and the gross margin is 36.67%. If you also paid $2,000 in freight in and got $500 back in returns, goods available become $51,500 and COGS rises to $39,500.

What goes into COGS

Cost of goods sold is the cost of the products you actually sold during the period. It starts with what you had, adds what you bought and brings in costs of getting the goods to your door, then subtracts what is still on the shelf. What remains is the cost of what left.

Because the formula works from inventory counts, an error in the ending count carries straight into COGS and into profit. Counting carefully at the end of each period matters more than the arithmetic.

What the formula leaves out

Which costs count as inventory, such as direct labor or overhead for a manufacturer, and which costing method you use, change the numbers. Damaged or missing stock, write-downs and tax rules also matter. Ask an accountant how your books and taxes treat inventory.

For related views use the inventory turnover calculator, the profit margin calculator and the GMROI calculator. Roll results into a statement with the profit and loss statement generator.

Assumptions and limits

  • All amounts are at cost, not at selling price, for the same period.
  • Ending inventory cannot exceed the goods available for sale.
  • Freight in and returns are optional and default to zero.
  • The tool does not choose a costing method or handle write-downs.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

How do you calculate cost of goods sold?

Add beginning inventory and purchases, subtract ending inventory. With $10,000 to start, $40,000 of purchases and $12,000 left, COGS is $38,000.

Is freight included in COGS?

Freight you pay to bring inventory in is usually part of inventory cost, which is why the tool has a freight in box. Whether it applies to you depends on your accounting method.

What is the difference between COGS and operating expenses?

COGS is the direct cost of the products sold. Operating expenses are other costs of running the business, such as rent and marketing.

Why can ending inventory not be higher than goods available?

You cannot have more inventory at the end than you started with plus what you bought. If the count is higher, a number was entered in error.