Skip to main content
KnowYourNut. Know your nut. Run your business.
Back to Blog
cogsprofit margininventoryfinancial basicscalculators

How to Calculate Cost of Goods Sold (And Why Your Margin Is Probably Wrong)

KnowYourNut Team··6 min read

If your margin looks healthy on paper but your bank account tells a different story, there is a good chance your cost of goods sold is wrong.

Not wrong in a dishonest way. Wrong in the way that happens when business owners use a shortcut formula, skip inventory counts, or treat every dollar they spend on product as an immediate expense. The math breaks, the margin number lies, and the problem stays invisible until cash runs out.

Here is how to calculate cost of goods sold correctly, which inventory valuation method fits your business, and what to do with the number once you have it.

What Cost of Goods Sold Actually Measures

Cost of goods sold (COGS) is the direct cost of the products or goods your business sold during a specific period. It does not include overhead like rent, salaries for non-production staff, or marketing. It is specifically the cost tied to what you sold.

For a business that makes or resells physical products, COGS is the number that connects your revenue to your gross profit:

Gross Profit = Revenue - COGS

If you skip COGS or calculate it wrong, your gross profit number is fiction. And if gross profit is wrong, every downstream decision you make about pricing, hiring, and growth is built on bad information.

The COGS Formula

The standard formula is:

COGS = Beginning Inventory + Purchases During the Period - Ending Inventory

Here is what that looks like with real numbers:

  • You start the quarter with $18,000 in inventory (beginning inventory)
  • You purchase $42,000 in additional product during the quarter (purchases)
  • You end the quarter with $14,000 in unsold inventory (ending inventory)

COGS = $18,000 + $42,000 - $14,000 = $46,000

That $46,000 is the cost of everything you actually sold. Anything still sitting in inventory rolls forward to the next period.

The formula sounds simple. The problem is that "inventory" is the variable that trips people up.

The Three Inventory Valuation Methods

If you buy the same item at different prices over time, you have a decision to make: which cost do you assign when something sells? The IRS accepts three methods.

FIFO (First In, First Out)

FIFO assumes you sell your oldest inventory first. During periods of rising costs, FIFO produces lower COGS and higher reported profit, because you're assigning older, cheaper costs to what sold. This also means your ending inventory on the balance sheet reflects current prices.

Most small businesses default to FIFO because it matches how physical inventory actually moves in many industries. Perishables, retail, and restaurants typically use FIFO because the product actually does rotate oldest-first.

LIFO (Last In, First Out)

LIFO assumes you sell the newest inventory first. During inflation, this produces higher COGS and lower reported profit, which reduces taxable income. The trade-off is that your balance sheet inventory value reflects older, lower costs.

LIFO is only permitted under U.S. GAAP. If your business uses international accounting standards or plans to raise outside capital, LIFO creates complications.

Weighted Average Cost

You take the total cost of all inventory and divide by total units to get a per-unit average cost. Every item sold during the period is assigned that average cost, regardless of when it was purchased.

This method smooths out price fluctuations and works well for businesses selling undifferentiated products where lot-by-lot tracking is impractical.

Which one to pick: For most small product-based businesses, FIFO is the right starting point. It reflects economic reality, aligns with how inventory actually moves, and is easier to explain to a lender or accountant. Talk to your CPA before switching methods — you can only change inventory valuation methods once per year, and a switch requires IRS notification.

The Mistakes That Corrupt the Number

Not doing physical inventory counts. Your accounting software tracks purchases and sales, but it does not know about shrinkage, damage, theft, or returns that weren't recorded. If you never count what is actually on the shelf, your ending inventory figure is a guess, which means your COGS is a guess.

Treating purchases as COGS. Some owners simply record every product purchase as an immediate expense. This works if you sell everything you buy in the same period. If you carry any inventory across periods, it overstates COGS, understates profit, and makes period-to-period comparisons meaningless.

Forgetting landed costs. The cost of inventory is not just what you paid the supplier. Shipping, customs duties, receiving labor, and storage costs are part of what it costs to get that product in your hands and ready to sell. COGS should reflect the full landed cost, not just the invoice price.

Mixing COGS with operating expenses. Owner salaries, office supplies, accounting software, and marketing are not COGS. They are operating expenses. Putting them in COGS distorts gross margin and makes it impossible to benchmark your profitability against industry standards.

What to Do With the Number

Once you have an accurate COGS, your gross margin tells you how much room you have to run the business.

Gross Margin % = (Revenue - COGS) / Revenue x 100

A retail business running 35% gross margin has $35 to cover overhead and generate profit for every $100 in sales. A product business at 18% gross margin has a much tighter operating budget, even if revenue looks strong.

Gross margin is also the number that tells you whether a price increase or cost reduction is the higher-leverage move. If your COGS is creeping up because supplier costs rose, you cannot absorb that indefinitely at the same price.

Use the COGS Calculator at KnowYourNut to run your numbers by period, compare across quarters, and see where gross margin is trending. It takes the formula and does the math clean, so you're working from the right number before you make pricing or purchasing decisions.

---

*This content is for informational purposes only and does not constitute financial advice. Inventory valuation methods and tax treatment vary by business structure and jurisdiction. Consult a licensed CPA for guidance specific to your situation.*