
Cost of goods sold (COGS) is more than an accounting term—it’s a critical metric that directly measures your business’s production costs and impacts your profitability. Understanding and calculating it correctly is essential for smart pricing, efficient inventory management, and accurate tax reporting.
While the COGS formula might look technical and intimidating, this guide will walk you through what’s included in COGS, how to calculate it, and different ways to help prepare for tax season.
Cost of goods sold 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.
The cost of goods sold formula is:
(Beginning inventory + purchases) – ending inventory = COGS

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:
Operating expenses (OpEx) and COGS are both subtracted from revenue, but they tell different stories about your company’s performance.
Here’s how to distinguish them:
This distinction is crucial on your income statement. Revenue minus COGS gives you your gross profit, which shows how efficiently you produce and price your goods.
First calculate gross profit, then subtract OpEx to find your operating profit, which reflects the business’s overall profitability from its core operations.
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 includes all costs directly tied to generating sales, including COGS plus additional expenses such as:
Unlike COGS, cost of revenue is used by businesses whose offerings extend beyond physical products. For example, a software-as-a-service (SaaS) company doesn’t have goods, so its cost of revenue includes server hosting costs, data center expenses, and salaries for front-line customer support staff needed to keep the service running.
Direct costs are all sales costs directly associated with the product itself. This includes:
Indirect expenses include:
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.
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:
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, FIFO results in a lower COGS (since you’re selling older stock first) which increases your net income. When prices are decreasing, the opposite is true: COGS is higher, and net income is lower.
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.
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.
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.
As with your taxes, you must keep all paperwork showing these items were purchased during the correct fiscal year.
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:
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.
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 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 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 helps you make smarter inventory decisions that reduce carrying costs, prevent obsolete inventory, and maximize space.
With an efficient inventory management system, you can reduce storage costs and lower your days in inventory, 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.
Knowing your COGS per unit is the first step in setting your pricing strategy. It tells you the bare minimum you should charge to break even on a sale.
Getting pricing right has a massive effect on your bottom line. Even tiny price changes can lead to big profit gains. A 2024 NIQ report found that a 1% price increase can boost margins by around 11%, provided the same number of items are sold.
But costs are only half of the picture. You also have to consider what customers are actually willing to pay. This is where price elasticity comes in. It helps you figure out how much your sales might drop if you raise the price, or increase if you lower it.
So, while your COGS sets your price floor, price elasticity helps you find the ceiling. Your best, most profitable price is usually somewhere in between.
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 net profit margin.
Your COGS is a huge factor in how much profit your business makes. While these strategies focus on direct costs, a holistic approach to profitability should also aim to reduce overhead wherever possible. Lowering your COGS is a great place to start.
Excess or disorganized inventory ties up money that could be working for your business. The right data-driven tools help you free up that cash.
For example, with the Stocky app (which comes with Shopify POS Pro), you can use sales data and purchase suggestions to order the right amount of stock and avoid overpurchasing.
Within the Shopify Admin, you can also:
Retailers like Bared Footwear experienced inventory challenges firsthand with their previous operating stack. They relied on Lightspeed for POS transactions, but 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 inventory data across online and offline channels, Bared Footwear can now implement new fulfillment workflows to better serve customers.
“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.
Suppliers are partners, and there is usually room to create more value for both sides. Start by consolidating your supplier base. A classic study by McKinsey found that consolidating suppliers and standardizing terms can capture an estimated 2%–5% in purchase price savings, while also improving administrative efficiencies.
Supplier views show you how much you’re spending with each supplier, which is information you can use to ask for better prices on bulk orders. With Shopify Bill Pay, you can schedule payments to your suppliers right from your admin. This helps you manage your cash flow by deciding exactly when money goes out.
Businesses that invest in smart manufacturing initiatives report up to a 20% improvement in production output and a 20% increase in workforce productivity. This reduces your unit COGS and can unlock around 15% in additional capacity.
Sync production with sales in real time. Integrate a manufacturing resource planning (MRP) app like Katana with Shopify to automatically sync sales orders, bills of materials (BOMs), and materials planning. A seamless connection helps trigger replenishment orders, route expectations, and keeps inventory data perfectly unified across every sales channel.
Every bit of scrapped material or inefficient process increases your COGS. Identifying exactly where waste occurs is the first step to reducing it. Apps like Katana can track how much material is wasted or scrapped during production for each item on your BOM.
💡 Pro tip: Use Shopify’s real-time inventory features like multi-location tracking and demand forecasting recommendations from Stocky to avoid ordering excess stock that risks becoming a write-off.
While the COGS formula helps calculate direct costs and assess profitability, it also comes with some limitations:
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.
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 business, not just by taking the headache out of tax preparation and COGS formulas, but by providing financial advice that improves your bottom line.
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.
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.
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.
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.
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.
COGS should include both direct and indirect costs, such as: