Skip to main content

How to Calculate Cost of Goods Sold the Right Way: Beginning Inventory, Purchases, Ending Inventory, and What It Tells You About Profit

Published 12 min readMike ThriftMike Thrift
How to Calculate Cost of Goods Sold the Right Way: Beginning Inventory, Purchases, Ending Inventory, and What It Tells You About Profit
On this page

Miscount your ending inventory by $10,000 and your gross profit is wrong by exactly $10,000 — in the opposite direction. Overcount what sits on your shelves and you understate your cost of goods sold, overstate your profit, and overpay your tax. Undercount it and you hand yourself a phantom loss that evaporates the moment anyone looks closely. No other single number on a small product business's books is this easy to get wrong and this expensive when you do.

Cost of goods sold (COGS) is the bridge between what you sell and what you actually earned. This guide walks through the formula the IRS expects, what belongs in it, the inventory methods that change the answer, and how to read what the result says about your pricing and profitability.

What Cost of Goods Sold Actually Measures​

COGS is the direct cost of the goods you sold during a period — nothing more, nothing less. If you buy a widget for $40 and sell it for $100, your COGS for that sale is $40 and your gross profit is $60. Everything else — rent, marketing, your salary, the accountant's fee — comes later, below the gross profit line.

That placement is the whole point. The IRS puts it plainly in its tax guide for small business: you must determine gross profit before you can deduct any business expenses. On Schedule C, COGS is figured separately in Part III (lines 35 through 42) and subtracted from gross receipts to arrive at gross profit. It is not just another expense line; it is the calculation that decides what your revenue was really worth.

What belongs in COGS​

For a reseller, COGS is built from straightforward pieces:

  • Beginning inventory — the cost of goods on hand at the start of the period.
  • Purchases — the cost of merchandise bought for resale, net of returns, allowances, and purchase discounts you took.
  • Freight-in — what you paid to get goods to your door. Inbound shipping is part of the cost of the goods.
  • Direct labor and materials — if you manufacture, the wages of production workers and the raw materials consumed, plus the factory overhead tied to production (utilities for the workshop, depreciation on production equipment).

What does not belong in COGS​

Just as important is what stays out:

  • Selling and distribution costs — advertising, sales commissions, and freight-out (shipping to your customer) are operating expenses, not COGS.
  • General and administrative costs — office rent, insurance, professional fees, and the owner's draw.
  • Your own labor, if you are the owner — a sole proprietor's time has no deductible cost. Only wages paid to employees doing production work count.

The boundary that trips up the most small businesses is labor. The wages of the person assembling your product belong in COGS; the wages of the person selling it do not. Misclassify that line and your gross margin — the number you use to set prices — is fiction.

The COGS Formula, Step by Step​

The formula never changes:

COGS = Beginning Inventory + Purchases (and production costs) − Ending Inventory

Walk through it with a concrete example. Imagine you run a small candle business:

  1. Beginning inventory (January 1): You count wax, jars, wicks, and finished candles on hand and value them at $12,000. This number is last year's ending inventory carried forward — the two must always agree.
  2. Add purchases: During the year you buy $48,000 of wax, fragrance oils, jars, and packaging, and pay $2,000 in freight-in to receive them. After a $1,000 return of defective jars, your net additions are $49,000.
  3. Goods available for sale: $12,000 + $49,000 = $61,000. This is everything you could have sold.
  4. Subtract ending inventory (December 31): You do a physical count and value what remains at $14,000.
  5. COGS: $61,000 − $14,000 = $47,000.

If your candle revenue for the year was $95,000, your gross profit is $95,000 − $47,000 = $48,000, and your gross margin is just over 50 percent. Every one of those figures flows from the two inventory counts. Get either count wrong and the error lands one-for-one in COGS, gross profit, and taxable income.

Note the timing subtlety: money you spent on goods still sitting on the shelf at year-end is not this year's COGS. It stays on the balance sheet as inventory and becomes COGS only when those goods sell. That is why a year of heavy stocking-up can show strong cash outflow alongside deceptively healthy profit — the cash left, but the cost has not been recognized yet.

Who Has to Calculate COGS​

If the production, purchase, or sale of merchandise is an income-producing factor in your business, you generally must keep inventory and compute COGS. That covers retailers, wholesalers, manufacturers, restaurants, and most e-commerce sellers.

Pure service businesses are the exception: with nothing to stock, there is no inventory equation to run, and your costs land directly among business expenses. But the line blurs fast. A contractor who bills clients for materials, a salon selling retail products, or a consultant reselling software licenses alongside advice has merchandise income and needs to account for the cost of those goods separately. If you sell things as well as hours, figure COGS for the things.

How Inventory Valuation Methods Change the Answer​

When the price you pay for goods changes during the year — and it always does — an obvious question arises: which units did you "sell," the cheap ones bought in January or the expensive ones bought in November? Your inventory method answers that, and the choice moves COGS, gross profit, and tax.

  • FIFO (first-in, first-out) assumes the oldest units sell first. When prices are rising, FIFO produces lower COGS and higher reported profit, because the cheap early units are the ones counted as sold. Ending inventory reflects recent, higher costs.
  • LIFO (last-in, first-out) assumes the newest units sell first. In rising prices this raises COGS and lowers taxable income — the reason some businesses elect it. It is permitted for US federal tax but banned under international IFRS rules, and once you elect it, switching away requires IRS consent.
  • Weighted average blends all purchase costs into one average unit cost. It smooths out price swings and is the simplest method to maintain by hand or in a spreadsheet.
  • Specific identification tracks the actual cost of each individual item. It is the right answer for big-ticket, distinguishable goods — vehicles, jewelry, custom equipment — and impractical for anything sold by the hundred.

There is no universally best method, but there is a wrong move: picking one for the tax return and using another in your internal books, or switching methods year to year to chase a lower number. Pick the method that reflects how your goods actually flow, apply it consistently, and document the choice. If you ever want to change methods for tax purposes, that change generally needs IRS approval — it is a commitment, not a mood.

What COGS Tells You About Your Business​

COGS is a tax calculation, but its real value is managerial. Three readings matter most.

Gross profit and gross margin​

Gross profit (revenue minus COGS) is the pool of money available to cover everything else and leave something for you. Gross margin expresses it as a percentage: a $48,000 gross profit on $95,000 of revenue is a 50.5 percent margin. Track this monthly, not annually. A margin drifting from 52 to 46 percent over two quarters is your earliest warning that supplier prices, waste, or discounting are eating the business — visible here quarters before it shows up in net income.

Whether your pricing covers your true cost​

Many small businesses price by feel: materials plus a markup that "seems right." A real COGS figure replaces feel with arithmetic. If your all-in unit cost including freight-in and production labor is $40 and you sell at $55 with free shipping that costs you $8, your true margin per unit is $7, not $15. Businesses that skip the freight-in and labor pieces systematically underprice, then wonder why record sales produce flat bank balances.

How you compare​

Gross margin benchmarks exist for nearly every industry — restaurants, contractors, e-commerce niches, distributors. A margin far below your industry's typical range usually means one of three things: your costs really are higher, your prices really are lower, or your COGS is miscategorized and the comparison is meaningless. Cleaning up the calculation is step one; only then can the benchmark tell you anything.

Seven Mistakes That Corrupt the Calculation​

Inventory errors have a nasty property: an error in ending inventory reverses itself the following year, because this year's ending inventory becomes next year's beginning inventory. That sounds forgiving, but it means two consecutive years of wrong tax returns and wrong pricing decisions instead of one. Avoid these:

  1. Skipping the physical count. Estimating ending inventory from memory or from last year's figure is the single most common failure. Count it — at least annually, and quarterly if you can. A count takes an afternoon; a wrong number distorts every decision for a year.
  2. Valuing inventory at selling price. Inventory is carried at cost, not at what you hope to sell it for. Valuing a $40-cost widget at its $100 retail price overstates ending inventory, understates COGS, and overstates profit and tax.
  3. Forgetting goods in transit, on consignment, or at a second location. Anything you own at the count date counts, wherever it sits. Pick one cutoff rule — title passes at shipment or at delivery — and apply it at both ends of the year.
  4. Mixing personal withdrawals into COGS. Goods you take from inventory for personal use are not sold and not deductible; they come out of inventory without touching COGS. Resellers who "borrow" stock without recording it end up with shrinkage they cannot explain.
  5. Ignoring shrinkage, spoilage, and obsolescence. Theft, damage, expired materials, and dead stock that will never sell must be written out of inventory. Leaving them in overstates ending inventory and understates COGS — your books claim profit on goods that went in the dumpster.
  6. Using stale unit costs. When supplier prices move, last quarter's unit cost is wrong for this quarter's calculation. Update costs with each purchase batch, or use an inventory method that does it for you.
  7. Burying operating expenses in COGS (or vice versa). Freight-out, advertising, and selling labor are not COGS; freight-in and production labor are. Every misclassified dollar shifts gross margin without changing net income a cent — which is exactly why the error survives: the bottom line looks fine while the pricing signal lies.

A Simple Monthly System That Keeps COGS Honest​

You do not need an ERP to get this right. A small product business can run an honest COGS on a monthly rhythm with basic tools:

  • Separate the accounts. Keep distinct ledger accounts for purchases, freight-in, purchase returns, production labor, and ending inventory adjustments. If everything lands in one "supplies" account, the formula has nothing to work with.
  • Reconcile purchases to reality. Each month, tie your recorded purchases to supplier statements and your bank or card feed. Unrecorded purchases understate COGS; unrecorded returns overstate it.
  • Count on a schedule. A full annual count plus rolling cycle counts — a different shelf or category each month — catches drift early without shutting down for a day.
  • Review margin, not just profit. Put gross margin on a one-page monthly dashboard alongside revenue. A three-point swing in either direction deserves an explanation before the month closes.
  • Keep the paper trail. Supplier invoices, receiving records, count sheets, and costing worksheets support every number in the equation. If the IRS ever asks how you got from beginning inventory to COGS, that folder is your answer.

Businesses that track inventory in plain-text accounting get one quiet advantage here: every adjustment to inventory and COGS is an explicit, dated transaction in a version-controlled ledger, so reconstructing how ending inventory moved from one count to the next is a matter of reading the file, not interrogating a database. Your documentation workflow and your books can share the same habits.

Keep Your Cost Picture Sharp All Year​

COGS repays attention out of proportion to the effort it takes. Two careful inventory counts a year, purchases recorded in the right accounts, and a monthly glance at gross margin will tell you more about the health of a product business than any other routine you can adopt. The businesses that get surprised by taxes, by cash crunches, or by discovering their bestseller loses money on every unit almost always share one trait: they were guessing at this number.

Maintaining clear records of inventory, purchases, and production costs is exactly the kind of steady bookkeeping that compounds over time. Beancount.io provides plain-text accounting that gives you complete transparency and control over your financial data — no black boxes, no vendor lock-in. Get started for free and see why developers and finance professionals are switching to plain-text accounting.

Source: https://beancount.io/blog/2026/10/11/how-to-calculate-cost-of-goods-sold-cogs-guide

Published: October 11, 2026