Free cost of goods sold calculator
Find your cost of goods sold in two seconds. Enter your beginning inventory, your purchases, and your ending inventory — add revenue to also get gross profit and your gross margin. The calculator returns COGS (beginning + purchases − ending), gross profit, and the COGS ratio — updated live, as you type.
On this page14 sections
Estimates only, based on the values you enter. Not accounting or tax advice.
Results are estimates. Consult a professional.
What is cost of goods sold (COGS)?
Cost of goods sold (COGS) is the direct cost of producing the goods a business actually sold during a period — the raw materials, the direct labour, and the factory overhead that went into the units that left the shelf. It is the first cost subtracted from revenue on the income statement, and what's left is gross profit. This cost of goods sold calculator returns COGS the moment you enter your beginning inventory, your purchases, and your ending inventory — and adds gross profit and the COGS ratio when you supply revenue.
The logic is inventory accounting in one line: take what you started with, add what you bought or made, and subtract what is still sitting in the warehouse at the end. Whatever is missing must have been sold — and its cost is your COGS. Because it counts only the cost of goods that actually sold, COGS rises and falls with sales volume, which is what makes it a direct cost rather than an overhead.
How to calculate cost of goods sold
Calculating COGS is a three-step process that works off two inventory snapshots — one at the start of the period, one at the end — and everything you added in between.
- Find your beginning inventory. The dollar value of stock on hand at the start of the period. This is simply last period's ending inventory carried forward.
- Add your purchases. Everything you bought or manufactured during the period — inventory purchases plus the direct materials, direct labour, and factory overhead that go into finished goods.
- Subtract your ending inventory. The dollar value of stock still unsold at the end of the period, counted in a physical or perpetual inventory. Beginning + purchases − ending = COGS.
What is included in COGS
COGS captures only the direct costs of producing what you sold — costs that would not exist if you made nothing. Three categories make up almost every COGS figure.
- Raw materials. The cost of the materials and components that physically go into the product — the leather in a shoe, the flour in a loaf, the goods a retailer buys to resell.
- Direct labour. The wages of the people who build, assemble, or prepare the product — the factory line, the bakers, the assembly team.
- Manufacturing overhead. The indirect production costs tied to making the goods — factory utilities, equipment depreciation, and maintenance on the production line.
COGS vs operating expenses: what stays out
The single most common COGS mistake is folding in costs that belong elsewhere. The dividing line is simple: COGS holds the costs of making and selling the product; operating expenses (often shown as SG&A) hold the costs of running the company. Put another way, if a cost would still be there even if you produced nothing this month, it is an operating expense, not COGS.
| Cost | In COGS? | Why |
|---|---|---|
| Raw materials & components | Yes | Direct material cost of the product |
| Factory / production labour | Yes | Direct labour that makes the goods |
| Factory utilities & depreciation | Yes | Manufacturing overhead tied to output |
| Office rent & admin salaries | No | Overhead — runs the company, not the product |
| Marketing & advertising | No | A selling expense (SG&A), not a production cost |
| Interest & income taxes | No | Non-operating — sit far below gross profit |
Direct production costs go in COGS; everything that keeps the business running is an operating expense.
A worked example using the cost of goods sold calculator
Thread & Co. is closing its books for the year. It started January with $20,000 of inventory, bought and produced $80,000 of stock over the year, and counted $15,000 of unsold inventory on December 31. It booked $150,000 in revenue. Here is how the calculator works through it.
Step 1 — Add beginning inventory and purchases
Start with what was on hand plus what came in during the year: $20,000 of beginning inventory + $80,000 of purchases = $100,000 of goods available for sale.
Step 2 — Subtract ending inventory
Take out what is still unsold at year-end: $100,000 of goods available − $15,000 of ending inventory = $85,000. That $85,000 is the cost of goods sold.
| Line | Amount |
|---|---|
| Beginning inventory | $20,000 |
| Add purchases | +$80,000 |
| Goods available for sale | $100,000 |
| Less ending inventory | −$15,000 |
| Cost of goods sold | $85,000 |
COGS = $20,000 + $80,000 − $15,000 = $85,000.
Step 3 — Subtract COGS from revenue for gross profit
Now see how that compares. A 43% gross margin is healthy for apparel, where 50–60% gross margins are typical for established brands but thinner for new ones still paying full price for small production runs. The next sections show how the inventory method you choose can move this COGS figure, and how COGS drives the gross margin that the whole business is judged on.
How FIFO, LIFO, and weighted average change your COGS
When you buy the same item at different prices over a year, which cost do you assign to the units you sold? That choice — your inventory costing method — can change your COGS, your gross profit, and your tax bill, even though you sold exactly the same goods. There are three standard methods.
| Method | Assumes you sell… | COGS in rising prices |
|---|---|---|
| FIFO (first-in, first-out) | Oldest stock first | Lower — uses old, cheaper costs |
| LIFO (last-in, first-out) | Newest stock first | Higher — uses recent, dearer costs |
| Weighted average | A blended-cost unit | In between FIFO and LIFO |
Same goods sold, three different COGS figures — the method is an accounting choice, not a physical one.
- FIFO assigns the cost of your earliest purchases to COGS, leaving recent (often higher) costs in ending inventory. In a period of rising prices this gives the lowest COGS and the highest reported profit — and the highest tax.
- LIFO does the reverse: it charges your most recent, usually higher, costs to COGS, giving a higher COGS and lower taxable profit when prices rise. LIFO is permitted under US GAAP but banned under IFRS.
- Weighted average blends every purchase price by quantity into one average cost per unit, landing COGS between the FIFO and LIFO figures and smoothing out price swings.
COGS and gross margin
COGS only matters because of what sits next to it: gross profit and gross margin. Subtract COGS from revenue and you get gross profit; divide that by revenue and you get the gross margin — the share of every sales dollar left after the cost of the product. The COGS ratio is simply the mirror image: COGS ÷ revenue, the share that production ate.
Because gross margin is size-neutral, it is the number to compare across companies and over time. A falling gross margin — a rising COGS ratio — is an early warning that input costs are climbing faster than prices, long before it shows up in the bottom line. There is no universal 'good' COGS ratio: a grocer may run a COGS ratio of 70–80% on thin margins and high volume, while a software firm's is near zero. The only fair comparison is against direct peers and the company's own trend.
Where to find the numbers for this calculator
Every figure this cost of goods sold calculator needs comes from a company's inventory records and its income statement.
- Beginning inventory — the prior period's ending inventory, carried forward from last year's balance sheet or books.
- Purchases — total inventory bought or produced this period, from your accounts payable, purchase ledger, or production cost records.
- Ending inventory — the closing stock value from a physical count or a perpetual inventory system at the period's end.
- Revenue (optional) — net sales for the period, the top line of the income statement, to also get gross profit and the COGS ratio.
Formula and sources
This calculator uses the standard inventory-accounting definition of cost of goods sold — COGS = beginning inventory + purchases − ending inventory — together with gross profit = revenue − COGS and the COGS ratio = COGS ÷ revenue. The formula, the components included in COGS, and the FIFO / LIFO / weighted-average distinction follow the conventions set out in US GAAP, the IRS instructions for reporting cost of goods sold, and standard corporate-finance references.
Investopedia — Cost of Goods Sold (COGS): Definition and How to Calculate It.Frequently asked questions about the free cost of goods sold calculator
About this cost of goods sold calculator
This cost of goods sold calculator runs entirely in your browser. Every figure you enter stays on your device — nothing is sent to a server, logged, or shared. It applies the standard inventory formula COGS = beginning inventory + purchases − ending inventory, then subtracts COGS from revenue for gross profit and divides COGS by revenue for the COGS ratio, updating instantly as you type.
Calculators Cloud offers 400+ free tools with no sign-up. The whole Business calculators shelf includes Profit margin, Markup, and EBIT tools alongside this one. Or browse the full calculator directory.