Skip to Content

Learn new skills, connect in real time, and grow your career in the Salesblazer Community.

How to Calculate Cost of Goods Sold (COGS): A Step-by-Step Guide

Illustration of cogs turning together with a magnifying glass and a dollar symbol
Cost of goods sold (COGS) is the total investment a business makes in producing a product. [Studio Science]

COGS are the key to profit — but the variables can trip up even the most experienced businessperson. Here's what you need to know.

If your business deals with a lot of variable expenses that impact your production and sales costs, like restaurants or grocery stores, knowing how to accurately calculate the cost of goods sold (COGS) is absolutely essential. If the COGS is not accurately recorded and analyzed, losses can quickly add up and, in some cases, completely devastate your business.

Understanding COGS is pretty straightforward in theory, but figuring out exactly how much you spend, and on what, can be tricky. Don’t worry — this guide is here to help.

What you’ll learn:

Get a full visual of your business in an instant

Get complete visibility of your pipeline, forecast, and team — with Revenue Intelligence from Sales Cloud.  

What is the cost of goods sold?

Simply put, the cost of goods sold (COGS) is the total investment a business makes in producing a product. It includes the labor to produce goods, raw materials, parts used in production, and other direct costs.

COGS is also sometimes referred to as cost of sales (COS).

Why is COGS important?

Understanding your COGS is vital because it directly impacts your profit margin (how much you make on each sale). This helps you understand which products and services are most profitable to sell, and which ones are more costly, so you can make strategic business decisions. It also helps you set the right price for your products and inform production decisions.

What’s included in the cost of goods sold (COGS)

COGS are the direct costs of producing or acquiring the goods sold by a company, including the cost of labor and materials. These costs vary by industry and may include:

  • Items purchased for resale
  • Raw materials
  • Direct labor costs
  • Shipping and freight
  • Storage
  • Factory overhead

It’s important to note that many companies purchase their inventory as “ready to sell” from other vendors, which means they don’t break down COGS into these components; COGS is simply the cost of purchasing inventory items. If products are created, however, the above elements should be considered.

Direct costs versus indirect costs

One of the reasons COGS can be confusing is that businesses sometimes struggle to see a clear line separating direct costs associated with production of a product and indirect costs that don’t have direct bearing on that production. To determine whether something is a direct cost, ask yourself this question: Is there a straight line from a specific cost to the sale of a product? If so, it’s a direct cost.

  • Direct costs include manufacturing supplies, equipment, and raw materials. Labor costs may also be included, but only if they can be directly tied to the production of goods.
  • Indirect costs can include things like office supplies, rent, utilities, computers, mobile phones, and accounting and payroll software. It can also include operating costs, including marketing, insurance, and business travel.

Because indirect expenses are not involved in producing goods or delivering services, they are not included in COGS.

The cost of goods sold formula

The basic cost of goods sold formula is: Cost of Beginning Inventory + Cost of Purchased Inventory – Cost of Closing Inventory = COGS

So, for example, let’s say you’re looking at your numbers for Q1. You started the quarter with $35,000 in inventory. You purchased an additional $15,000 in inventory to support a new product launch. At the end of Q1, you have $10,000 in inventory left. That’s your COGS.

$35,000 + $15,000 – $10,000 = $40,000

As noted above, however, COGS calculations can vary depending on your business model and whether or not you’re producing your own product from scratch, so we’ll walk through the specifics next.

Methods of calculating COGS

There are two main accounting methods for determining how to calculate COGS — specific identification and weighted average cost. Once you choose a method, it’s important to remain consistent with your accounting to get an accurate analysis of your business.

Specific identification

This method calculates the costs of goods sold by carefully tracking inventory and adjusting the balance whenever a unit is purchased. Specific identification is often preferred for businesses that have unique, high-end products like cars or fine jewelry because each inventory item represents a unique, often high cost.

For example, Jane is a handbag reseller. She goes to estate sales and buys vintage designer handbags. After she cleans them up and makes minor repairs, she puts them up for resale on her website.

Because each item Jane sells is unique, she needs to specifically identify each unit in her accounting to calculate COGS and gross profit. Here are her sales for August:

August itemsPrice purchasedPrice soldGross profit
Speedy duffle$500$1,200$700
Quilted flap purse$1,200$2,900$1,700
Epi coin purse$50$300$250
Gilded gold purse$1,500N/AN/A

The COGS in this case would be the sum total of any items Jane has not yet sold, so $1,500.

The benefit to using the specific identification method is that your COGS will always be accurate, as long as you keep track of inventory in your accounting. With this method, you can see which styles are selling well, and adjust your investment in product accordingly.

Weighted average cost

If you sell something that is constantly restocked, like groceries, you can use the weighted average cost method to determine the likely cost of goods sold at any point based on an average per-unit cost.

To use this method, divide the cost of goods available for sale by the number of units available for sale. This yields the weighted average cost per unit. When looking at costs during a similar time period next year, you can use this average cost per unit to determine COGS.

Tony, who sells tank tops on the Jersey Shore, uses this method. During the summer season, he records the following transactions:

Summer itemsQuantity changeActual unit costActual total cost
BEGINNING INVENTORY+240$5$1200
June sales-100
Purchase+120$7$840
July sales-200
Purchase+360$5$1800
Ending inventory=420

At the beginning of the season, Tony buys 240 tank tops at $5 per unit from a manufacturer for a total of $1,200.

During the month of June, Tony sells 100 tank tops and purchases a restock of 120 for $840. In July, Tony sells 200 tank tops and purchases a restock of 360 more for $1800.

The actual total cost of Tony’s inventory during the summer is $3840 ($1,200 + $840 + $1,800). His total purchased inventory for the season is 720 (240 beginning inventory + 480 purchased). Tony’s weighted average cost per unit is $5.33 ($3,840 / 720 units). This can be used to plan likely COGS for next summer.

How to choose the COGS calculation method that’s right for your business

There are really two key considerations to determining the right COGS calculation method: Are you purchasing large volumes of similar products, or are each of your products unique? It’s also important to think about whether or not you’re creating your own products or purchasing from vendors.

For example, if you’re a big-box retailer, you’ll likely be purchasing multiple similar products, so would likely use a weighted average cost method. Manufacturing may use a similar method but break down the COGS calculation to include raw production materials. Contrarily, for independent retailers like antique shops, the specific identification method makes more sense; you’re building an inventory of unique items.

If you have doubts about how to categorize costs, consult with a certified public accountant (CPA).

The cost of goods sold calculator

Calculating COGS can be a headache, especially if you’re producing your own goods. If you’d rather not rely on your own math skills, here’s a COGS calculator to help you get started.

If you create your own products, you’ll need to create a spreadsheet to track the cost of raw materials and direct costs. Think of every marketing activity that it took to get sales leads, and make sure that’s factored in.

You’ll also need to define what time period you want to cover, whether it’s monthly, quarterly, or annually. The longer the time frame, the more accurate your COGS will be. However you calculate cost of goods sold, it’s important to track all of your sales data in a CRM to ensure accurate reporting.

The IRS also offers guidance on how to figure out the cost of goods sold.

Example of COGS

Product manufacturers have a somewhat complex equation for COGS. They need to account for raw materials, components that come from multiple suppliers, and storage. These all factor in to your cost of goods sold:

  • Raw materials
  • Labor
  • Shipping costs
  • Warehouse overhead
  • Product packaging and labeling

Let’s say a manufacturing company is building widgets that cost $500 to build: $100 in raw materials, $100 in labor, $100 in shipping costs, and $200 in other direct costs. They make 40 to kickstart each quarter.

That means the company’s starting inventory cost every quarter is $20,000. If they spend another $30,000 on manufacturing costs during the quarter and sell $10,000 in product, their COGS is $40,000.

The impact on your financial statements

Ultimately, when you master how to calculate COGS, you’ll have a better understanding of how investing in direct costs can impact your gross margin and profit. Armed with this knowledge, you’ll have a better idea of your company’s financial health.

If your costs for raw materials increase, COGS can help you gauge whether you should increase the price of the product, and by how much. If you don’t have an accurate idea of how much you’re spending on products, it will be difficult — if not impossible — to determine if your company is profitable.

Improve COGS calculations, improve your bottom line

Understanding COGS plays a crucial role in your business’s profitability. If you want to have your books in the black, you need to charge more for your goods or services than it costs to produce them. Ultimately, an accurate and detailed COGS can help you determine pricing, improve company efficiency and improve your company’s bottom line.

Drive pipe faster with a single source of truth

Discover how Sales Cloud uses data and AI to help you manage your pipeline, build relationships, and close deals fast.

Erin Hueffner, Writer, Salesblazer
Erin Hueffner Writer, Salesblazer

Erin Hueffner is a writer from Madison, Wisconsin. Her career spans two decades in tech, journalism, and content marketing. At Salesforce, Erin’s work focuses on sales fundamentals and best practice content for Salesblazers. Erin has a bachelor’s degree in English from the University of Wisconsin-Madison.

More by Erin

Get the latest articles in your inbox.