• The formula
  • Sample: one year for a small retailer

Understanding cost of goods sold and how to calculate COGS

Cost of goods sold (COGS) is the cost of the inventory you sold during a period. To calculate it, take the inventory you had at the start of the period, add the inventory you bought during the period, and subtract the inventory you still have at the end. The result is the cost of the goods that left your shelves. OpenStax defines cost of goods sold as an "expense account that houses all costs associated with getting a product ready for sale".

Billed publishes this page. Definitions are quoted from the open textbooks OpenStax Principles of Accounting, Volume 1: Financial Accounting (chapter 6 key terms, chapter 10 key terms and section 10.1) and OpenStax Principles of Accounting, Volume 2: Managerial Accounting (section 2.1). US tax layout is quoted from IRS Publication 334, Tax Guide for Small Business (for use in preparing 2025 returns; page last reviewed or updated April 30, 2026). All were opened on October 30, 2026.

The formula

Cost of goods sold = Beginning inventory + Net purchases − Ending inventory

The parts, with OpenStax's definitions:

  • Beginning inventory: the cost of the inventory on hand when the period starts.
  • Purchases: "new acquisitions of merchandise inventory during the period".
  • Net purchases: the "outcome of purchase discounts, returns, and allowances deducted from gross purchases".
  • Goods available for sale: the "total of all inventory (beginning inventory plus purchased inventory); will either be sold this period or held in period-end inventory".
  • Ending inventory: the cost of the inventory still on hand when the period ends, from a count of what's left.

Worked in two steps:

  1. Goods available for sale = beginning inventory + net purchases. OpenStax puts it this way: "Goods available for sale refers to the total cost of all inventory that the company had on hand at any time during the period, including beginning inventory and all inventory purchases."
  2. Cost of goods sold = goods available for sale − ending inventory.

The second step follows from the definition: goods available for sale are either sold or still held at the end, so whatever isn't in ending inventory goes into cost of goods sold.

Sample: one year for a small retailer

The figures here are a sample, invented for this example. A home goods store has this year:

  1. Beginning inventory (January 1): $8,000
  2. Purchases during the year: $30,000
  3. Purchase returns to suppliers: $1,000
  4. Net purchases: $30,000 − $1,000 = $29,000
  5. Goods available for sale: $8,000 + $29,000 = $37,000
  6. Ending inventory (counted on December 31): $9,500
  7. Cost of goods sold: $37,000 − $9,500 = $27,500

If the store's net sales for the year were $50,000, its gross profit would be $50,000 − $27,500 = $22,500. For gross profit and gross margin, see what is gross profit.

The ending inventory count matters. If the store had counted $10,500 instead of $9,500, cost of goods sold would be $37,000 − $10,500 = $26,500, and gross profit would be $23,500. Each dollar added to ending inventory takes a dollar off cost of goods sold.

How the IRS lays it out (US)

IRS Publication 334 (2025 returns) says: "If you make or buy goods to sell, you can deduct the cost of goods sold from your gross receipts on Schedule C (Form 1040). However, to determine these costs, you must value your inventory at the beginning and end of each tax year."

It continues: "Figure your cost of goods sold by filling out lines 35 through 42 of Schedule C (Form 1040)." The lines as Publication 334 reproduces them:

  • 35: "Inventory at beginning of year. If different from last year’s closing inventory, attach explanation"
  • 36: "Purchases less cost of items withdrawn for personal use"
  • 37: "Cost of labor. Do not include any amounts paid to yourself"
  • 38: "Materials and supplies"
  • 39: "Other costs"
  • 40: "Add lines 35 through 39"
  • 41: "Inventory at end of year"
  • 42: "Cost of goods sold. Subtract line 41 from line 40."

It's the same formula, with lines for labor, materials and other costs. Of line 40, Publication 334 says: "The total of lines 35 through 39 equals the cost of the goods available for sale during the year." Of line 37, it says: "Labor costs are usually an element of cost of goods sold only in a manufacturing or mining business."

Other points from Publication 334:

  • Returns: "You must deduct all returns and allowances from your total purchases during the year."
  • Personal use: "If you withdraw merchandise for your personal or family use, you must exclude this cost from the total amount of merchandise you bought for sale."
  • Small businesses: "There are exceptions for small business taxpayers that may change how you figure cost of goods sold for your business."

Ask your accountant how these rules apply to your business, including whether the small business exceptions cover you and how to value your inventory.

If you make the goods

A manufacturer first works out the cost of the goods it made. OpenStax says: "Once the cost of goods manufactured is calculated, the cost is then incorporated into the manufacturing firm’s income statement to calculate its cost of goods sold." For the materials, labor and overhead that go into it, see how to calculate production costs.

Factory overhead is part of it. Publication 334 says: "The overhead expenses you have as direct and necessary expenses of the manufacturing operation are included in your cost of goods sold."

What cost of goods sold leaves out

For a business that buys goods to resell, costs such as store rent, office wages and advertising are operating expenses. They come off after gross profit, on the way to operating income. To review and trim those costs, see how to reduce business overhead.

Contribution margin splits costs another way, into variable and fixed costs, so it isn't the same as gross profit. See what is contribution margin. Cost of goods sold is also the starting figure for the inventory turnover ratio. If you sell services rather than goods, see what is cost of revenue.

Where Billed fits

Billed's expense tracking page says: "An expense in Billed records who you paid, when, how much and which category it belongs to, with the receipt attached to the same entry." Keep the records for your inventory purchases and supplier returns so your purchases figure can be checked, and ask your accountant how to count and value your ending inventory.

Related Articles

Frequently Asked Questions

How do you calculate cost of goods sold?

Beginning inventory plus net purchases, minus ending inventory. In this page's sample, $8,000 + $29,000 − $9,500 = $27,500.

What is goods available for sale?

OpenStax defines it as the "total of all inventory (beginning inventory plus purchased inventory); will either be sold this period or held in period-end inventory".

Where does cost of goods sold go on Schedule C?

In the US, IRS Publication 334 (2025 returns) says: "Figure your cost of goods sold by filling out lines 35 through 42 of Schedule C (Form 1040)." Line 42 reads: "Cost of goods sold. Subtract line 41 from line 40."

Does ending inventory affect cost of goods sold?

Yes. Ending inventory is subtracted, so a higher ending inventory gives a lower cost of goods sold. In this page's sample, adding $1,000 to ending inventory takes $1,000 off cost of goods sold.

Is cost of goods sold the same as operating expenses?

No. Cost of goods sold is subtracted from net sales to get gross profit. Operating expenses, such as a retailer's rent and office wages, are subtracted after that to get operating income.

Quick checklist

0 of 5 completed0%
Share

Was this article helpful?