Skip to content

Cost of Goods Sold Calculator

✦ Business & Work

This cost of goods sold calculator applies the periodic formula: beginning inventory + net purchases − ending inventory. As a COGS calculator for resellers and manufacturers it adds freight-in, purchase returns and the cost of goods manufactured, and, with net sales, gives gross profit, gross margin and cost per unit sold.

  • ✓ Calculated in your browser
  • ✓ Nothing you type is stored
  • ✓ No sign-up required
  • ✓ Formula and sources shown

The formula

Cost of goods sold (periodic method)

COGS = Beginning inventory + Purchases + Freight-in − Purchase returns − Ending inventory

Net purchases = purchases + freight-in − purchase returns and allowances; beginning inventory + net purchases = goods available for sale. The ending-inventory value you enter must already reflect your costing method (FIFO, LIFO, weighted average or specific identification); the calculator applies the formula and does not compute the method. Manufacturers: raw materials used + direct labour + manufacturing overhead = cost of goods manufactured, then the same formula on finished goods; changes in work in process and uniform capitalization (IRC 263A) are not modelled. Money is shown to the cent. The default figures are the sample company the inventory turnover and cash conversion cycle pages use, so COGS is the same $600,000 on all three.

Calculating it by hand

  1. Choose Reseller or retailer, or Manufacturer.
  2. Enter beginning inventory: last period’s ending inventory, at cost.
  3. Reseller: enter purchases, freight-in and purchase returns. Manufacturer: enter raw materials used, direct labour and manufacturing overhead.
  4. Enter ending inventory, valued under your costing method.
  5. In Advanced, enter net sales for gross profit and gross margin, or units sold for the cost per unit.
  6. Read COGS, then the step-by-step chart and the line-by-line breakdown.

Worked examples

A reseller over one year (the defaults)

  1. Beginning inventory $70,000; purchases $612,000; freight-in $6,000; purchase returns $8,000; ending inventory $80,000.
  2. Net purchases = $612,000 + $6,000 − $8,000 = $610,000.
  3. Goods available for sale = $70,000 + $610,000 = $680,000.
  4. COGS = $680,000 − $80,000 = $600,000.

Cost of goods sold $600,000.00; 88.2% of the goods available were sold.

A small reseller with freight and returns

  1. Beginning inventory: $5,000
  2. Purchases: $30,000
  3. Freight-in: $1,500 · Purchase returns: $500
  4. Net purchases = $30,000 + $1,500 − $500 = $31,000
  5. Ending inventory: $4,000
  6. COGS = $5,000 + $31,000 − $4,000 = $32,000

Cost of goods sold $32,000.00.

A small manufacturer (Manufacturer tab, the defaults)

  1. Beginning finished-goods inventory: $20,000
  2. Raw materials used: $40,000
  3. Direct labour: $15,000
  4. Manufacturing overhead: $8,000
  5. Total production cost = $40,000 + $15,000 + $8,000 = $63,000
  6. Ending finished-goods inventory: $12,000
  7. COGS = $20,000 + $63,000 − $12,000 = $71,000

Cost of goods sold $71,000.00.

Methodology

How COGS is actually calculated

COGS is the direct cost of what you sold — it tells you how much you kept before paying any overhead. The number most businesses get wrong is the ending inventory value, which depends on the costing method their books use.

Read sources and limits

How do you calculate cost of goods sold?

A cost of goods sold calculator works out the cost of the goods a business sold in a period from its inventory counts and purchases: beginning inventory, plus net purchases, minus ending inventory. Whatever was available and is no longer on the shelf was sold. It is the periodic formula of IRS Schedule C Part III and Form 1125-A.

With the defaults: $70,000 of beginning inventory + $610,000 of net purchases ($612,000 of purchases + $6,000 of freight-in − $8,000 of returns) = $680,000 of goods available for sale; less $80,000 still on hand = $600,000 of cost of goods sold.

Freight-in, the shipping you pay to bring stock in, is part of the cost of the inventory (FASB ASC 330), so it is added to purchases. Purchase returns and allowances, goods sent back or price reductions from suppliers, come off. For a manufacturer, the formula is the same but the additions are raw materials used, direct labour and manufacturing overhead rather than merchandise purchases.

What does not go into cost of goods sold: selling expenses, administrative salaries, marketing, office rent and depreciation of non-manufacturing assets. Those are operating expenses; they reduce operating profit, not gross profit. Enter net sales in Advanced and the calculator shows gross profit: $900,000 of sales less $600,000 of cost of goods sold is $300,000, a 33.3% gross margin.

How do you calculate COGS for a manufacturer?

For a manufacturer, total production cost is the sum of three components. Raw materials used is the cost of materials consumed in production (beginning raw materials inventory plus raw-material purchases minus ending raw-material inventory). Direct labour is the wages and salaries of workers who directly produce the goods — not supervisors or support staff, who go into manufacturing overhead.

Manufacturing overhead is everything else the factory needs: rent, utilities, equipment depreciation, indirect labour, factory insurance. You then apply the periodic formula to finished-goods inventory: beginning finished-goods inventory plus total production cost minus ending finished-goods inventory equals COGS. Note that two levels of inventory exist — a raw-materials level and a finished-goods level — and this calculator handles the finished-goods level. If you need raw materials used, compute it separately (beginning raw materials plus raw-material purchases minus ending raw materials) and enter that figure.

With the manufacturer defaults: $40,000 of raw materials used + $15,000 of direct labour + $8,000 of overhead = $63,000 of cost of goods manufactured; $20,000 of beginning finished goods + $63,000 − $12,000 of ending finished goods = $71,000 of cost of goods sold. Uniform capitalization (IRC 263A) requires some producers and resellers to add more indirect costs to inventory; the calculator does not model it, so enter overhead that already includes any such adjustment.

Is cost of goods sold the same as cost of sales?

For a business that sells goods, usually yes: income statements use cost of goods sold, cost of sales and cost of revenue for the same line. Service businesses with no inventory say cost of sales or cost of revenue for the direct cost of delivering the service, which is measured directly rather than with the inventory formula.

IRS Schedule C and Form 1125-A use cost of goods sold. For this calculator the distinction does not affect the arithmetic — the periodic formula is the same. If your business is primarily a service business with no physical inventory, your "cost of sales" is not the opening/closing inventory formula but a direct measurement of delivery costs; this calculator is designed for businesses that carry physical inventory.

What are the common COGS mistakes and limits?

The most common mistake is forgetting that the costing method changes the ending-inventory number — and therefore COGS. FIFO (first in, first out) assigns the cost of the oldest purchases to COGS; LIFO (last in, first out) assigns the most recent costs; weighted average uses the average cost of all units available.

In a period of rising prices, FIFO produces lower COGS and higher taxable profit; LIFO produces higher COGS and lower taxable profit. LIFO is a tax election (Form 970) that requires IRS consent and must be consistently applied. This calculator does not compute ending inventory — you enter the value your accounting system or physical count gives you under your chosen method.

A second common mistake is including operating expenses in cost of goods sold. Office rent, the owner’s salary, sales commissions and advertising reduce operating profit, not gross profit; putting them in the cost of goods sold understates gross margin and distorts every ratio built on it, including inventory turnover.

A negative COGS result means your ending inventory value exceeds beginning inventory plus all additions — this can happen after a write-up of inventory or if figures from different periods are mixed. The result is mathematically correct but almost always signals a data entry error; check your period boundaries.

Cost of Goods Sold questions

What is included in cost of goods sold?

The cost of acquiring or producing the goods you sold: merchandise purchases and freight-in for a reseller; raw materials, direct labour and manufacturing overhead for a manufacturer. Selling expenses, administrative salaries, marketing, interest and income tax are not part of it (FASB ASC 330; Form 1125-A).

Does COGS include shipping?

Inbound shipping does: freight-in is part of the cost of inventory, so it is added to purchases ($612,000 + $6,000 on the defaults). Shipping to customers (freight-out) is a selling expense, not cost of goods sold.

Can I use a FIFO COGS calculator here?

This calculator applies the periodic formula to whatever ending-inventory value you enter. If you value ending inventory under FIFO, the COGS result is your FIFO COGS. If you use LIFO or weighted average, it produces that method's COGS. The calculator does not compute ending inventory from a list of purchases; it leaves that to your accounting system or physical count. Enter the ending inventory value from your records.

What is the difference between COGS and cost of sales?

For a business that sells goods they are usually the same line. Service businesses with no inventory use cost of sales or cost of revenue for the direct cost of delivering the service, measured directly rather than with the inventory formula.

What is beginning inventory in cost of goods sold?

Beginning inventory is the value of unsold goods at the start of the period — exactly equal to the ending inventory of the previous period. For a new business in its first period, beginning inventory is zero. The value should come from your most recent physical count or perpetual inventory system, under the costing method you use.

Does COGS include labour costs?

For manufacturers, yes: direct labour — wages of workers who physically produce the goods — is part of COGS. For resellers, no: labour is an operating expense because you are not manufacturing anything. Indirect labour (supervisors, quality control, factory management) is usually included in manufacturing overhead for manufacturers; sales staff and office staff wages are always operating expenses for both types of business.

Why is my COGS negative?

A negative result means your ending inventory value exceeds beginning inventory plus all additions. In a real business this can happen after an inventory write-up (an increase in carrying value), an accounting period mismatch, or a data entry error. The formula is mathematically correct — a negative COGS would increase gross profit — but it almost always indicates a mistake. Check that beginning inventory matches last period's ending inventory and that no figures span different periods.

How do you calculate gross profit from cost of goods sold?

Gross profit = net sales − cost of goods sold. $900,000 of net sales less $600,000 of cost of goods sold is $300,000, a gross margin of 33.3% ($300,000 ÷ $900,000). Enter net sales in Advanced to see both.

How do I calculate cost per unit sold?

Cost per unit = COGS ÷ units sold. Open the Advanced section, enter your units sold for the period, and the calculator shows the average cost per unit alongside COGS. This is the average cost, not the cost of any specific unit; if you need the cost of a specific item you need a perpetual inventory system tracking individual lots.

Source notes

Method, sources & limitations

Every figure on this page comes from the formula above applied to the values you enter. Nothing is estimated from market data, and no result is a forecast. These are the sources behind the method and any fixed figures it uses:

Educational information only. Results are estimates produced from the assumptions you enter, and are not financial, tax, legal or medical advice. Check anything that matters against a qualified professional and the cited sources.