Cost of Goods Sold (COGS): Formula & What It Includes
Every margin metric on this site, gross margin, contribution margin, EBITDA margin, ultimately traces back to one number: cost of goods sold. Our complete guide to gross margin covers what counts as COGS from the margin calculation’s point of view. This guide steps back further, to COGS itself: the accounting formula used to calculate it, why the same physical inventory can produce different COGS figures depending on the inventory valuation method, and how COGS composition differs across manufacturers, resellers, distributors, and service businesses.
What Is Cost of Goods Sold?
Cost of goods sold is the direct cost attributable to the goods a business sold during a given period. For a manufacturer, that generally includes direct materials, direct labor, and an appropriate share of manufacturing overhead. For a reseller or distributor, it generally means the cost of the inventory sold, including applicable costs incurred to acquire and prepare that inventory for sale. For a business selling only services, there is technically no COGS in the traditional inventory sense, although many service businesses track an equivalent line, often called cost of revenue, covering the direct labor, subcontractor costs, and materials associated with delivering the service.
COGS typically appears on the income statement below revenue, and subtracting it from revenue produces gross profit, which is used to calculate gross margin. Getting COGS right is not a bookkeeping formality. Gross margin depends directly on it, while other profitability metrics can also be affected by how costs are classified between COGS and operating expenses.
The COGS Formula
The standard periodic accounting formula for cost of goods sold is:
COGS = Beginning Inventory + Purchases − Ending Inventory
This is a different formula from the gross margin calculation, and it answers a different question. The gross margin formula uses COGS as an input, once it’s already known, to calculate a profitability percentage. The COGS formula calculates the cost assigned to the inventory that was sold during the period by starting with inventory on hand, adding inventory acquired during the period, and subtracting inventory that remains on hand at the end.
A worked example: a business starts the month with $1,000 worth of inventory (beginning inventory), purchases an additional $2,600 worth of inventory during the month, and ends the month with $2,000 worth of inventory still on hand (ending inventory). COGS for the month is $1,000 + $2,600 − $2,000 = $1,600. That $1,600 represents the cost assigned to the inventory sold during the period, whether those goods came from inventory on hand at the beginning of the month or from purchases made during the month.
For a manufacturer, the calculation is more involved because the inventory being produced includes raw materials, work in process, and finished goods. Manufacturing costs incurred during the period, including direct materials, direct labor, and allocated manufacturing overhead, are accumulated in production and ultimately flow into COGS when the finished goods are sold. The exact calculation depends on the manufacturer’s inventory accounting system and production process.
Why the Same Inventory Can Produce Three Different COGS Numbers
This is one of the more counterintuitive parts of COGS, and it explains why two businesses with identical physical inventory movement can report different COGS and different gross profit, without either one necessarily having an accounting error. The inventory valuation method used to assign costs to units sold and units remaining in inventory changes the resulting COGS figure, even when the physical units sold are exactly the same.

The same 150 units sold, three different COGS figures.
Consider a business with the following inventory activity: it starts with 100 units at $10 each, purchases 100 more units at $12 each, then purchases another 100 units at $14 each, for a total of 300 units available at a total cost of $3,600. During the period, it sells 150 units. Which costs are assigned to those 150 units depends on the inventory valuation method.
| Method | Which Costs Get Sold First | Resulting COGS | Ending Inventory |
|---|---|---|---|
| FIFO (First In, First Out) | Oldest costs first | $1,600 | $2,000 |
| LIFO (Last In, First Out) | Newest costs first | $2,000 | $1,600 |
| Weighted Average | Blended average cost | $1,800 | $1,800 |
Same 150 units physically sold, same $3,600 in total inventory cost, and three different COGS figures ranging from $1,600 to $2,000. Because gross profit equals revenue minus COGS, that difference flows directly into reported gross profit and, assuming revenue is unchanged, gross margin. FIFO assigns the oldest costs to units sold first, while LIFO assigns the newest costs first. When costs are rising, FIFO therefore generally produces lower COGS and higher gross profit than LIFO, while LIFO produces higher COGS and lower gross profit. Weighted average blends the available costs and generally falls between the two in this type of example.
One practical note: LIFO is permitted under US GAAP for companies that meet the applicable requirements, but it is not permitted under International Financial Reporting Standards (IFRS). A business operating internationally, or one comparing financial results prepared under different accounting frameworks, should therefore understand which inventory valuation method is being used before comparing COGS or gross margin figures.
What Belongs in COGS, By Business Type
Manufacturers generally include direct materials, direct labor associated with production, and manufacturing overhead allocated to inventory, such as factory utilities, depreciation on production equipment, and certain factory supervision costs. Corporate overhead, sales staff, and administrative expenses generally remain outside COGS and are recorded as operating expenses.
Resellers and distributors generally have a simpler COGS calculation: the cost of inventory sold, along with applicable costs necessary to acquire and prepare that inventory for sale. Freight-in and certain other acquisition costs can be included in inventory cost under applicable accounting rules. Since the business is not manufacturing the product, there is generally no direct production labor or manufacturing overhead component.
Service businesses typically don’t have COGS in the traditional inventory sense because they aren’t selling physical inventory. Many instead track an analogous “cost of revenue” or “cost of services” line covering direct labor, subcontractor costs, and materials directly associated with delivering the service. The terminology and classification can vary by industry and accounting policy.
Our gross margin guide covers the specific inclusion and exclusion rules in more depth, including how overhead, labor, freight, and marketing costs each get classified.
COGS vs. Operating Expenses: Where the Line Actually Falls
The dividing line between COGS and operating expenses (SG&A) is generally whether a cost is attributable to producing or acquiring the goods sold, versus a cost associated with running the business more broadly. Direct production labor is generally COGS. The sales team’s salary is an operating expense. Production-facility utilities can be part of manufacturing overhead and therefore COGS, while the corporate office’s utility bill is generally an operating expense. This distinction matters because COGS is deducted from revenue to arrive at gross profit, while operating expenses are deducted afterward in arriving at operating income. Misclassifying costs can therefore distort both gross margin and operating margin.
COGS and Taxes
For businesses that carry inventory, COGS generally represents the cost of inventory that is sold and is taken into account in determining taxable income, subject to applicable tax rules. In the United States, inventory-related COGS is reported differently depending on the business entity and tax return, with Form 1125-A used by certain corporations and other entities, while sole proprietors generally report inventory-related information on Schedule C. The specific rules around inventory valuation methods, capitalization of inventory costs, inventory accounting methods, and tax treatment can be complex and change over time. For tax reporting, it’s worth working with a tax professional or accountant rather than relying on a general guide like this one for anything beyond the basic concept.
Why Accurate COGS Is the Foundation of Margin Analysis
Every piece of margin analysis on this site assumes COGS is calculated consistently and accurately, and it’s worth being explicit about how much rides on that assumption. Gross margin is based directly on revenue and COGS, so an inflated or understated COGS figure directly distorts the resulting percentage, as covered in the gross margin guide. The gross margin calculator is only as accurate as the COGS figure entered into it. Contribution margin, covered in our contribution margin vs. gross margin guide, depends on correctly identifying which costs are variable and how those costs are classified. Pricing decisions built around margin instead of markup, covered in our guide to gross margin vs. markup, are only as reliable as the cost estimate the quote was built from. Benchmarking a shop’s performance against its peers, covered in our guide to good gross margin for a contract manufacturer, requires understanding whether COGS is being classified consistently across the businesses being compared. Rolling margin up by customer, covered in our guide to tracking gross margin by customer, requires allocating relevant costs accurately down to the job and customer level, not just looking at the company-wide total. And in an acquisition, covered in our guide to gross margin vs. EBITDA in M&A, inconsistent COGS classification across product lines, facilities, or reporting periods can complicate the buyer’s analysis of normalized profitability.
Getting COGS right, consistently, and at the appropriate level of detail is one of the highest-leverage accounting disciplines a manufacturer or distributor can build, because reliable COGS data gives management a much stronger foundation for analyzing gross margin, pricing, customer profitability, and operating performance.
Frequently Asked Questions
What is a good example of COGS?
For a furniture manufacturer, COGS could include the lumber and hardware used to make the furniture, the direct wages of production workers, and an allocated share of manufacturing overhead such as factory utilities and production-equipment depreciation. It would generally not include the showroom salesperson’s salary or the company’s marketing budget.
Is COGS the same as cost of sales?
The two terms are often used interchangeably, and in many businesses they refer to the same basic concept. Some businesses use “cost of sales” as a broader term that can include direct costs associated with delivering services, while reserving “COGS” for physical goods. The terminology varies by company and industry, so it’s worth checking how a specific business defines the line before comparing financial statements.
Does COGS include shipping?
Freight-in, meaning the cost of transporting inventory or materials to the business, is generally included in inventory cost when applicable under the relevant accounting rules. Freight-out, meaning the cost of shipping a product to a customer, is generally treated as a selling or distribution expense rather than part of inventory cost, although classification can vary depending on the circumstances and accounting framework. Consistency is important when comparing periods or businesses.
How do you calculate COGS for a service business?
Service businesses generally don’t have COGS in the traditional inventory sense. Many track an analogous cost of revenue or cost of services figure instead, covering direct labor, subcontractor costs, and materials directly associated with delivering the service. That figure can then be used to calculate a gross or service-delivery margin, depending on the company’s reporting approach.
Which inventory valuation method gives the lowest COGS?
During a period of rising costs, FIFO (First In, First Out) generally produces lower COGS than LIFO (Last In, First Out), because the older, lower-cost inventory is assigned to units sold first. LIFO generally produces higher COGS under the same conditions because newer, higher-cost inventory is assigned to units sold first. During a period of falling costs, the relationship generally reverses. The actual result can depend on the specific pattern of inventory purchases and the accounting method used.
Is COGS an expense on the income statement?
Yes. COGS is reported as an expense or cost on the income statement and is deducted from revenue to calculate gross profit. It represents the cost assigned to the goods sold during the period and is distinct from operating expenses, which are generally deducted further down the income statement.
The Bottom Line
Cost of goods sold looks like a simple accounting line until the details, which inventory method to use, what counts as a direct or indirect cost, and how consistently costs are tracked, start to matter. Because COGS directly affects gross profit and gross margin, getting the underlying calculation and classification right gives every downstream margin analysis a more reliable foundation.
If you’re not confident your own COGS is being tracked consistently at the job level, rather than just as a company-wide total, Quanzar’s free 10-minute margin audit is a fast way to identify potential gaps in your margin data.