Cost of Goods Sold Calculator
Cost of goods sold adds everything you spent to get products ready to sell, then subtracts what you still own at year end. A shop with 165,000 dollars of goods available and 45,000 dollars left at year end sold 120,000 dollars of goods.
| Cost of goods sold | |
| Goods available for sale | |
| Gross profit | |
| Gross margin | |
| COGS as a share of sales | |
| Inventory turns per year | |
| Days of inventory on hand | |
Lines follow IRS Schedule C, Part III. Leave sales at 0 if you only want the COGS figure. All calculations run in your browser and no data is uploaded.
Add up what your goods cost you during the year, subtract what you still hold, and see the gross margin those sales left behind.
Key takeaways
- COGS = beginning inventory + purchases + freight-in + direct labor + other direct costs - ending inventory
- The worked shop: 40,000 + 120,000 + 5,000 = 165,000 dollars available, then 165,000 - 45,000 = 120,000 dollars of COGS
- On 200,000 dollars of sales that is 80,000 dollars of gross profit, a 40 percent gross margin
- Freight-in belongs in COGS; freight-out to ship orders is an operating expense (IRS Publication 334, 2025)
- A small business taxpayer with 31 million dollars or less in average gross receipts can skip the annual inventory count (IRS, tax years beginning in 2025)
On this page
What cost of goods sold covers
Cost of goods sold, usually written COGS, is what the products you sold this year cost you to buy or make. Sell a wrench, and the COGS is what you paid the wholesaler plus the freight to get it to your shelf. Sell a cabinet you built, and the COGS is the lumber, the screws, the finish and the shop labor that went into it. Money spent on rent, ads, insurance and your own pay lives somewhere else on the return.
IRS Publication 334 (2025), chapter 6 applies the idea to anyone who makes, buys or sells goods to produce income, and it leaves out personal service businesses such as doctor, lawyer and painter practices. The Census Bureau uses the same split in its retail data: its Annual Retail Trade Survey glossary defines gross margin as total sales less cost of goods sold. The number does two jobs at once. On a tax return it reduces taxable income. On a profit and loss statement it tells you what a sales dollar has left to cover everything else.
The calculator below follows the Schedule C structure that a sole proprietor files with Form 1040. It is an estimating tool for planning, not tax advice; your bookkeeping software or accountant works from your actual records.
The formula, line by line
The whole thing rests on one idea: the goods you had to sell this year either left the building or did not.
COGS = beginning inventory + purchases + freight-in + direct labor + materials and supplies + other direct costs - ending inventory
Everything you added to stock during the year joins whatever was on the shelf on January 1. Whatever is still on the shelf on December 31 comes back out, because you have not sold it yet. The IRS instructions for Schedule C (2025) line the steps up like this:
| Schedule C line | What goes there |
|---|---|
| 35. Inventory at beginning of year | Your opening stock at cost |
| 36. Purchases | Merchandise bought for resale, net of returns and personal withdrawals |
| 37. Cost of labor | Direct and indirect factory labor; not amounts paid to yourself |
| 38. Materials and supplies | Hardware, chemicals and parts used in production |
| 39. Other costs | Freight-in, containers, and overhead allocated to production |
| 40. Add lines 35 through 39 | Cost of goods available for sale |
| 41. Inventory at end of year | Your closing stock at cost |
| 42. Cost of goods sold | Line 40 minus line 41 |
A few details from Publication 334 matter in practice. Purchases on line 36 are net of returns and allowances, and net of anything you took home for personal use. Trade discounts come off: you use the price you paid, not the sticker. Freight to bring goods in belongs on line 39 with other costs, while the freight you pay to send orders out is a selling expense, not COGS. And the ending inventory you subtract becomes next year's beginning inventory, so a counting error this year repeats itself next year with the opposite sign.
Worked example: a retail shop
Take a hardware store that starts the year with 40,000 dollars of stock on the shelves. During the year it buys 120,000 dollars of merchandise and pays 5,000 dollars of freight on those inbound deliveries. At the end of the year the shelves hold 45,000 dollars of goods. Sales for the year came to 200,000 dollars.
| Line | Amount |
|---|---|
| Beginning inventory | 40,000 dollars |
| Purchases | 120,000 dollars |
| Freight-in | 5,000 dollars |
| Goods available for sale | 40,000 + 120,000 + 5,000 = 165,000 dollars |
| Ending inventory | 45,000 dollars |
| Cost of goods sold | 165,000 - 45,000 = 120,000 dollars |
| Sales | 200,000 dollars |
| Gross profit | 200,000 - 120,000 = 80,000 dollars |
| Gross margin | 80,000 / 200,000 x 100 = 40 percent |
Of every sales dollar, 60 cents went back out the door as product cost and 40 cents stayed to pay rent, utilities, payroll and, if things go well, the owner. Those 40 cents are the working margin for the whole business; a bad month on rent shows up against it, not inside COGS.
A maker, and one product at a time
A manufacturer carries more lines. Say a small shop starts the year with 12,000 dollars of work in progress and finished goods, buys 30,000 dollars of raw material, pays 1,500 dollars of inbound freight, 18,000 dollars of direct labor and 2,500 dollars of other production costs, and ends the year with 10,000 dollars on hand. Sales were 96,000 dollars.
| Line | Amount |
|---|---|
| Beginning inventory | 12,000 dollars |
| Purchases | 30,000 dollars |
| Freight-in | 1,500 dollars |
| Direct labor | 18,000 dollars |
| Other costs | 2,500 dollars |
| Goods available for sale | 12,000 + 30,000 + 1,500 + 18,000 + 2,500 = 64,000 dollars |
| Ending inventory | 10,000 dollars |
| Cost of goods sold | 64,000 - 10,000 = 54,000 dollars |
| Sales | 96,000 dollars |
| Gross profit | 96,000 - 54,000 = 42,000 dollars |
| Gross margin | 42,000 / 96,000 x 100 = 43.75 percent |
You can also run the same logic on one product. A candle maker spends 4.20 dollars on wax and fragrance, 0.60 dollars on the jar and lid, 1.10 dollars of pour labor and 0.85 dollars of allocated overhead on each unit, so one candle costs 4.20 + 0.60 + 1.10 + 0.85 = 6.75 dollars to make. Making 1,000 candles puts 1,000 x 6.75 = 6,750 dollars into inventory. Sell 900 of them at 12.50 dollars and COGS is 900 x 6.75 = 6,075 dollars, the 100 candles left over are 100 x 6.75 = 675 dollars of ending inventory, and 6,075 + 675 = 6,750 ties out to the penny. Gross profit on the candles is 900 x 12.50 - 6,075 = 5,175 dollars, a margin of 5,175 / 11,250 x 100 = 46 percent.
COGS is not every cost
The line between product cost and operating expense decides whether a number lands in COGS or below it. Most calls are easy once you ask whether the cost exists only because goods were bought, made or moved in:
| Cost | Where it belongs |
|---|---|
| Freight to bring goods in | COGS |
| Freight to ship orders to customers | Operating expense |
| Packaging that travels with the product | COGS |
| Production overhead for a manufacturer | COGS |
| Rent, utilities, insurance | Operating expense |
| Advertising and marketing | Operating expense |
| Owner pay or draw | Operating expense, never COGS |
| Sales tax collected from customers | Neither, it is not income |
Two confusions cause most of the trouble. The first is freight: inbound freight is part of getting the product ready to sell, outbound freight is part of making the sale. The second is your own pay. Publication 334 is plain that line 37 does not include amounts paid to yourself; an owner's draw is never COGS.
Valuing the inventory
Every figure above assumes you can put a dollar value on the stock. IRS Publication 538 (January 2022) describes the methods small businesses use. The cost method values goods at what you paid for them. The lower of cost or market method lets you write stock down when it is worth less than you paid. Retailers that mark goods up by a consistent percentage can use the retail method, valuing inventory at selling price and backing the margin out; Publication 538 walks through that arithmetic line by line.
Whatever method you pick, you stay with it. Changing the way you figure inventory cost requires IRS approval on Form 3115, because a switch can move income between years. Businesses that use LIFO, last in first out, file Form 970 in the first year they adopt it and keep using it on their returns for as long as they use it on their books.
What to do with the number
COGS on its own is an input to three numbers worth watching.
Gross margin is gross profit divided by sales. The SBA's glossary of business financial terms defines the gross profit margin as GP divided by net sales: the share of each sales dollar left after paying for the product. Markup divides the same gross profit by COGS instead, so one business describes itself two ways. A 40 percent margin is a 0.40 / 0.60 x 100 = 66.7 percent markup.
Inventory turnover divides COGS by average inventory, which is beginning plus ending divided by two. The hardware shop turns 120,000 / 42,500 = 2.82 times a year, which is 365 / 2.8235 = 129.3 days of stock on hand. A faster turn ties up less cash; a slower turn means money sitting on shelves.
How good any of those numbers are depends on the trade. The Census Bureau publishes gross margin as a percent of sales by kind of business in its Annual Retail Trade Survey, so compare your margin against shops that sell what you sell, not against a restaurant or a factory.
Mistakes that skew the result
Five habits move the number without anyone noticing.
Counting purchases at sticker price instead of at what you paid after discounts and returns inflates COGS. Forgetting inbound freight deflates it. Taking merchandise home without recording the withdrawal deflates purchases; Publication 334 says to credit those goods out at cost. Skipping the year end physical count is the largest single error, because shrinkage, breakage and theft only enter the books when someone counts the shelves. And mixing periods, say valuing beginning inventory from a fiscal year and ending inventory from the calendar year, makes the difference meaningless.
Service businesses get a pass on most of this. A consultant with no goods to sell leaves Part III of Schedule C empty. Materials that pass through to a job, like lumber for a carpenter, can still be tracked as supplies, but the calculator here is built for businesses that hold inventory.
Frequently asked questions
What is cost of goods sold?
The direct cost of the products you sold in a period: what you paid for merchandise, plus inbound freight, and for makers the labor and materials that went into the goods. Rent, advertising and your own pay are not COGS.
How do I calculate COGS for a small shop?
Add beginning inventory, purchases, freight-in and any direct costs, then subtract ending inventory. A shop with 40,000 + 120,000 + 5,000 = 165,000 dollars of goods available and 45,000 dollars left at year end has COGS of 120,000 dollars.
Does shipping count in COGS?
Freight you pay to bring goods in does; Publication 334 (2025) puts it on line 39 of Schedule C. Freight to ship orders to customers is a selling expense instead.
Is my own salary part of COGS?
No. Publication 334 states that cost of labor on line 37 does not include amounts paid to yourself. Owner pay and draws are never part of COGS.
What is the difference between COGS and operating expenses?
COGS rises and falls with sales volume, while operating expenses like rent and insurance do not. Gross profit is sales minus COGS, and net profit is what remains after operating expenses on top of that.
Do I have to count inventory every year?
Businesses that sell goods generally do. A small business taxpayer, one with average annual gross receipts of 31 million dollars or less for tax years beginning in 2025 per IRS Rev. Proc. 2024-40, can choose not to keep an inventory and instead treat the goods as nonincidental materials or supplies.
What inventory valuation methods does the IRS allow?
Cost, lower of cost or market, and the retail method, per Publication 538. LIFO is allowed for tax but requires Form 970 in the first year you adopt it.
Is COGS the same as purchases?
No. Purchases are one input. The shop above added 125,000 dollars of goods including freight and still sold only 120,000 dollars, because inventory grew by 5,000 dollars over the year.
How do I turn a gross margin into a markup?
Divide the margin by whatever is left of the sales dollar. A 40 percent margin is 0.40 / 0.60 x 100 = 66.7 percent markup on cost.
What is a good gross margin?
It depends on the trade. Grocery runs thin and jewelry runs wide. The Census Bureau publishes gross margin as a percent of sales by kind of business in its Annual Retail Trade Survey, so compare against your own line of business.
What if I took inventory home for personal use?
Remove the cost of those items from purchases before you total the year, as Publication 334 directs. The calculator has no separate line for it, so subtract it from your purchases figure yourself.
Can a service business use COGS?
Usually there is nothing to put there. A business that sells no goods leaves Schedule C Part III blank. Materials that go into customer jobs can be tracked as supplies instead.
How does COGS relate to inventory turnover?
Turnover is COGS divided by average inventory. The shop turns 120,000 / 42,500 = 2.82 times a year, which works out to 365 / 2.8235 = 129.3 days of stock on hand.
Spotted a wrong number or a broken result?
More Ecommerce tools
- Airbnb Host Fee Calculator
- Amazon FBA Fee Calculator
- Big Cartel Fee Calculator
- Book Printing Cost Calculator
- CBM and Chargeable Weight Calculator
- Carat Cost Calculator
- Cash App Fee Calculator
- Commission Calculator
- Craft Cost Calculator
- Custom Banner Cost Calculator
- Depop Fee Calculator
- Dimensional Shipping Weight Calculator
- DoorDash Driver Pay Calculator
- Etsy Fee Calculator
- Facebook Marketplace Fee Calculator
- Facebook Marketplace Price Calculator
Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.