COGS formula: How to calculate cost of goods sold
Benchmark your company's expenses with Ramp's data.
straight to your inbox
As a business owner, how do you know if you are pricing your product or service in a way that will generate a profit for your company? How can you identify expenses that you can optimize or cut to keep more cash flow in your business as working capital or profit? How can you ensure that you are claiming the maximum tax deduction your business qualifies for?
To answer all of these questions, you’ll need to know your company’s cost of goods sold (COGS). But what exactly is COGS, and how is it calculated?
Below, we define COGS, discuss the specific expenses that are typically included, and provide a formula you can use to calculate your business’s cost of goods sold. We also walk through different accounting methods and how they can impact cost of goods sold, and compare COGS to other financial metrics that it is often discussed alongside.
What is cost of goods sold (COGS)?
Cost of goods sold (COGS) is a financial metric that represents all of the costs directly associated with producing the goods or products that your business ultimately sells. COGS can be thought of as an expense category that includes all of your production costs while excluding the non-production costs associated with running your business.
If your company provides a service instead of selling a product, you would not calculate COGS but would instead use a metric like cost of revenue (COR) or cost of sales (COS), discussed more fully below.
COGS is an important financial KPI, as it offers a look into how your business spends money. You’ll need to know your COGS in order to accurately prepare an income statement, profit and loss statement (P&L), and other financial statements for your business.
What is included in COGS?
Any business expense that is directly associated with producing your company’s products or services should be included in your COGS calculation. This includes expense categories like:
- Material and component costs: Raw materials, parts, or components that you source from outside vendors or suppliers to manufacture your product
- Packaging costs: Packaging—like shrink wrap, cardboard, etc.—that you manufacture or purchase for your product, excluding packaging necessary for shipping
- Direct labor costs: Wages, salaries, benefits, and bonuses for workers involved in manufacturing or fabricating your product
- Utility costs: Electricity, water, gas, internet, etc. directly used in the manufacturing process
Importantly, COGS does not include operating expenses or SG&A (sales, general, and administrative) expenses. Likewise, it does not include costs associated with products that have been manufactured but which have not yet been sold. It is only when a product is actually sold that these expenses officially become COGS.
Cost of goods sold formula
To calculate cost of goods sold for your business, you can use the following formula:
COGS = (Beginning Inventory) + (Purchases) - (Ending Inventory)
In the equation above, beginning inventory reflects the total value of whatever inventory you carried over from the previous accounting period. This could be the prior year, quarter, or month, depending on how frequently you calculate COGS. Likewise, ending inventory reflects the total value of whatever inventory remains unsold at the end of the accounting period, which you will carry over into the next.
Purchases are any costs that your business incurred during the period to support the production of your goods. This should include the costs of materials, components, and wages for production staff.
COGS example
To illustrate this, consider a business that calculates its COGS on a quarterly basis.
At the end of Q1, the business had $50,000 worth of unsold inventory, which it carried over into Q2 as its beginning inventory. Over the course of Q2, the business made purchases equal to $100,000 to support production of new inventory. It then ended Q2 with $40,000 worth of inventory.
To find this business’s COGS, all you need to do is add together the beginning inventory with purchases made, and then subtract the ending inventory. In this case, that would look like:
COGS = $50,000 + $100,000 - $40,000 = $110,000
Inventory accounting methods for COGS
In order to properly calculate COGS for your business, you first need to establish a means for how you will account for and value your inventory. Some common inventory accounting methods include:
First in, first out (FIFO)
The first in, first out (FIFO) method assumes that any sales your business makes during a period will consist of the oldest inventory your business holds. If we assume that inventory costs rise over time (as they tend to do) this means that the oldest inventory was also the cheapest to produce, leading to a lower COGS than the other inventory methods discussed below. A lower COGS also translates into a higher net income for the period.
Last in, first out (LIFO)
The last in, last out (LIFO) method is the exact opposite of FIFO. It assumes that any sales your business makes during a period will consist of the newest inventory your business holds. Under the same pricing assumptions discussed above, where newer inventory costs more to produce than older inventory, LIFO will tend to result in a higher COGS than FIFO. This has an added effect of driving down your net income for the period.
Average cost method
With the average cost method, you will need to calculate the weighted average cost of all units in your inventory. You’ll then use this average to value the inventory sold during the period. This can help you stabilize your business’s COGS over time, from an accounting perspective, reducing the impact of single purchases.
Special identification method
If you know the exact units that your business sold during a period, you will in theory be able to determine the exact cost of that inventory as well. In this case, you might use the special identification method to find your inventory cost, resulting in a highly accurate COGS. This method tends to be used by businesses that sell bespoke or otherwise unique items, such as vehicles, real estate, and art or collectibles.
Other financial metrics to know
COGS is often discussed alongside other financial metrics, each of which communicate different information about your business’s expenses. These include:
Cost of revenue vs. cost of sales vs COGS
COGS only reflects the costs that are directly associated with producing the goods that your business sells. Cost of revenue (COR), on the other hand, is a broader category of expenses that includes everything included in COGS as well as other costs like:
- Inventory costs
- Distribution costs
- Marketing and advertising expenses
- Other direct costs like overhead
Cost of sales (COS) is another term that some businesses use instead of cost of revenue.
A company that provides a service but does not sell any physical goods would typically include either cost of revenue or cost of sales on their income statements instead of COGS.
Operating expenses vs. COGS
Operating expenses (OPEX) are the indirect costs your business incurs that aren’t directly tied to production. Examples of indirect costs include things like rent on your administrative offices or non-production facilities; utilities like electricity, water, gas, and internet service; office supplies; and salary, wages, and benefits for administrative staff. SG&A expenses also count as operating expenses or indirect costs on your income statement.
Get COGS right with Ramp
In order to accurately calculate COGS for your business, it’s essential that you be tracking your company’s expenses. Incomplete or inaccurate purchase history will compromise the calculation, turning COGS from a valuable metric into a potential liability.
Ramp’s all-in-one expense management platform—with procurement, AP, and reporting functionality—makes tracking production costs easier than ever, empowering you to accurately calculate your company’s COGS, SG&A, OPEX, or any other financial metric you need.
Try Ramp for free, or request a demo to get started.