Skip to main content
Business Finance

Cost of Goods Sold Formula (COGS): Examples and What Counts

Learn the cost of goods sold formula with worked examples, what counts as COGS for product and service businesses, inventory methods and how COGS affects tax.

By Invoice Creator Editorial Team 8 min read

Quick answer: The cost of goods sold formula is beginning inventory + purchases − ending inventory = COGS. It measures the direct cost of the products you sold during a period: inventory, materials, direct labor and freight-in. Subtract COGS from revenue to get gross profit. Overhead such as rent and marketing is not included.

If you sell physical products, cost of goods sold is usually your single biggest expense, and it decides whether your prices actually make money. It also affects your tax bill, because it reduces gross income. This guide explains the cost of goods sold formula, works through examples for a retailer, a maker and a service business, compares inventory methods, and covers the mistakes that most often throw COGS off.

What is cost of goods sold (COGS)?

Cost of goods sold, sometimes called cost of sales or cost of revenue, is the direct cost of the goods a business sold in a period. It appears on the profit and loss statement directly below revenue, and revenue minus COGS equals gross profit.

The key word is sold. If you buy 500 units this month and sell 300, only the cost of the 300 belongs in COGS for the month. The other 200 stay on the balance sheet as inventory, an asset, until they are sold.

The cost of goods sold formula

COGS = Beginning inventory + Purchases (and other direct costs) − Ending inventory

  • Beginning inventory: the value of stock on hand at the start of the period, which is last period's ending inventory.
  • Purchases: the cost of goods or materials bought during the period, plus direct costs such as freight-in and, for manufacturers, direct labor and certain production overhead.
  • Ending inventory: the value of stock still on hand at the end of the period, based on a physical count or a reliable inventory system.

Related formulas you will use alongside it:

  • Gross profit = Net revenue − COGS
  • Gross margin = Gross profit ÷ Net revenue
  • COGS percentage = COGS ÷ Net revenue

What counts as COGS and what does not

Usually included in COGSUsually not included (operating expenses)
Products bought for resaleOffice or retail rent (unless production space allocated by an accountant)
Raw materials and partsMarketing and advertising
Direct labor of production employeesSales and admin staff wages
Freight-in and import duties on stockOutbound shipping to customers (often a selling expense)
Packaging that is part of the productGeneral software and subscriptions
Production supplies and some factory overheadAccounting, legal and insurance
Subcontracted production workInterest and bank fees

Some lines vary by business and by accounting approach, especially outbound shipping, payment processing fees and production overhead. The rule that matters most is consistency: decide once, write it down, and apply it every period so your gross profit vs net profit comparisons mean something.

Worked example 1: a retail shop

An illustrative gift shop has these figures for a quarter:

ItemAmount
Beginning inventory (January 1)$15,000
Purchases from suppliers$40,000
Freight-in on those purchases$2,000
Ending inventory (March 31, counted)$18,000
Net sales for the quarter$75,000
  • Goods available for sale: $15,000 + $40,000 + $2,000 = $57,000.
  • COGS: $57,000 − $18,000 = $39,000.
  • Gross profit: $75,000 − $39,000 = $36,000.
  • Gross margin: $36,000 ÷ $75,000 = 48%. COGS percentage: $39,000 ÷ $75,000 = 52%.

Now see why the count matters. If the owner miscounted and recorded ending inventory as $21,000 instead of $18,000, COGS would fall to $57,000 − $21,000 = $36,000 and gross profit would rise to $39,000. Profit, and the tax on it, would be overstated by $3,000, and the error would reverse next quarter when the inflated figure becomes beginning inventory.

Worked example 2: a small maker

An illustrative furniture maker builds 20 tables in a month and sells 16. It had no stock at the start of the month.

  • Timber and hardware: $4,800, or $240 per table.
  • Wages of one employee who builds the tables: $3,200, or $160 per table.
  • Finishes and consumables: $400, or $20 per table.
  • Total production cost: $4,800 + $3,200 + $400 = $8,400, or $8,400 ÷ 20 = $420 per table.

COGS for the month: 16 sold × $420 = $6,720. Ending inventory: 4 tables × $420 = $1,680. Check: $0 + $8,400 − $1,680 = $6,720. If each table sells for $900, revenue is 16 × $900 = $14,400, gross profit is $14,400 − $6,720 = $7,680, and gross margin is $7,680 ÷ $14,400 ≈ 53.3%.

Notice the owner's own time is not in the labor figure. For a US sole proprietor, the Schedule C instructions say not to include amounts you pay yourself in the cost of labor line, because owner draws are not wages.

Worked example 3: a service business

An illustrative IT support company has no inventory but treats direct delivery costs as cost of services: subcontracted technicians $18,000, hardware parts installed for clients $4,000 and remote-support licenses billed per client $1,000. Cost of services: $18,000 + $4,000 + $1,000 = $23,000. On revenue of $60,000, gross profit is $37,000 and gross margin about 61.7%.

If parts are resold to clients, list them as separate line items on the invoice so you can match each sale with its cost. A clear, itemized invoice made with the free invoice generator helps here, since parts, labor and markup are visible on one document.

Inventory costing methods

When you buy the same item at different prices over time, you need a rule for which cost goes to COGS.

MethodHow it worksEffect when prices are rising
FIFO (first in, first out)Oldest costs are sold firstLower COGS, higher profit, ending inventory near current prices
LIFO (last in, first out)Newest costs are sold firstHigher COGS, lower taxable profit; not allowed under IFRS and subject to IRS conditions
Weighted averageAverage cost of all units availableResults between FIFO and LIFO
Specific identificationTrack the actual cost of each itemExact; practical for unique, high-value goods such as cars or art

Quick FIFO example: you buy 100 units at $10, then 100 at $12, and sell 150. FIFO COGS = (100 × $10) + (50 × $12) = $1,000 + $600 = $1,600. Under weighted average, the average cost is ($1,000 + $1,200) ÷ 200 = $11, so COGS = 150 × $11 = $1,650. Once you choose a method for tax purposes, changing it generally requires IRS approval, so pick carefully with your accountant.

COGS and your tax return

In the US, sole proprietors report cost of goods sold in Part III of Schedule C, which follows the formula above: beginning inventory, purchases, cost of labor, materials and supplies, other costs, minus ending inventory. The result carries to the income section of the form. See the IRS Instructions for Schedule C for the current lines, and our Schedule C guide for freelancers for a plain-English walkthrough.

The IRS allows certain qualifying small businesses, based on an average gross receipts test, to use simpler methods of accounting for inventory. The threshold is adjusted for inflation, so check the current figure in IRS guidance or with a tax professional before relying on it. Operating costs that are not COGS are still deductible as ordinary business expenses; our list of self-employed tax deductions covers the common ones.

COGS for online and marketplace sellers

Ecommerce sellers face a few extra questions. Marketplace referral fees, payment processing fees and fulfillment fees charged per order behave like variable costs, and some sellers include them in cost of sales so that gross margin reflects the true cost of each order. Others keep them as selling expenses. Either can work if you are consistent, but be aware that the choice changes your reported gross margin.

Dropshippers usually have simple COGS: the supplier's charge for each order shipped, plus any per-order fees, with little or no inventory held. Sellers who hold stock in a third-party warehouse still need a reliable inventory count, which is often available as a report from the warehouse or marketplace. Reconcile that report with your own records each month rather than trusting it blindly, because lost, damaged or returned units can easily be missed.

Using COGS to set prices

Knowing your true cost per unit is the first step to pricing. If the furniture maker wants a 55% gross margin on a $420 table, the price must be $420 ÷ (1 − 0.55) = $420 ÷ 0.45 ≈ $933. Many owners confuse that calculation with markup, which would be $420 × 1.55 = $651, a big difference. Our guide to markup vs margin explains the gap, and the break-even point guide shows how COGS feeds into the sales volume you need.

Common COGS mistakes

  • Expensing all purchases immediately. Unsold stock is inventory, not COGS, under standard methods.
  • Skipping the stock count. Without a reliable ending inventory figure, COGS is a guess.
  • Including overhead that belongs below gross profit. Marketing and admin costs distort gross margin.
  • Forgetting freight-in and duties. Leaving them out understates the real cost per unit.
  • Ignoring shrinkage and damaged goods. Write down stock that is lost, broken or obsolete.
  • Changing methods casually. Switching between FIFO and average cost breaks comparisons and can have tax consequences.
  • Not matching supplier bills to deliveries. A three-way match of purchase order, delivery and invoice catches overbilling before it inflates COGS.

COGS checklist for each period

  • Beginning inventory equals last period's ending inventory.
  • All supplier invoices for stock and materials recorded, matched to deliveries.
  • Freight-in, duties and direct labor included.
  • Physical count or reliable system count of ending inventory completed.
  • Damaged, obsolete or missing stock written down.
  • Same costing method applied as last period.
  • COGS percentage and gross margin calculated and compared with prior periods.
  • Supporting records kept for tax purposes.

Next step

Run the cost of goods sold formula on your last quarter and calculate your COGS percentage. If it has crept up, check supplier prices and discounts first. To keep supplier spending under control at the source, use a purchase order template for stock orders, and keep expense records organized with our guide on how to track business expenses.

Frequently asked questions

What is the cost of goods sold formula?

Cost of goods sold equals beginning inventory plus purchases during the period minus ending inventory. Purchases include the cost of products or materials bought for resale or production, plus direct costs such as inbound freight and direct labor. For example, $10,000 of opening stock plus $30,000 of purchases minus $12,000 of closing stock gives a cost of goods sold of $28,000 for the period.

What is included in cost of goods sold?

COGS includes the direct costs of producing or acquiring the goods you sold: inventory bought for resale, raw materials, parts, direct labor for production workers, freight-in to get goods to your premises, and production overhead such as factory utilities in some methods. It excludes selling and administrative costs such as marketing, office rent, sales staff wages, outbound shipping to customers in many cases, and general software.

Do service businesses have cost of goods sold?

Pure service businesses often have no COGS in the inventory sense. Some report a cost of services or cost of revenue instead, covering subcontractors, materials used on jobs and the wages of staff who deliver client work. For US tax purposes, the IRS notes that a business providing only services generally does not need to fill in the cost of goods sold section of Schedule C. Ask your tax preparer how to classify mixed costs.

Is COGS an expense?

Yes. Cost of goods sold is an expense on the profit and loss statement, but it is shown separately from operating expenses, directly below revenue. Subtracting it from revenue gives gross profit. Inventory you have bought but not yet sold is not an expense yet; it sits on the balance sheet as an asset until it is sold, at which point it moves into COGS.

How does COGS affect taxes?

Cost of goods sold reduces gross income, so a higher COGS lowers taxable profit. That is why counting inventory accurately matters: overstating ending inventory understates COGS and overstates profit, while understating it does the reverse. In the US, sole proprietors calculate COGS in Part III of Schedule C. Some qualifying small businesses may use simplified inventory methods, so check current IRS guidance or ask a tax professional.

What is the difference between FIFO and LIFO?

They are inventory cost flow assumptions. FIFO, first in first out, assumes the oldest stock is sold first, so COGS reflects older prices. LIFO, last in first out, assumes the newest stock is sold first, so COGS reflects recent prices. When costs are rising, LIFO gives a higher COGS and lower taxable profit. LIFO is not permitted under IFRS, and US tax rules impose conditions on using it.

Does shipping count as cost of goods sold?

Shipping that brings inventory or materials to you, called freight-in, is generally part of the cost of the goods and therefore COGS. Shipping you pay to deliver orders to customers, called freight-out, is often treated as a selling expense, though some businesses include it in cost of sales. Choose one treatment, apply it consistently, and confirm with your accountant how it should appear on your tax return.

Can I include my own labor in COGS?

For a US sole proprietor, generally no. The Schedule C instructions direct you not to include amounts paid to yourself in the labor line of cost of goods sold, because an owner's draws are not deductible wages. Wages paid to employees who make the product can be included. If your business is a corporation paying you through payroll, the treatment can differ, so ask an accountant.

What is a good COGS percentage?

It depends heavily on the industry and pricing model. Resellers of commodity products often have high COGS as a share of revenue, while software, digital products and handmade premium goods can have low COGS. Rather than chase a universal figure, track your own COGS percentage, which is COGS divided by revenue, month by month and investigate any sudden rise.

IC

Invoice Creator Editorial Team

Guides on invoicing, cash flow and small-business finance from Invoice Creator, operated by Next Software Development Company. Content is reviewed for accuracy against the fields our own invoice generator produces.

Try the invoice generator

Related reading