Get Funded

Accounting

How to Calculate Cost of Goods Sold: Formula, Example and Pitfalls

Cost of goods sold is the direct cost of producing or buying what you sold in a period. The formula is beginning inventory plus purchases minus ending inventory. Getting it right shows your true gross margin and prevents underpricing.

Apply Now

One application · Matched across our 100+ funder network · Same-day funding on approved files

The COGS formula

COGS equals beginning inventory plus purchases and direct costs during the period, minus ending inventory.

The formula:

COGS = beginning inventory + purchases (and direct production costs) - ending inventory

Beginning inventory is the value of stock on hand at the start of the period. Purchases add what you bought or made. Ending inventory is what remains unsold at the end. The difference is the cost of what actually left your shelves.

COGS appears right below sales on your income statement. Revenue minus COGS is gross profit. See the income statement guide for the layout.

A worked example

A retailer with $30,000 of starting inventory, $50,000 of purchases and $35,000 of ending inventory has COGS of $45,000.

Illustrative quarterly COGS
LineAmount
Beginning inventory$30,000
Plus purchases and freight in$50,000
Goods available for sale$80,000
Less ending inventory$35,000
Cost of goods sold$45,000

If sales for the quarter were $75,000, gross profit is $30,000 and gross margin is 40 percent. All numbers are examples. Learn margin math in calculating profit margin.

What to include and what to leave out

Include costs directly tied to making or acquiring the product. Exclude general overhead like office rent, sales salaries and advertising.

Typically included:

  • Cost of purchased goods or raw materials.
  • Freight and import duties on inbound goods.
  • Direct labor on manufactured items.
  • Packaging that becomes part of the product.
  • Direct production overhead such as factory utilities, for producers.

Typically excluded:

  • Marketing and advertising.
  • Administrative salaries and office rent.
  • Shipping to customers, which many businesses record as selling expense.
  • Interest and income taxes.

Service businesses may have a version of COGS that includes direct labor and materials for jobs. Ask your accountant how tax rules apply to your business, since uniform capitalization rules and small business exceptions can change what you capitalize.

Inventory methods change the number

FIFO, LIFO and weighted average assign costs to sold items differently. The method affects COGS and taxable profit when prices change.

  • FIFO (first in, first out). Assumes the oldest stock sells first. In rising-cost periods, COGS is lower and profit is higher.
  • LIFO (last in, first out). Assumes newest stock sells first. COGS is higher in rising-cost periods. It requires specific tax elections, so ask your accountant.
  • Weighted average. Uses the average cost of all units available. It smooths price swings.
  • Specific identification. Tracks the exact cost of each item. Suits unique, high-value goods.

Pick a method, apply it consistently and note it in your records. Our guide to inventory accounting shows how each method flows into the books.

Count inventory and avoid common errors

Inaccurate counts, missing freight costs and unrecorded shrinkage are the main reasons COGS is wrong.

Do a physical count at least once a year, and ideally more often. Reconcile it with your records and record the differences for damaged, stolen or lost goods.

Common mistakes:

  • Recording inventory purchases as expenses the moment you buy, so profit swings with timing.
  • Forgetting freight and duties on inbound goods.
  • Mixing personal purchases with business inventory.
  • Failing to write down obsolete stock that will not sell at cost.

Slow-moving stock ties up cash. Check your inventory turnover ratio to see how fast you sell through.

Using COGS to price and plan

COGS shows your gross margin per product, which tells you what you can spend on overhead and marketing.

If a product costs $18 to buy and land, and you sell it for $30, you keep $12, or 40 percent, to cover rent, labor, marketing and profit. If overhead takes 32 percent of revenue, net margin is about 8 percent. Raise price by $2 and margin jumps to roughly 13 percent.

Track COGS by product line so you know where margin is strong and where it leaks. For pricing methods see the small business pricing guide, and for fixed-cost coverage use the break-even formula.

Funding inventory the right way

Stock purchases use cash before sales return it. Size inventory funding from turnover and margin, and borrow only for stock you expect to sell.

Say you want $40,000 of extra stock for a busy season. If the stock sells within 90 days at a 40 percent gross margin, it generates about $26,700 of gross profit on $66,700 of sales in this illustrative case. That can justify a funding cost of a few thousand dollars. If the stock may sit for a year, it likely cannot.

Work through the numbers in our inventory funding payback math and inventory financing guides. ROI Funder considers 500+ FICO, 6+ months in business and $20,000+ monthly revenue, and places working capital that can cover seasonal stock, with true cost and payback shown before you sign.

Review COGS monthly, not just at year end. A sudden jump in the COGS percentage usually points to a supplier price increase, waste, theft or a counting error, and finding it in weeks instead of months protects thousands of dollars of margin.

Frequently asked questions

What is the formula for cost of goods sold?

Beginning inventory plus purchases and direct costs, minus ending inventory.

Do service businesses have COGS?

Many track a similar figure for direct labor and materials on jobs. Ask your accountant how to classify it for taxes.

Is shipping part of COGS?

Inbound freight on goods you buy usually is. Shipping to customers is often recorded as a selling expense, though practices vary.

Which inventory method should I use?

Choose a method that fits your business and apply it consistently. Ask your accountant about tax rules before changing methods.