Skip to content
SharpTally.

COGS Calculator

Checked

This COGS calculator works out cost of goods sold from opening stock, purchases and closing stock, then your gross profit on it. Free, no sign-up, and the result updates as you type.

Enter your numbers

Your numbers

Stock on hand at the start of the period, valued at cost.

Everything bought for resale, including inbound freight and duty.

Stock still on the shelf at the end, counted or from a stock report.

Net sales for the same period, used for gross profit and COGS percentage.

Items shipped in the period, used to get an average cost per unit.

Your receipt COGS · USD

Goods available for sale
$61,150.00
Gross profit
$56,150.00
COGS as % of revenue
41.51%
Average cost per unit
$18.53

Cost of goods sold
$39,850.00
Cost of goods sold
$39,850.00

COGS is what you sold, not what you bought. Sellers who treat a month's purchase orders as that month's cost report a disaster every time they restock and a windfall every time they run the shelves down, when nothing about the business changed. Subtracting closing inventory fixes it: stock still sitting in the warehouse is an asset, and it only becomes a cost when it ships. This calculator runs the standard formula and adds gross profit, cost per unit and COGS as a share of revenue.

How it's calculated

COGS = opening inventory + purchases − closing inventory Gross profit = revenue − COGS

LaTeX source \text{COGS} = \text{Opening} + \text{Purchases} - \text{Closing} \qquad \text{Gross profit} = R - \text{COGS}

Worked examples

Example 1

A quarter with a modest stock build

$39,850 COGS, 41.51% of revenue

$18,400 + $42,750 gives $61,150 of goods available; $21,300 is still on the shelf, so $39,850 was sold. Against $96,000 of revenue that is 41.51%, leaving $56,150 of gross profit and an average cost of $18.53 per unit. Counting the $42,750 of purchases as the cost would have understated gross profit by $2,900.

The numbers used
Opening inventory
18400
Purchases in period
42750
Closing inventory
21300
Revenue in period
96000
Units sold
2150
Try these numbers
Example 2

A simple month, round figures

$17,500 COGS, 35.00% of revenue

$5,000 + $20,000 − $7,500 is $17,500 of cost against $50,000 of sales, a 35% COGS ratio and a 65% gross margin. The $2,500 of extra stock built during the month is cash out of the bank but it is not a cost yet, which is why profitable months can still feel tight.

The numbers used
Opening inventory
5000
Purchases in period
20000
Closing inventory
7500
Revenue in period
50000
Units sold
1000
Try these numbers

Questions sellers ask

How do you calculate COGS?

Opening inventory plus purchases minus closing inventory. $18,400 + $42,750 − $21,300 is $39,850. Value everything at cost, and include inbound freight and duty in purchases because those are part of what the goods cost you. Outbound shipping to the customer is a selling cost, not COGS.

How to get COGS without ending inventory?

Use the gross profit method: multiply revenue by your normal COGS percentage. $96,000 of sales at a historic 41.5% gives roughly $39,840. It is an estimate good enough for a monthly management figure but not for a tax return, and it drifts whenever your product mix or supplier prices change, so reconcile it against a physical count at least once a year.

What is a good COGS percentage?

Retail and ecommerce generally run 60-70% COGS on resale goods and 30-45% on own-brand products, where the markup is larger. Lower is not automatically better — a 30% COGS ratio on a product that nobody buys twice is worse than 55% on one that sells all year. Track the trend against your own history rather than a sector average.

How do you calculate COGS percentage?

Divide COGS by revenue for the same period and multiply by 100. $39,850 over $96,000 is 41.51%. Whatever is left is gross margin, so those two always sum to 100%. Use net revenue after refunds, otherwise a heavy returns month makes the ratio look better than the business performed.

What are common COGS examples?

The purchase price of goods for resale, raw materials, manufacturing labour, inbound freight, import duty and the cost of packaging that is part of the product. Marketing, office rent, salaries for anyone not making the product and outbound delivery to the buyer all sit below the gross profit line as operating expenses.

How do I calculate COGS in Excel?

With opening inventory in B1, purchases in B2 and closing inventory in B3, use =B1+B2-B3. For the percentage, =B4>0 guarded as =IF(B4=0,"",(B1+B2-B3)/B4) where B4 holds revenue. If you are pulling purchases from a supplier invoice export, sum only invoices for goods and keep freight in a separate column so it can be included deliberately.

Embed this calculator on your site Free, one line of HTML.
Optional: let the iframe resize itself

Paste this once anywhere on the same page and the iframe grows and shrinks to fit its contents instead of sitting at a fixed 520px.

Free to embed on any site, commercial or not — we only ask that you leave the "by SharpTally" credit link under it in place.

Search calculators

Browse