Cost of goods sold (COGS) is an acronym you might see on your business’ balance sheet or financial statements. The metric is important—it ensures profitability and helps you accurately report business expenses to the government correctly.
However, considering that many small business owners lack enough knowledge about accounting and finance, it's a good idea to understand how COGS can impact sales and tax liability.
While the COGS formula might look technical initially, 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 is the cost of goods sold?
Cost of goods sold (COGS) is the direct cost of producing products that your business sells. Also referred to as “cost of sales”, COGS includes the cost of materials and labor directly related to the production of retail products.
- COGS differs from operating expenses, which include costs like rent, utilities, and marketing, and from cost of revenue, which includes order fulfillment and payment processing.
- Retailers use different methods to calculate inventory costs, including FIFO (first-in, first-out), LIFO (last-in, first-out), and weighted average cost. These impact profitability and tax liability.
- Tracking COGS helps businesses set competitive pricing, manage inventory efficiently, and reduce taxable income by deducting production-related expenses.
What is the cost of goods sold formula?
The cost of goods sold formula is: (Beginning inventory + purchases) — ending inventory.

What’s included in the cost of goods sold calculation?
The cost of goods sold is essentially the wholesale price of each item, which includes the direct labor costs incurred to produce each product.
This includes the costs of:
- All parts used to build or assemble the products
- Raw materials needed for the products
- Items purchased for resale and/or to create the product
- Parts or machines required to create the product
- Supplies required in the production of the product
- The people who put the products together and ship the parts
- Shipping parts and equipment to the warehouse to create the product, including containers, freight, and fuel surcharges
COGS vs. operating expenses
Operating expenses and cost of goods sold are two different types of business expenses that occur in your daily business operations. They’re both subtracted from your business’s total sales figures, yet they’re recorded as separate line items on your income statement.
Operating costs 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
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, the COGS formula 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.
Cost of revenue vs. COGS
Cost of revenue includes all costs directly tied to generating sales, including COGS plus additional expenses such as:
- Order fulfillment and shipping to customers
- Payment processing fees
- Customer service and support expenses
- Website hosting and transaction platform fees
For example, a skincare brand must purchase raw ingredients, manufacture products, and package them—these variable costs are included in COGS. However, the cost of maintaining a retail store, processing payments, and fulfilling orders is included in the cost of revenue.
Cost of sales vs. COGS
Cost of sales and COGS are often used interchangeably, but they have key differences depending on the type of business. Both reflect the expenses incurred in delivering a product or service, but they’re categorized differently.
Cost of sales is a broader term that applies to both product-based and service-based businesses. In addition to COGS, it may include:
- Salaries for service providers or consultants
- Software licensing fees
- Customer onboarding and training costs
- Costs associated with delivering a service
For example, a boutique selling handmade jewelry includes raw materials and labor costs in COGS. Meanwhile, its cost of sales includes employee salaries, software subscriptions, and project management tools required to create and deliver products.
How to calculate cost of goods sold
- Determine direct costs vs. indirect costs
- Choose an inventory valuation method
- Calculate beginning inventory and cost of purchases
- Calculate ending inventory
- Apply the COGS formula
1. Determine direct costs vs. indirect costs
Direct costs are all sales costs directly associated with the product itself. This includes:
- Raw material costs or items for resale
- Inventory costs for 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 expenses 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 expenses and 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 annually.
2. Choose an inventory valuation method
Whoever prepares your taxes should advise you on what inventory accounting method you should use for your business. The most popular inventory valuation methods are:
FIFO method
First in, first out (FIFO) is when assets produced or purchased first are sold first. This method is best for perishables and products with a short shelf life. When prices rise, higher-cost goods are sold first, and the closing inventory is higher. This results in higher net income over time. When prices are decreasing, the opposite is true.
LIFO method
The last in, first out (LIFO) method assumes the goods you purchased or produced last are the first items you sold. When prices rise, goods with higher costs are sold first, and the closing inventory is lower. This results in a decreasing net income. During times of inflation, LIFO leads to a higher reported COGS on your financial statements and lower taxable income.
Weighed average cost method
In the weighted average cost 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. To find the weighted average cost COGS, multiply the units sold by the average cost.
3. Calculate 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. Total of all the products purchased during the fiscal year that are available to sell, including raw materials, minus anything taken for personal use.
Beginning 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. This should match the ending inventory for the previous fiscal year.
Further, whatever items and inventory are purchased throughout the year that don't fall under the beginning or ending inventory must also be accounted for. These are the cost of purchases and include all items, shipments, manufacturing, etc. As with your taxes, you must keep all paperwork showing these items were purchased during the correct fiscal year.
4. Calculate ending inventory
At the end of the year, take stock of all the remaining inventory—this means all products that remain and have not been sold. This information will be used in the current COGS calculation and will also be required for the following year's calculations.
All ending inventory can be categorized as one of the following:
- Resale ready
- Damaged (requires the estimated value of the items damaged)
- Worthless products (evidence of destruction must be provided)
- Obsolete items (evidence of devaluation needed). These products can be donated to charities for a little extra goodwill.
5. Apply the COGS formula
Once you’ve calculated your inventory at the start and end of your reporting period, here is the accepted COGS formula used by accountants:
(Beginning Inventory + Purchases) – Ending Inventory = COGS.
💡 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.
Cost of goods sold example
Here’s a COGS example to demonstrate the calculation: Your company has the following information for recording the inventory for the calendar year ending on December 31, 2023. Your inventory at the beginning of the year is $20,000. At the end of the year, your ending inventory is $6,000. During the year, your company made $8,000 worth of purchases throughout the reporting period.
You can calculate COGS using the formula above: ($20,000 + $8,000) - $6,000, making your COGS $22,000.
The importance of the COGS calculation
Determine profitability
The COGS calculation helps you determine the gross profit you make on each sale, understand which products are most profitable, and help you set the best price. This ultimately helps you make smarter inventory decisions that reduce carrying costs, prevent obsolete inventory, and maximize space.
Optimize inventory
With an efficient inventory management system, you can reduce storage costs and minimize waste, reducing COGS. This can assist with purchasing, stocking, and production decisions—all of which are easier when you use the same platform for everywhere you sell: retail, ecommerce, and B2B included.
Shopify is the only solution on the market that delivers true and effective unified commerce for retailers by natively unifying ecommerce and POS channels on one centralized platform.
Research from a recent EY report concluded that this unified approach:
- Overall sales improve by 8.9% on average
- Total cost of ownership is 22% lower compared to other systems
- Has a 20% faster implementation time
Retailers like Bared Footwear experienced these challenges first-hand with its previous operating stack. It relied on Lightspeed for POS transactions, but its COO Alexandra McNab says: “Our online store was selling orders faster than the API could sync with Lightspeed, which also functioned as our inventory management system. Because of this, Lightspeed couldn’t present accurate inventory availability, which meant we risked overselling items if our stores wanted to continue transacting normally during an online sale.”
Since migrating to Shopify to unify its inventory data across online and offline channels, Bared Footwear can now implement new fulfillment workflows to better serve customers and manage inventory.
“With Shopify, we have a unified commerce platform that makes the holistic experience we want to offer customers possible without burdening our team with clunky workarounds or high-risk situations,” Alexandra says.
Track expenses
A product requires materials and parts. Not to mention the fixed costs: the labor, factory overhead, rent, equipment, electricity to run the operations, employees to sell said products in your store, as well as sales, marketing, and finance.
These are all expenses that contribute to the end cost of the product—expenses you need to keep track of to ensure that you are making a healthy gross profit and that you can accurately price products and keep healthy margins.
Manage tax liability
The IRS allows you to deduct the cost of goods used to make or purchase the goods you sell in your business.
By calculating all business expenses, including COGS, the company ensures they are offsetting them against total revenue come tax season. This means the business will only pay taxes on net income, thereby decreasing the total amount of taxes owed when it comes time to pay taxes.
Bear in mind that 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 to increase profits.
Limitations of the COGS formula
While the COGS formula helps calculate direct costs and assess profitability, it also comes with some limitations:
- Incomplete. The COGS formula only includes direct costs, such as materials and labor, but excludes indirect costs like marketing, administrative expenses, and overhead, which can impact overall profitability.
- Varying approaches. Different inventory valuation methods can lead to varying COGS results, affecting reported profits and tax liabilities. Choosing the wrong method can distort financial analysis.
- Fluctuating costs and inflation. Rising material and labor costs can impact the accuracy of COGS calculations, especially if a business does not frequently update its inventory valuation or cost tracking methods.
- Not real-time. COGS is typically calculated over a specific period, meaning it may not capture real-time fluctuations in production costs, potentially leading to outdated or misleading financial insights.
To overcome these limitations, retailers should regularly review their accounting methods, track both direct and indirect costs, and consult with financial professionals to ensure accurate financial reporting.
Use the COGS formula 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 improve your small business, not just by taking the headache out of tax preparation and COGS formulas, but by providing financial advice that improves your bottom line.
Read more
- Cash on Delivery: How To Guide for Retail Businesses
- Discount Strategy in Retail: How to Offer Discounts & Markdowns Without Slashing Profits
- How to Calculate the Value of Your Inventory
- Retail Metrics: 16 Key Metrics for Your Store
- ABC Analysis: How to Analyze Product & Inventory (2024)
- Penetration Pricing Strategy: Definition, Advantages, and Examples
- How LIVELY's Omnichannel Approach Increased Average Order Value by 80%
- A Guide To The Detection and Prevention of Vendor Fraud
- How To Grow Your Business: A Guide to Expanding Retail Operations Profitably
- Vision Board for Business: Use This Creative Tool to Accomplish Your New Year’s Resolutions
Cost of goods sold FAQ
Is COGS the same as purchase price?
No, COGS is not the same as the purchase price. The purchase price refers to the cost of acquiring a product or raw materials, while COGS includes all direct costs associated with producing and selling the product, such as labor, raw materials, and manufacturing expenses.
What is another name for the cost of goods sold?
COGS is sometimes referred to as the cost of sales or cost of revenue, depending on the business type and financial reporting terminology. However, cost of revenue and cost of sales both include additional line items that COGS does not.
What is the formula for COGS?
The cost of goods sold formula is: (Beginning inventory + purchases) — ending inventory. This formula helps businesses determine the total cost of goods sold during a specific period.
What is the difference between cost of sales and COGS?
Cost of sales is a broader term than COGS—it includes both product and service-related expenses. COGS specifically refers to the direct costs of producing physical goods, whereas cost of sales may include additional expenses like service delivery, consulting fees, and software licensing.
What is the rule of COGS?
The rule of COGS dictates that only direct costs related to the production or purchase of goods can be included in the calculation. This means expenses such as rent, marketing, and administrative costs should not be factored into COGS.
What should be included in the cost of goods sold?
COGS should include both direct and indirect costs, such as:
- Raw materials
- Packaging
- Shipping
- Direct labor (workers assembling or manufacturing the product)
- Depreciation of machinery and equipment used in production