COGS formula: calculate cost of goods sold step by step
Learn the COGS formula to see real profit, price with confidence, and control costs.

Written by Lena Hanna—Trusted CPA Guidance on Accounting and Tax. Read Lena's full bio
Published Friday 20 February 2026
Table of contents
Key takeaways
- Apply the correct COGS formula for your business type: use "Beginning inventory + Purchases - Ending inventory = COGS" for retail businesses, or "Direct materials + Direct labour + Manufacturing overhead = COGS" for manufacturers.
- Include only direct costs tied to producing or purchasing your products in COGS calculations, such as raw materials and production labour, while excluding indirect expenses like office rent, marketing, and administrative salaries.
- Use COGS data to set your pricing floor and make strategic decisions about inventory management, as lower COGS directly increases your gross profit margin and helps identify slow-moving stock.
- Choose a consistent inventory valuation method like FIFO, average cost, or specific identification to ensure accurate COGS calculations, and track these costs regularly to maximise tax deductions and improve profitability.
What is COGS?
Cost of goods sold (COGS) is the direct cost to produce or purchase the goods you sell. Its calculation is governed by official accounting standards, such as when the International Accounting Standards Board adopted IAS 2 Inventories to provide guidance. COGS represents the expenses tied directly to creating your products, not the costs of running your business.
What to include in COGS
COGS includes costs directly tied to producing or purchasing the goods you sell:
- direct materials: raw materials and components used in production
- direct labour: wages for workers who make or assemble products
- manufacturing overheads: factory utilities, equipment maintenance, and production supplies
Depending on your business, you may also include:
- freight costs: shipping for incoming materials or outgoing products
- storage costs: warehousing and inventory holding expenses
- transaction fees: payment processing costs directly tied to sales
Some businesses, like ecommerce businesses, also include freight, storage, sales commissions, or transaction fees when these costs relate directly to selling products.
What not to include in COGS
COGS excludes indirect costs that support your business but aren't tied to specific products:
- rent: office or retail space costs (unless exclusively for production)
- marketing and advertising: promotional expenses
- administrative salaries: wages for management, HR, or accounting staff
- general overhead: utilities for non-production spaces, office supplies
- sales team salaries: compensation for salespeople (though commissions may be included)
- depreciation: equipment depreciation is typically an operating expense
When in doubt, ask: "Does this cost exist only because I made or purchased this specific product?" If yes, it's likely COGS. If no, it's probably an operating expense.
COGS formula
There are two main COGS formulas, one for retailers and one for manufacturers.
Retail COGS formula: Beginning inventory + Purchases − Ending inventory = COGS
Manufacturing COGS formula: Raw materials + Manufacturing costs + Storage costs + Freight = COGS
The formula you use depends on your business model. Here's how each works.
Cost of goods sold formula used by retailers for inventory accounting.
The retail formula is simpler because it focuses on inventory values rather than production costs.
Retail COGS formula
Cost of goods sold formula used by retailers for inventory accounting.
If you run a retail or ecommerce business, you can calculate COGS by focusing on your inventory changes over a period.
(Beginning Inventory + Purchases) - Ending Inventory = COGS
How to calculate retail COGS:
- Find your beginning inventory: Record the total value of inventory at the start of your accounting period.
- Add purchases: Include all inventory costs acquired during the period.
- Subtract ending inventory: Deduct the value of inventory remaining at the end of the period.
The result is your COGS for that period.
This formula focuses on inventory values rather than sales numbers, which helps account for discarded or damaged stock.
Manufacturers have more complex supply chains. It makes sense for them to add up all the costs on their product's journey to the customer. Some choose not to count warehousing or freight.
Manufacturing COGS formula
Manufacturers have more complex supply chains. It makes sense for them to add up all the costs on their product’s journey to the customer. Be aware that some choose not to count warehousing or freight.
If you manufacture your own goods, your formula adds up the direct costs of production.
Direct Materials + Direct Labour + Manufacturing Overhead = COGS
How to calculate manufacturing COGS:
- Calculate raw materials cost: Add up the direct materials used to produce goods.
- Add manufacturing costs: Include labour, energy, and other production expenses.
- Add storage costs: Factor in warehousing and inventory holding expenses.
- Add freight costs: Include shipping for incoming materials and outgoing deliveries.
The total gives you your manufacturing COGS. Some manufacturers choose not to include warehousing or freight, so check with your accountant for what applies to your business.
If you use accounting software like Xero, you can find COGS in the profit and loss (P&L)/income parts of your financial statements.
How to calculate COGS
Once you have the right formula, calculating your COGS is a straightforward process. Follow these steps to get an accurate figure.
How to calculate retail COGS
- Determine your starting inventory value. This is the total value of your inventory at the beginning of your accounting period. It should be the same as your ending inventory from the previous period.
- Add the cost of purchases. Tally up the cost of all inventory you purchased during the period. Include any costs like shipping or freight to get the items to you.
- Determine your ending inventory value. At the end of the period, calculate the total value of the inventory you still have on hand.
- Apply the formula. Add your beginning inventory to your purchases, then subtract your ending inventory. The result is your COGS for the period.
How to calculate manufacturing COGS
- Calculate the cost of direct materials. Add up the total cost of all raw materials used in production during the period.
- Calculate direct labour costs. Sum the wages and benefits paid to employees directly involved in manufacturing your products.
- Add manufacturing overhead. Include all other direct costs of production, such as factory rent, utilities, and equipment depreciation.
- Sum the totals. Add your direct materials, direct labour, and manufacturing overhead costs together to find your COGS.
Examples of COGS
Retail example: A retail business starts the quarter with $10,000 of inventory, purchases $25,000 during the quarter, and ends with $8,000 remaining.
$10,000 + $25,000 − $8,000 = $27,000 COGS
Manufacturing example: A manufacturer spends $7,000 on raw materials, $3,000 on energy and labour, and $1,200 on shipping.
$7,000 + $3,000 + $1,200 = $11,200 COGS
COGS and different business models
Your business model determines which costs count as COGS and which formula to use. Here's how different businesses approach it:
- Manufacturers tend to include certain indirect costs like material handling
- Retailers typically calculate COGS using beginning and ending inventory values
- Service businesses often include direct labour costs as their primary COGS component
Why COGS is important for small businesses
COGS directly affects your profitability and pricing decisions. Knowing your true cost to serve customers helps you set competitive prices while maintaining healthy margins.
Materials and labour costs are typically straightforward to calculate. Other costs can be more challenging for new business owners.
For example, small business owners who use their home as a production facility may enjoy good margins initially. However, COGS will increase when they upgrade to dedicated manufacturing or warehousing premises.
Monitoring COGS helps you identify and address the factors that put pressure on your profit margins. Here's how COGS supports better business decisions.
Understanding how COGS affects different aspects of your business helps you make strategic decisions.
Pricing
COGS sets your pricing floor. It establishes the baseline cost you must exceed to make a profit. Understanding your COGS helps you judge how cost fluctuations affect expenses and when to adjust prices.
Profitability
Lower COGS means higher gross profit. Reducing your cost of goods sold while maintaining prices directly increases your gross profit margin. Even small COGS improvements can significantly affect your bottom line.
Inventory management
COGS analysis reveals inventory efficiency. Tracking your costs helps you identify slow-moving items and assess stock performance.
Use these insights to optimise stock levels, reorder points, and product mix. This balances demand while reducing capital tied up in unsold goods.
Taxes
COGS is a tax-deductible business expense. Tracking and documenting all COGS components helps you maximise deductions and prepare for audits, although some tax authorities provide exceptions to the rules for smaller businesses.
Check with your local tax authority for specific rules on COGS deductions in your region.
Strategic decision-making
COGS data supports smarter business decisions. Accurate cost tracking provides context for strategic financial analysis.
Use COGS insights to evaluate:
- investing in new product lines
- automating production processes
- changing distribution methods
COGS accounting methods
Your inventory valuation method directly affects your COGS calculation. Different methods assign different costs to sold items versus remaining inventory.
As you sell inventory, its value transfers from your balance sheet to your income statement as COGS. According to accounting standards, the inventory's carrying amount becomes an expense in the same period that revenue is recognised. The method you choose determines which specific costs get assigned.
Different accounting methods suit different business types and economic conditions.
FIFO (first in, first out) method
FIFO (first in, first out) assumes the oldest inventory items sell first. This method often matches the physical flow of goods through your business.
When prices are rising, FIFO typically results in lower COGS and higher reported profits. It's commonly used by businesses selling perishable goods or products with expiration dates.
LIFO (last in, first out) method
LIFO (last in, first out) assumes the most recently acquired inventory sells first. During inflation, LIFO typically results in higher COGS and lower reported profits.
Important: LIFO is not permitted under International Financial Reporting Standards (IFRS). The International Accounting Standards Board (IASB) prohibits LIFO because of its potential to misrepresent inventory flows, and it is disallowed in many countries outside the United States. Check whether LIFO is allowed in your region before using this method.
Average cost method
Average cost method uses the weighted average of all inventory costs to value both COGS and ending inventory. This approach smooths out price fluctuations over time.
The average cost method works well for businesses with large quantities of similar items where tracking individual costs isn't practical.
Specific identification method
Specific identification method tracks the actual cost of each individual inventory item. This approach provides the most accurate COGS but requires detailed record-keeping.
Use this method for high-value or unique items like vehicles, artwork, or custom-built products. It's impractical for businesses with large quantities of similar items.
Tips for managing and reducing COGS
Reducing COGS while maintaining quality can significantly improve your profit margins. Here are practical strategies to help you manage and lower your costs.
Negotiate with suppliers
Negotiate with suppliers regularly to secure better prices on materials and goods.
Consider these approaches:
- request volume discounts for bulk purchases
- negotiate long-term contracts for price stability
- compare rates from multiple suppliers
Streamline production processes
Analyse your production workflow to identify inefficiencies and reduce waste.
Automation can decrease labour costs and increase output consistency. Before investing, assess how changes will affect both your COGS and overall return on investment.
Optimise inventory levels
Use data analytics to forecast demand and maintain optimal inventory levels.
Review your product mix regularly. Consider discontinuing slow-moving items that tie up capital without generating returns.
Reduce freight costs
Explore alternative shipping methods that balance cost and delivery time.
Ways to reduce freight costs:
- consolidate shipments to access bulk rates
- negotiate volume discounts with carriers
- consider third-party logistics providers for better rates
Simplify COGS tracking with Xero
Managing COGS doesn't have to be complicated. Xero accounting software helps you track costs, manage inventory, and generate reports that show exactly where your money goes.
With Xero, you can:
- access real-time COGS reporting and analytics
- manage expenses and inventory in one place
- find COGS in your P&L and income statements automatically
Accurate COGS tracking helps you set better prices, boost profit margins, and make confident business decisions.
Ready to simplify your financial management? Get one month free and see how Xero can help your business grow.
Need expert guidance? Find a bookkeeper or accountant through Xero Advisors.
FAQs on COGS
Common questions about calculating and managing cost of goods sold.
What's the difference between COGS and operating expenses?
COGS covers direct costs of creating or purchasing products you sell. Operating expenses cover indirect costs of running your business, like rent, marketing, and administrative staff salaries.
The key difference: COGS ties directly to specific products, while operating expenses support overall business operations.
What is the difference between cost of goods sold and cost of sales?
These terms are often used interchangeably, but there's a subtle difference.
COGS focuses on direct costs of creating or purchasing products. Cost of sales may include COGS plus additional revenue-related expenses like transaction fees, sales commissions, or customer acquisition costs.
Service and digital businesses are more likely to use "cost of sales" to capture these broader expenses.
How often should I calculate COGS?
Most businesses calculate COGS at the end of each accounting period: monthly, quarterly, or annually.
Calculate more frequently if you have high inventory turnover or need real-time profitability insights. Talk to your accountant for advice tailored to your business.
My business is service-based. Do I still have COGS?
Yes, service businesses have costs equivalent to COGS, often called "cost of services" or "cost of revenue."
For service businesses, this typically includes:
- direct labour costs for delivering services
- software subscriptions used in service delivery
- materials or supplies consumed per project
Are salaries included in COGS?
It depends on the type of salary. Direct labour costs for workers who produce goods or deliver services are typically included in COGS.
Indirect salaries for administrative staff, management, or sales teams are usually classified as operating expenses, not COGS.
How does COGS affect my gross profit margin?
COGS directly determines your gross profit margin. The formula is: (Revenue − COGS) ÷ Revenue = Gross profit margin.
Lower COGS means higher gross profit margin. For example, if you sell $100,000 worth of products with $60,000 in COGS, your gross profit margin is 40%. Reducing COGS to $50,000 increases your margin to 50%.
What are common COGS calculation mistakes?
The most common COGS mistakes include:
- including indirect costs: adding rent, marketing, or administrative salaries that belong in operating expenses
- inconsistent inventory counts: using different methods to value beginning and ending inventory
- missing freight or storage costs: forgetting to include shipping and warehousing when they apply to your business
- mixing accounting methods: switching between FIFO, LIFO, or average cost mid-year, as accounting standards require the chosen formula to be consistently applied to all inventories of a similar nature
Consistent tracking and accounting software help prevent these errors.
Disclaimer
Xero does not provide accounting, tax, business or legal advice. This guide has been provided for information purposes only. You should consult your own professional advisors for advice directly relating to your business or before taking action in relation to any of the content provided.
Start using Xero for free
Access Xero features for 30 days, then decide which plan best suits your business.