🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
FINANCE

COGS Calculator — cost of goods sold from your inventory figures

Derive cost of goods sold from beginning inventory, purchases and ending inventory, then read the gross profit, gross margin and inventory turns that fall out of the same numbers.

Value of stock on hand at the start of the period, in any currency. This is last period's closing figure.
Goods bought for resale, or raw materials bought for production, at invoice cost.
Costs of getting goods ready to sell. Freight-in belongs in COGS; freight-out to the customer does not.
Subtracted from purchases. Includes trade discounts, cash discounts taken and goods sent back to suppliers.
Value of stock still on hand at the end of the period, normally from a physical count.
Net sales. Optional, but needed for gross profit and gross margin.
Cost of goods sold
0
 
0
Gross profit
0
Gross margin
0
Inventory turns
0
Days inventory
COGS share of revenue
0%
Gross profit share
0%
Tip: COGS is driven as much by the ending inventory count as by what you bought. An overstated closing count understates COGS and inflates profit, which is why the count matters more than most owners expect.
Advertisement

A COGS calculator answers a question that every product business has to answer before it can know whether it made money: what did the goods you actually sold cost you? Not what you spent on stock — those are different numbers, and the gap between them is inventory. Cost of goods sold is the portion of your purchasing that left the building with a customer, and it is derived from three inventory figures rather than read off a bank statement.

Arb Digital works with product businesses on the demand side — search, content and advertising — and the first question in almost every one of those conversations is what a sale is worth once the goods are paid for. This tool exists to produce that number. It differs from the live gross margin calculator in one specific way: that tool takes COGS as an input you already have, while this one derives COGS from the inventory movement first and then hands you the margin.

What This COGS Calculator Does

Enter beginning inventory, everything you added during the period, and the stock still on the shelf at the end, and the calculator returns cost of goods sold. It handles the four additions that belong in COGS for most businesses — purchases, direct labour, freight-in and duties — and the one deduction that is routinely forgotten, purchase returns and discounts.

Add revenue and it derives the figures that follow from COGS: gross profit, gross margin as a percentage, inventory turns and days inventory outstanding. Those last two come free because the calculation already contains both the beginning and ending inventory values needed to compute an average.

The two bars split revenue into the part consumed by COGS and the part retained as gross profit. That is a fast structural read on a business: a 58 percent COGS bar means fifty-eight cents in every currency unit of sales leaves immediately to pay for goods, and everything else — rent, salaries, marketing, profit — has to come out of the remaining forty-two.

How to Use It

  1. Take beginning inventory from last period's closing balance. They should be the same number. If they are not, find out why before continuing, because a mismatch means something has been written off or recounted.
  2. Enter purchases at invoice cost for the whole period, then put trade discounts, cash discounts taken and supplier returns into the returns field so they are deducted rather than netted invisibly.
  3. Add direct labour and freight-in if they apply. Manufacturers almost always have both. A pure reseller may have only freight-in, and a dropshipper may have neither.
  4. Enter ending inventory from a physical count where possible, valued on the same basis you used at the start of the period.
  5. Add revenue to get gross profit and margin, then read the turns and days-inventory figures for how quickly the stock is moving.

The Formula / How It's Calculated

The core identity is COGS = beginning inventory + net purchases − ending inventory, where net purchases means purchases plus direct labour and freight-in, less returns and discounts. Everything that entered inventory and did not remain in inventory must have been sold.

Work through the default figures. Beginning inventory is 42,000. Purchases of 180,000 less returns and discounts of 5,000 give net purchases of 175,000. Add direct labour of 26,000 and freight-in of 8,000 and the total cost of goods available for sale is 42,000 + 175,000 + 26,000 + 8,000 = 251,000. Subtract ending inventory of 55,000 and cost of goods sold is 196,000.

With revenue of 340,000, gross profit is 340,000 − 196,000 = 144,000, and gross margin is 144,000 ÷ 340,000 = 42.35 percent. COGS therefore consumes 57.65 percent of revenue. Average inventory across the period is (42,000 + 55,000) ÷ 2 = 48,500, so inventory turns are 196,000 ÷ 48,500 = 4.04 times, and days inventory outstanding is 365 ÷ 4.04 = 90.3 days. Every one of those figures comes from the same six inputs.

Advertisement

What Belongs in COGS and What Does Not

The line between COGS and operating expenses is where most self-prepared accounts go wrong, and the consequences are not trivial: misclassify a cost and your gross margin becomes meaningless for comparison, pricing and benchmarking.

The test is attribution. A cost belongs in COGS if it attaches to a unit of product and would not have been incurred if that unit had not been made or bought. Raw materials qualify. The wages of the people who assemble or pick the product qualify. Freight to bring goods in qualifies, as do import duties, because they form part of what the goods cost to acquire.

Costs that would continue whether or not any particular unit existed are operating expenses instead. Rent on the office, the marketing budget, administrative salaries, professional fees and the cost of shipping an order out to a customer all sit below the gross profit line. Freight-out is the one that trips people up most often: it feels like a product cost because it is triggered by a sale, but it is a selling expense, not a cost of acquiring the goods. The Internal Revenue Service sets out the components it recognises in Publication 334, Tax Guide for Small Business, and corporations report the same build-up on Form 1125-A, Cost of Goods Sold. Rules differ by country, so check what applies where you file.

Why the Inventory Count Moves Profit More Than Purchasing Does

Look again at the formula and notice that ending inventory is subtracted. Every currency unit you add to the closing count removes a currency unit from COGS, and therefore adds one to gross profit. That relationship is exact and it is worth internalising, because it means a counting error becomes a profit error one-for-one.

Overstate the closing count by 10,000 — through miscounting, through failing to write off damaged stock, or through valuing obsolete goods at full cost — and reported gross profit rises by 10,000 that does not exist. The error then reverses in the following period, because this period's ending inventory is next period's beginning inventory, so next period's COGS is overstated by the same amount. A single counting error therefore distorts two consecutive periods in opposite directions, which is exactly the pattern that makes month-to-month margins look erratic.

The practical defence is a real physical count at period end rather than a rolled-forward book figure, plus an explicit write-down for stock that is damaged, expired or unsellable. If the goods will never generate revenue, leaving them in inventory only postpones the loss and flatters the current period. The inventory turnover calculator is useful here as a cross-check: turns that fall while purchasing stays flat usually mean stock is accumulating that should have been written down.

FIFO, LIFO and Weighted Average When Costs Move

If you buy identical goods at different prices during a period, the formula still works but the inputs become a choice. Which units did you sell — the older cheap ones or the newer expensive ones? The three standard answers give different COGS from identical physical facts.

First-in first-out assumes the oldest stock sells first, so COGS reflects older costs and ending inventory reflects recent ones. When prices are rising, that produces the lowest COGS and the highest reported profit, with an inventory balance close to current replacement cost. Last-in first-out assumes the newest stock sells first, so COGS reflects recent costs and reported profit is lower when prices rise; it is permitted in the United States but not under international standards. Weighted average cost divides total cost available by total units available and applies one blended rate to both, which smooths the effect of price movement.

Two points matter for using this calculator. First, whichever method you use, the beginning and ending inventory values you type here must be produced on the same basis, or the subtraction is comparing incompatible numbers. Second, you cannot switch methods to flatter a period; consistency between periods is what makes the resulting margin trend readable at all.

Reading Gross Margin Against Your Own Prior Periods

Gross margin is the number this calculation exists to produce, and its value comes almost entirely from comparison. An absolute margin of 42 percent tells you very little on its own — it would be exceptional for a grocery wholesaler and alarming for a software-adjacent hardware business. The same figure against your own last four quarters tells you a great deal.

When margin falls, there are only four possible causes and the inputs on this page separate them. Selling prices dropped, which shows as revenue falling faster than COGS. Input costs rose, which shows as purchases rising against flat units. The product mix shifted toward lower-margin lines, which shows as margin falling with both revenue and COGS stable in aggregate. Or inventory was written down, which shows as ending inventory falling without a corresponding sale. Diagnosing which one is happening is more useful than the margin figure itself.

Once you have a reliable gross margin, it becomes the input to almost every other decision. The break-even calculator uses it to find the sales level that covers fixed costs, the contribution margin calculator takes it down to the unit level, the markup calculator converts it into the pricing multiple you apply at the shelf, and the EBITDA calculator carries it through to operating earnings.

Know your margin — now grow the volume behind it.

Arb Digital helps product businesses win more of the searches their buyers are already making, so the gross profit you just calculated has more units behind it.

SEO Services Talk to Arb Digital

Common Mistakes to Avoid

  • Putting outbound shipping in COGS — freight-in is a cost of acquiring goods, freight-out to the customer is a selling expense below the gross profit line.
  • Treating purchases as COGS — what you bought and what you sold differ by the change in inventory, which is the entire point of the calculation.
  • Skipping the write-down for dead stock — carrying unsellable goods at full cost understates COGS now and forces a larger loss later.
  • Mixing valuation methods between periods — beginning and ending inventory must be valued on the same basis or the subtraction is meaningless.
  • Forgetting purchase discounts — discounts taken reduce the cost of goods, and omitting them overstates COGS and understates margin.

Related Free Tools From Arb Digital

Pair this with the gross margin calculator when COGS is already known, the inventory turnover calculator for stock velocity, the profit margin calculator for the whole-business view, the reorder point calculator for when to buy again, the working capital calculator for the cash tied up in stock, and the markup calculator for turning margin into price. The full free online tools hub lists everything else.

Frequently Asked Questions

What is the formula for cost of goods sold?

Beginning inventory plus net purchases minus ending inventory. Net purchases means goods bought plus direct labour, freight-in and duties, less purchase returns and discounts. Anything that entered inventory and did not remain there was sold.

Is shipping included in COGS?

Inbound shipping is. Freight-in and import duties form part of what the goods cost to acquire, so they belong in COGS. Outbound shipping to the customer is a selling expense and sits below the gross profit line.

What is the difference between COGS and operating expenses?

A cost belongs in COGS if it attaches to a unit of product and would not have been incurred without it. Costs that continue regardless of any particular unit — rent, admin salaries, marketing, professional fees — are operating expenses.

How does ending inventory affect profit?

One for one. Ending inventory is subtracted in the formula, so every unit of currency added to the closing count removes a unit from COGS and adds one to gross profit. A counting error becomes a profit error of exactly the same size.

Do service businesses have COGS?

Not in the inventory sense. A service business with no goods has no beginning or ending inventory, though many report an equivalent line called cost of services or cost of revenue covering the direct labour and delivery costs attached to fulfilling the work.

Which inventory valuation method should I use?

FIFO, LIFO and weighted average all satisfy the same formula but produce different figures when purchase prices move. The requirements differ by jurisdiction and the choice affects reported profit, so it is a decision to take with a qualified accountant and then apply consistently.

How are inventory turns calculated here?

COGS divided by average inventory, where average inventory is the mean of the beginning and ending balances. Days inventory outstanding is 365 divided by that turns figure, giving the average number of days stock sits before it sells.

This calculator performs arithmetic on figures you supply and is provided for general information only. It is not accounting, tax or financial advice, and reporting rules differ by country — confirm your treatment with a qualified professional before filing anything.

Advertisement
Advertisement

Take it further