Accounting2

Cost of Goods Sold (COGS): Formula, and Best Practices

Posted by Olivia Barnes-BrettLast Updated July 21st, 2026
— 11 minutes reading

Key takeaways

  • The cost of goods sold (COGS) formula is: COGS = (Beginning Inventory + Purchases) – Ending Inventory = Cost of Goods Sold.
  • COGS is essential for understanding the true cost of producing or purchasing goods and is a key metric to determine a business’s gross profit margin.
  • Beginning inventory refers to leftover inventory from the previous period, while purchases include all inventory bought or manufactured during the current period.
  • Ending inventory is what’s left unsold at the end of the period and is subtracted to avoid counting unsold goods in COGS.
  • Accurately calculating COGS helps businesses price products properly, manage inventory efficiently, and file taxes correctly.
  • Inventory software like inFlow can automatically track inventory levels and calculate COGS, reducing manual errors.

How much you spend on inventory has a huge impact on your business. Luckily, knowing the right accounting formulas makes managing your costs a lot easier. Today, we’re looking at cost of goods sold (COGS), why it’s important, and the simple COGS formula.

What is cost of goods sold?

In simple terms, cost of goods sold (COGS) refers to the cost of the inventory you’ve sold to customers. It’s what those products cost you, not the price your customer paid.

The exact costs included in COGS depend on your business. Retailers typically account for the cost of purchasing inventory, while manufacturers also need to include the direct costs of producing it. We’ll take a closer look at those differences below.

COGS vs cost of sales

Cost of goods sold is sometimes referred to as cost of sales. In most cases, the two terms mean the same thing and are used interchangeably in accounting and business.

Retail vs manufacturing COGS

For retailers, COGS generally includes the cost of purchasing inventory from suppliers, along with other direct costs such as shipping, customs duties, and similar expenses associated with getting products ready for sale.

Manufacturing businesses have a few additional costs to consider. Along with materials, COGS also includes direct labor and other production costs involved in making finished goods. If you’re a manufacturer, be sure to check out our article on cost of goods manufactured (COGM) for a more detailed breakdown.

Cost of goods sold formula

For retailers, calculating cost of goods sold is fairly straightforward. Take the cost of your beginning inventory, add any additional purchases made during the period, then subtract your ending inventory. The result is the cost of the inventory you sold during that period.

The basic COGS formula is:

Beginning Inventory + Purchases − Ending Inventory = Cost of Goods Sold

(Beginning Inventory + Purchases) - Ending Inventory = Cost of Goods Sold

Let’s take a closer look at each input of the formula.

Beginning inventory, purchases, and ending inventory

The most straightforward input in the cost of goods sold formula is beginning inventory, which is simply the value of the inventory you had on hand at the start of the accounting period.

Next are purchases, which are a bit more nuanced. They include both the direct and indirect costs of acquiring inventory. Depending on your business, this may include expenses such as shipping, customs duties, and other costs incurred before products are ready for sale.

If you’re a manufacturer, there’s another layer to consider. In addition to inventory purchases, you’ll also need to account for raw materials, direct labor, and other manufacturing costs. As a result, calculating COGS is often more involved than it is for retailers.

Finally, ending inventory is simply the value of the inventory you have left at the end of the accounting period.

Cost of goods sold formula example

Let’s say you start the month with $20,000 in inventory, make purchases totaling $8,000 during the month, and end with $5,000 in inventory.

Using the formula:

($20,000 + $8,000) − $5,000 = $23,000

In this example, your cost of goods sold for the month would be $23,000.

Common COGS calculation mistakes

One of the most common mistakes is forgetting to include all of the costs associated with purchasing or producing inventory. For retailers, purchases should include both direct and indirect costs. Manufacturers also need to account for raw materials, labor, and other manufacturing costs when calculating COGS.

Another common issue is using inaccurate beginning or ending inventory values. Since COGS depends on both numbers, inaccurate inventory records will lead to inaccurate calculations.

Inventory Costing Methods That Change COGS

The inventory costing method you choose can have a significant impact on your cost of goods sold. Different methods assign different costs to the inventory you sell, which means your COGS and profits can vary depending on the approach you use.

FIFO for COGS

First In, First Out (FIFO) assumes that the first items you buy or manufacture are also the first ones you sell. As a result, inventory is costed using the price of your earliest acquisitions. This is one of the most common costing methods, with over 50% of respondents in a recent survey reporting it as the method they use.

LIFO for COGS and the IFRS limitation

Last In, First Out (LIFO) works the opposite way. It assumes that the most recently purchased or manufactured items are sold first, so inventory is costed using the price of your latest acquisitions.

It’s important to note that LIFO is not permitted under International Financial Reporting Standards (IFRS), so businesses that report under IFRS cannot use this inventory valuation method.

Moving average cost for COGS

The moving average cost method calculates the average cost of your inventory each time you make a purchase. To do this, divide the total cost of the inventory you have on hand by the total number of units in stock. Every unit sold is then assigned that average cost until the next purchase changes the calculation.

Not sure which method is right for your business? Take a look at our inventory costing methods article for a more detailed comparison and practical examples.

Why COGS matters for profit, pricing, and taxes

There are several reasons why it’s important to calculate and understand your cost of goods sold. Beyond helping you track inventory costs, COGS is a key metric for measuring profitability, evaluating inventory performance, and preparing your financial records.

Gross profit and margin

To turn a profit, the amount you spend on inventory needs to be less than the amount you sell it for. Of course, there’s a bit more to it than that, but consider that the oversimplified version.

Calculating your cost of goods sold tells you how much your sold inventory cost during a given period. You can then subtract that figure from your revenue to calculate your gross profit, which in turn helps you measure your gross profit margin.

Understanding your COGS also makes it easier to evaluate your pricing. If your costs increase but your prices stay the same, your margins shrink. Monitoring COGS helps you spot those changes before they significantly affect profitability.

Revenue - Cost of goods sold (COGS) = Gross Profit

Inventory turnover

You can also use COGS to calculate your inventory turnover, which measures how quickly you sell and replenish your stock.

To calculate inventory turnover, divide your cost of goods sold by your average inventory value.

A low turnover ratio may indicate you’re selling slowly, carrying excess inventory, or both. A high turnover ratio generally means products are selling quickly, although it can also signal that you’re at risk of stockouts.

Tax and financial reporting

Aside from business insights, COGS is also an accounting expense. It reduces your taxable income, making it an important tax deduction for many businesses. It’s also a key figure in your financial statements, so accurately calculating COGS is essential for reliable reporting and recordkeeping.

How to reduce cost of goods sold without hurting margins

When looking to improve profits, it’s easy to focus on increasing sales. However, lowering your cost of goods sold can be just as effective in improving your profit margins.

The key to reducing any cost is transparency. You need to understand exactly what you’re paying, why you’re paying it, and where there may be opportunities to save. That way, you can make informed decisions that benefit your business over the long term.

Negotiate supplier pricing and terms

One way to reduce COGS is by working with your suppliers to negotiate better pricing or purchasing terms. However, lower prices aren’t always the best option.

For example, switching to a cheaper supplier might reduce your costs on paper, only to compromise product quality and hurt sales. Before making any changes, consider the impact on your customers as well as your bottom line.

Buy in bulk only when turnover supports it

Buying larger quantities may help you negotiate a better price per unit, reducing your overall COGS.

That said, only buy in bulk if your inventory turnover supports it. Otherwise, you could tie up cash in slow-moving inventory or run out of storage space before realizing the savings. Try to reach a happy medium and consider negotiating with suppliers if their minimum order quantities (MOQs) are too high.

Reduce freight, duties, and non-vendor costs

Your purchase price is only part of the equation. Shipping costs, customs duties, and other expenses associated with acquiring inventory also contribute to your cost of goods sold.

Reviewing these costs regularly can help you identify opportunities to reduce your overall inventory costs without changing suppliers or products.

Reduce waste without lowering quality

Cost reduction shouldn’t come at the expense of quality. Whether you’re evaluating suppliers or looking for operational efficiencies, it’s important to understand where your costs come from before making changes.

The goal isn’t simply to spend less. It’s to reduce unnecessary costs while continuing to deliver the products your customers expect.

7 Ways to Reduce Cost of Goods Sold:
1. Buy in bulk
2. Negotiate with suppliers
3. Find lower cost materials
4. Find alternative suppliers
5. Reduce waste
Stock what sells
Off-shore manufacturing

Why cost reduction should stay strategic

Successfully lowering your cost of goods sold can improve your profit margins, but the process doesn’t stop there. Keeping an eye on why you’re saving money and how those savings can be used will help you plan for the future.

As Deloitte explains, there are several reasons to strategically manage costs, including saving to:

  • Turn the business around.
  • Fund initiatives that create a competitive advantage.
  • Support growth while remaining scalable.
  • Improve business operations and digital transformation.

Ultimately, it’s all about finding the approach that works best for your business.

How inFlow calculates inventory cost and COGS

When an item enters your inventory through a purchase order or work order, inFlow automatically calculates its inventory cost using the factors below. (We’ve included the formulas so you can see how it works, but thankfully, inFlow does the math for you.)

Note: inFlow does not include any taxes on the purchase order in cost calculations.

When a purchase order includes more than one stocked product, inFlow distributes the freight, non-vendor, and service costs across those items. By default, it splits them proportionally to each item’s price, but you can change this in your costing options.

inFlow offers three split methods: proportional to price (the default), proportional to each product’s weight, or proportional to each product’s volume. Products missing weight or dimension data are treated as having zero weight or volume. The formulas below assume the default price-proportional method.

Vendor unit price

The vendor unit price is taken directly from the purchase order, including any discounts you’ve received.

To calculate the unit price manually, simply divide the product subtotal by the product quantity.

Freight allocation

When you enter shipping or freight charges on a purchase order, inFlow automatically distributes those costs across the stocked items on the order using the following formula:

Unit Price ÷ Sum of Stocked Products Subtotal × Freight Total = Freight Cost (per unit)

Non-vendor landed costs

If you incur costs such as import fees, duties, or tariffs that are paid to someone other than your vendor, you can record them as non-vendor costs.

inFlow distributes these costs across the applicable inventory using the following formula:

Unit Price ÷ Sum of Stocked Products Subtotal × (Non-vendor Cost % × Order Subtotal) = Non-vendor Cost (per unit)

You can also add non-vendor costs as a flat dollar amount, in which case inFlow uses a simpler formula:

(Unit Price ÷ Sum of Stocked Products Subtotal × Non-vendor Cost ($))

If you don't like working with numbers, inFlow does the math for you!

Service-item allocation

Sometimes you’ll pay your vendor for additional services, such as engraving. These charges can be added to the purchase order as a service-type item.

The service cost is then allocated across all stocked items on the purchase order. If only certain products should include that service fee, you may want to create separate purchase orders.

Unit Price ÷ Sum of Stocked Products Subtotal × Service Total = Service Cost (per unit)

Work-order component costs

If you’re using work orders (available on select plans), the cost of component items is also included when calculating inventory costs.

Final thoughts

Understanding your cost of goods sold is about more than filling out financial statements. It helps you measure profitability, set smarter prices, manage inventory more effectively, and make better purchasing decisions.

While the math behind COGS can seem intimidating at first, it becomes much easier when you have accurate inventory records and the right software to do the heavy lifting. With inFlow, all of these calculations happen automatically, so you can spend less time on spreadsheets and more time running your business.

Try inFlow for free
No credit card required. Sign up now!