COGS Calculator

A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call

Free COGS calculator. Work out cost of goods sold from beginning inventory, purchases and ending inventory, with gross profit, gross margin and inventory turns.

Gross profit
0
Gross margin
0
Inventory turns
0
Days of inventory
0

Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.

How to use the COGS calculator

  1. Enter your beginning inventory: the value of the stock you had at the start of the period, at cost.
  2. Enter your purchases: the cost of stock bought or produced during the period, including freight-in.
  3. Enter your ending inventory: the value of stock left at the end, at cost, from a stock count.
  4. Optionally, enter revenue for the period.

The COGS calculator shows your cost of goods sold, gross profit, gross margin, inventory turns and the average number of days stock sits before being sold. Everything is calculated in your browser.

The COGS formula

Cost of goods sold (COGS) is the direct cost of the products you sold during a period:

COGS = beginning inventory + purchases − ending inventory

The logic is simple: everything you had at the start plus everything you bought is what was available to sell. Whatever isn't left at the end must have been sold (or lost, spoiled or stolen).

For a shop that started the month with 10,000 of stock, bought 25,000 more, and ended with 8,000: COGS = 10,000 + 25,000 − 8,000 = 27,000.

Gross profit and gross margin

With revenue added, the COGS calculator also shows:

Gross profit = revenue − COGS

Gross margin = gross profit ÷ revenue × 100

With revenue of 60,000 and COGS of 27,000, gross profit is 33,000 and gross margin is 55%. That's what's left to cover rent, wages, marketing and other operating costs, and then profit.

What to include in COGS

COGS includes the direct costs of getting products ready to sell:

  • Retailers and resellers: the purchase cost of goods, plus freight and import duties to get them to you.
  • Manufacturers and food businesses: raw materials and ingredients, direct labour (the people who make the products), and production overheads such as factory utilities, under most accounting systems.
  • Packaging that's part of the product.

COGS doesn't include selling and administrative costs: shop rent, marketing, office staff, delivery to customers and card fees are operating expenses. That's the main difference between gross margin and contribution margin; the contribution margin calculator treats variable selling costs separately.

Inventory valuation methods

The value of your ending inventory depends on the method you use, which affects COGS:

  • FIFO (first in, first out): assumes the oldest stock sells first. When prices are rising, FIFO gives lower COGS and higher profit.
  • Weighted average cost: uses the average cost of all units available.
  • LIFO (last in, first out): assumes the newest stock sells first. It's allowed in the US but not under IFRS, which most other countries use.

Use one method consistently, and agree it with your accountant, since it affects your tax.

Inventory turns and days of inventory

The calculator also works out how quickly your stock sells:

Inventory turnover = COGS ÷ average inventory

Days of inventory = 365 ÷ inventory turnover

With COGS of 27,000 and average inventory of 9,000 (the average of 10,000 and 8,000), that's 3 turns. These figures make most sense over a full year: if your COGS is for a single month, the "days" figure assumes that month's pace continues all year. The inventory turnover calculator goes into more detail.

Fast turnover means less cash tied up in stock and less risk of it spoiling or going out of fashion. Slow turnover can signal overstocking. For when to reorder, see the reorder point calculator and the safety stock calculator.

Why accurate COGS matters

Tax. COGS is deducted from revenue when calculating taxable profit, so understating it means paying too much tax, and overstating it can cause problems in an audit.

Pricing. If your gross margin is shrinking, costs may be rising faster than your prices. The profit margin calculator helps set prices for a target margin.

Spotting shrinkage. If COGS seems high compared with what you know you sold, stock may be going missing through waste, theft or errors. Comparing expected and actual COGS is one of the simplest checks a business can do.

Valuation and lending. Lenders and buyers look closely at gross margin and stock levels. Profit measures further down the income statement, such as EBITDA, start from gross profit.

Getting the inputs right

The most common source of error is the ending inventory figure. Count your stock at the same point in each period (for example, after closing on the last day of the month), value it consistently at cost, and write off anything damaged or expired. Make sure purchases include freight and duty, and exclude anything bought for your own use, such as cleaning supplies, which is an operating expense. If a purchase arrived but hasn't been invoiced yet, include it anyway, so stock and purchases match.

COGS for food businesses

Food businesses often track COGS as a percentage of sales, called food cost percentage. For many restaurants, food costs of around 25% to 35% of food sales are typical, though it varies with the menu and the style of business. Bakeries and cafés can sit in a similar range. Track it weekly or monthly: a rising food cost percentage is an early sign of waste, theft, supplier price rises or portions creeping up.

To calculate it, use the COGS calculator with your opening stock, purchases and closing stock for the period, then divide COGS by food sales. Doing this every week, with a quick stock count, catches problems far sooner than waiting for year-end accounts.

Reducing COGS without cutting quality

  • Negotiate with suppliers, especially for items you buy in volume.
  • Reduce waste: order closer to demand, use first-in first-out stock rotation, and repurpose leftovers.
  • Standardise portions and recipes so every product costs what it should.
  • Review your product mix: promote items with lower COGS percentages.
  • Check deliveries against invoices for missing or damaged items.

Small improvements in COGS go straight to gross profit, so a 2% saving on a 35% food cost can noticeably raise your margin.

COGS and pricing decisions

Once you know COGS per product, check that your prices leave enough margin to cover overheads and profit. If ingredient costs rise, a COGS calculator shows the effect on gross margin immediately, so you can decide whether to raise prices, change suppliers or adjust recipes before the profit disappears.

Quick tips

  • Count stock at the same time at the end of every period.
  • Value stock at cost, not at selling price.
  • Include freight and duties in purchases for an accurate cost.
  • Track COGS as a percentage of sales weekly or monthly to spot changes early.
  • Investigate unexpected rises, which can point to waste, theft or supplier price increases.

Privacy and accuracy

Everything you enter here, your stock and purchase figures, stays in your browser. Nothing is uploaded, saved on a server or shared, and it's all gone when you close the page, so the tool is safe to use with real figures and private details. The results come from fixed formulas and exact conversion factors, with no AI guessing involved, so the same inputs always give the same answer. It's used every day by retailers, food businesses and their accountants, on phones, tablets and computers, with no sign-up and no limits.

A worked example

A bakery's café also sells packaged coffee beans and gift boxes. For the quarter, the owner wants to know how profitable that retail side really is.

Her stock count at the start of the quarter valued the retail stock at 10,000 at cost. During the quarter she bought 25,000 of beans, tins and gift boxes, including delivery. Her closing stock count came to 8,000. Retail sales for the quarter were 60,000.

The COGS calculator shows COGS of 27,000, gross profit of 33,000 and a gross margin of 55%. Inventory turns are 3.0 for the quarter. Last quarter, the margin was 61%. Looking at supplier invoices, she finds coffee bean prices rose by about 15%, while her own prices stayed the same. She raises the price of the most popular bag of beans and starts tracking the margin monthly.

Bring in the next customer from Google

Numbers like these keep a business running. Google Ads, run carefully, is how many small businesses bring in the next customer. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.

Frequently asked questions

How do I calculate cost of goods sold?

Add purchases to beginning inventory and subtract ending inventory. 10,000 + 25,000 − 8,000 = 27,000. This COGS calculator does it, with gross margin.

What's included in COGS?

The direct costs of products sold: purchase cost, freight-in, duties, and for manufacturers, materials, direct labour and production overheads.

Is rent part of COGS?

Shop or office rent isn't. Factory or production space rent is usually included for manufacturers.

What's the difference between COGS and operating expenses?

COGS are direct product costs. Operating expenses are the costs of running the business, such as marketing, admin and shop rent.

What if COGS comes out negative?

Ending inventory can't be larger than beginning inventory plus purchases. Check your figures or stock count.

Is this COGS calculator free?

Yes. It's free, needs no sign-up and runs in your browser.

Free PPC audit

See where your ad budget leaks.

We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.

Book a free audit call 30-minute call · Free · The audit is yours to keep