Master Your COGS: Learn Cost of Goods Sold Formula (2023)

An anthropomorphic dollar sign is holding two tshirts while mathematical symbols dance in the background

Retailers need to track the cost of goods sold (COGS) to ensure they are profitable and reporting expenses to the IRS correctly. 

Considering that 60% of small business owners feel they don’t have enough knowledge about accounting and finance, it’s a good idea to understand how COGS can impact your accounting and sales. 

This guide will walk you through what’s included in COGS, how to calculate it, and different ways to help prepare for tax season.

What does COGS stand for?

Cost of goods sold (COGS) is the direct cost of producing products sold by your business. Also referred to as “cost of sales,” or "COGS report," COGS includes the cost of materials and labor directly related to the production and manufacturing of retail products. COGS excludes indirect costs, such as distribution and marketing.

Increase profits by knowing your cost

Confidently launch your product on a budget with our easy-to-use cost calculator.

Learn more

What’s included in the cost of goods sold?

The cost of goods sold is essentially the wholesale price of each item, which includes the direct labor costs required to produce each product.


  • The individual costs of all parts used to build or assemble the products.
  • The cost of all the raw materials needed for the products.
  • The cost of any and all items purchased for resale and/or to create the product.


  • The parts or machines required to create the product.
  • All supplies required in the production of the product.
  • Shipping parts and equipment to the warehouse to create the product, including containers, freight, fuel surcharges, etc.
  • The workforce (people) who put the products together, ship the parts, etc.


  • Office staff: everyone directly involved in producing the product.
  • Software, hardware, office rent, utilities, etc. used to support production

Cost of goods sold formula

Equation reading (Beginning Inventory + Purchases) – Ending Inventory = COGS

Here is the accepted COGS equation used by accountants:

(Beginning Inventory + Purchases) – Ending Inventory = COGS

Now let’s look more closely at how to calculate COGS.

How to calculate cost of goods sold

Typically, the CFO or other certified accounting professional would handle these calculations because it’s not as simple as the example above would suggest. However, for the DIY CEO, calculating cost of goods sold requires a bit of information prep beforehand in order to report accurately.

Here’s what you need to calculate COGS.

  1. Valuation method. Whoever prepares your taxes should advise you on what valuation method you should use for your business.
  2. Beginning inventory. What is the total cost of all your inventory of products at the start of your fiscal year? This should match the ending inventory for the previous fiscal year.
  3. Cost of purchases. Total of all the products purchased during the fiscal year that are available to sell, including raw materials less anything taken for personal use.
  4. Cost of labor. The cost of employees directly associated with assembling the product (i.e., not back-office staff).
  5. Cost of materials and supplies. Whatever costs are associated with making the products you’re selling.
  6. Other costs. All other costs not previously accounted for: shipping containers, freight for materials and supplies, overhead expenses (rent, utilities, hardware, software, etc.).
  7. Ending inventory. The total value of all remaining items still in inventory at the end of the fiscal year.

1. Determine direct vs. indirect costs

When doing the math, it’s important to remember there are two types of costs associated with each product: direct and indirect costs.

Direct costs are all costs directly associated with the product itself. This includes: 

  • Raw material costs or items for resale
  • Cost of inventory of the finished products
  • Supplies for the production of the products
  • Packaging costs and work in process
  • Supplies for production
  • Overhead costs, including utilities and rent

Indirect costs include: 

  • Labor, the people who put the product together
  • The equipment used to manufacture the product
  • Depreciation costs of the equipment
  • Costs to store the products
  • Administrative salaries
  • Non-production equipment for back-office staff

A note on facilities costs: This part is tricky and requires an experienced accountant to accurately assign each product. These costs need to be divided strategically among all the products being manufactured and warehoused, and are usually calculated on an annual basis.

2. Figure out beginning inventory and cost of purchases

Whether you sell jam, t-shirts, or digital downloads, you’ll need to know how much inventory you start the year with to calculate the cost of goods sold.

It’s important to keep track of all your inventory at the start and end of each year. Your inventory doesn’t simply include finished products in stock and ready for resale, but also all the raw materials you have, any items that have been started but not completed, and any supplies.

For accounting and reporting purposes, it’s imperative that both your beginning inventory and your ending inventory (from the previous fiscal year) match up exactly—otherwise, a detailed explanation will be required.

Further, whatever items and inventory are purchased throughout the year that don’t fall under the beginning or ending inventory must be accounted for as well. These are the cost of purchases and include all items, shipments, manufacturing, etc. As with your personal taxes, you need to keep all paperwork to show these items were purchased during the correct fiscal year.

3. Calculate ending inventory

At the end of the year, it’s important to take stock of all the inventory that remains. This means all products that remain and have not been sold. As we’ve discussed, this information will be used in the current COGS calculation, but will also be required for the following year’s calculations.

All inventory can be categorized as resale ready, damaged (requires the estimated value of the items damaged), worthless products (evidence of destruction must be provided), and obsolete items (evidence of devaluation needed). For the latter, these products can be donated to charities for a little extra goodwill.

💡Resource: Need help calculating COGS? Try a free Cost of Goods Sold calculator to speed up the process.

Cost of goods calculator example

Cost of goods sold example

Let’s say your company has the following information for recording the inventory for the calendar year ending on December 31, 2022.

Your inventory at the beginning of the year, recorded on January 1, 2022, is $20,000. At the end of the year, on December 31, 2022, your ending inventory is $6,000. During the year, your company made $8,000 worth of purchases. 

Let’s calculate COGS using the formula above: (Beginning Inventory + Purchase) - Ending Inventory.

COGS = ($20,000 + $8,000) - $6,000

COGS = $22,000

Having this information lets you calculate the true cost of goods sold in the calendar year. COGS helps you evaluate the cost and profits but also helps plan out purchases for the next year.

💡 PRO TIP: Shopify makes it easy to find your cost of goods sold at the end of your calendar year—no manual calculations or formulas required. To get started, go to the Finances summary report from your Shopify Admin and select the time period you want the report to reflect.

Inventory accounting methods

The value of COGS depends on the costing method chosen by a business. Here are three different accounting methods you could use to value inventory: 

  • Weighted average cost
  • First in first out
  • Last in first out

Weighted average cost

Inventory weighted average, or weighted average cost method, is one of the three most common inventory valuation methods. It uses a weighted average to figure out the amount of money that goes into COGS and inventory. 

In this method, the average price of all products in stock is used to value the goods sold, regardless of purchase date. It’s an ideal method for mass-produced items, such as water bottles or nails. 

Take the following inventory buys for example:

  • 200 units at $5 each
  • 100 units at $6 each
  • 150 units at $5.50 each

Your total inventory would be $2,425. Your average cost per unit would be the total inventory ($2,425) divided by the total number of units (450). That’s $5.39 per unit. 

To find the weighted average cost COGS, multiply the units sold by the average cost. If you sold 100 units, your weighted average cost would be $539. 

First in first out (FIFO)

First in, first out, also known as FIFO, is an assessment management method where assets produced or purchased first are sold first. This method is best for perishables and products with a short shelf life. 

For example, say you bought units X, Y, Z and got two orders for one unit each. Using FIFO, your first order is $5 because you bought unit X first, and you paid $5 for it. Assuming the first order depletes unit X, the COGS on your second order is $6 because that was what you paid for the next unit you bought. 

When prices are rising, the goods with higher costs are sold first and the closing inventory will be higher. This results in higher net income over time. When prices are decreasing, the opposite is true. 

Last in first out (LIFO)

LIFO is the opposite of FIFO. It assumes the goods you purchased or produced last are the first items you sold. When prices are rising, goods with higher costs are sold first and closing inventory is lower. This results in a decreasing net income. 

Using the example above, your LIFO COGS for the first order would be $5.50 because you bought unit Z last. The COGS on your second order is $6 because the next unit you bought was Y. 

During times of inflation, LIFO leads to a higher reported COGS on your financial statements and lower taxable income.

Exclusions from cost of goods sold

Not all companies can list COGS on their income statement. Service companies don’t have a COGS, and cost of goods sold isn’t addressed in generally accepted accounting principles. It’s only defined as the cost of inventory items sold during an accounting period. 

COGS vs. operating expenses

Operating expenses and cost of goods sold are two different expenses that occur in your daily business operations. They are both subtracted from your business’ total sales figures, yet they are recorded as separate line items on your income statement. 

Operating expenses refer to expenditures not directly related to the production of your products. These include:

  • Rent
  • Office supplies
  • Legal costs
  • Sales and marketing
  • Payroll
  • Utilities
  • Insurance

A business must budget for operating expenses while keeping its competitive edge. You incur these costs regardless of how many net sales you make. For example, a fashion boutique must pay rent, utilities, and marketing costs no matter how many items it sells in a month. 

When the boutique sells a shirt, COGS accounts for the sewing, the thread, the hanger, the tags, the packaging, and so on. It also includes any goods bought from suppliers and manufacturers.

Benefits of COGS

Understand cash flow

COGS is subtracted from sales to calculate gross margin and gross profit. The higher your COGS, the lower your gross profit margins. As a retailer, you need to keep a close eye on cash flow or you won’t last very long. 

Manage tax liability

When reporting taxes, Uncle Sam (or your localized government equivalent) wants to know how much a business made so it can tax said business accordingly.

The good news is that COGS are small business expenses—which means they don’t count toward your gross revenue. And COGS is an expense line item in your company’s income statement, otherwise known as a profit and loss statement, or P&L. 

The IRS allows you to deduct the cost of goods that are used to make or purchase the goods you sell in your business.

By calculating all business expenses, including COGS, it ensures the company is offsetting them against total revenue come tax season. This means the company will only pay taxes on net income, thereby decreasing the total amount of taxes owed when it comes time to pay taxes.

A note on COGS and taxes: While high COGS means a lower income tax, that is not the ideal scenario, because it ultimately also means lower profitability for the company. It’s important to manage COGS efficiently in order to increase profits.

Keep track of expenses 

A product requires materials and parts, but it also requires a number of other things:

  • Labor
  • Manufacturing parts
  • Buying parts from third parties
  • The cost of shipping said parts to your warehouse 
  • Assembling these parts

Not to mention the fixed costs: the labor, factory overhead, rent, equipment, electricity to run the operations, and employees to sell said products in your store, as well as sales, marketing, finance, and all the other departments.

That’s a lot. And that’s what it costs to sell things. As a result, these are all expenses that contribute to the end cost of the product.

Expenses you need to keep track of to ensure you are making not only a healthy gross profit but that you can accurately price products and keep healthy margins.

Using COGS for your retail store

Whether you’re opening your first retail store or your fifth, the accounting process is tough. Business owners can’t control the price of each other’s suppliers. But what you can control is the accounting methods you use to track metrics like COGS. 

Be thorough in your accounting practices. Partnering with a good accountant can change your small business for the better, not just by taking the headache out of tax preparation, but by providing financial advice that improves your bottom line.

Costs of goods sold (COGS) FAQ

What are your COGS?

The cost of goods sold (COGS) is the total cost of inventory that has been sold by a company. This figure is calculated by adding together the variable cost of materials, labor, and overhead associated with each unit of inventory sold.

How do you calculate the COGS?

Cost of goods sold (COGS) is calculated by using the COGS formula, which is represented as: (Beginning Inventory + Purchases) – Ending Inventory = COGS.

What are examples of COGS?

Some examples of cost of sales or COGS include manufacturing parts, shipping costs, and labor associated with building or assembling products.

What is the difference between COGS and SG&A?

COGS shows your production costs, while SG&A includes indirect costs, such as marketing and administrative expenses