# Cost of goods sold formula: how to calculate COGS > https://rundoo.ai/resources/guides/cost-of-goods-sold-formula/ [Guides](/resources/guides/index.md) /Product Product # Cost of goods sold formula: how to calculate COGS Cost of goods sold is beginning inventory plus purchases minus ending inventory, and for a supply store the hard part is knowing what belongs in purchases, so here is the formula mapped to Schedule C, a worked example, and what freight, payroll, and shrink do to the number. [![Titus Capilnean](https://pub-5247264bd04e4ebeaecbbedb3bebb9f8.r2.dev/static/images/articles/titus-capilnean.jpeg)](https://www.linkedin.com/in/tituscapilnean/) [Titus Capilnean](https://www.linkedin.com/in/tituscapilnean/), Head of Marketing October 27, 2026 Last updated October 27, 2026 **This is not tax advice.** It is a general guide for store owners, drawn from the public sources it cites, and rules change and vary by state. Before you change how you price, tax, or bill, talk to a certified professional: a CPA or tax advisor who knows your state. The cost of goods sold formula is beginning inventory, plus purchases, minus ending inventory, which equals what the merchandise you sold during the year cost you. It is the same calculation the IRS walks you through on Schedule C (Form 1040), and for a store that resells goods, it is the cost of what left the building, valued at what you paid for it rather than what you sold it for. Everything else in this guide is about making sure the three numbers in that formula are right, because COGS is the number your gross margin, your inventory turns, and a good chunk of your tax return are built on. ## What COGS means for a store that resells goods You don't manufacture anything (unless you're milling lumber in the back, and even then, stick with us). You buy paint, fasteners, feed, and board feet from vendors, put them on shelves, and sell them to contractors and walk-ins, so your COGS is the cost of the goods that sold during the year. That framing tells you what belongs in the formula and what doesn't. The pallet of screws you bought is a purchase, the screws that sold are cost of goods sold, and the screws still on the shelf at year end are ending inventory, which gets subtracted back out because you haven't sold them yet. Your ending inventory becomes next year's beginning inventory, so the formula keeps rolling forward one year at a time. ## The formula line by line, mapped to Schedule C [IRS Publication 334 (2025), the Tax Guide for Small Business](https://www.irs.gov/publications/p334), walks this calculation through Part III of Schedule C for sole proprietors, and corporations and partnerships do the same math on Form 1125-A. Here is the formula with the line numbers your tax preparer is filling in: | Schedule C line | What it is | Role in the formula | | --- | --- | --- | | Line 35 | Inventory at beginning of year | Beginning inventory | | Line 36 | Purchases less cost of items withdrawn for personal use | Purchases (the big one) | | Line 37 | Cost of labor | Usually zero for retailers | | Line 38 | Materials and supplies | Used in manufacturing, so usually empty for a store | | Line 39 | Other costs | Freight-in lives here | | Line 40 | Add lines 35 through 39 | Cost of goods available for sale | | Line 41 | Inventory at end of year | Ending inventory | | Line 42 | Cost of goods sold (line 40 minus line 41) | Your COGS | Line 40 deserves a name of its own: cost of goods available for sale, meaning everything you could have sold during the year, at cost. Subtract what is still sitting on the shelves (line 41) and what remains is, by definition, what sold. That is line 42, the number that comes off your revenue before you ever get to rent, payroll, or profit. ## A worked example with store-sized numbers Say you run a hardware and paint store. On January 1 your inventory at cost is $410,000, over the year you take in $1,020,000 of merchandise (net of trade discounts and purchase returns), and the freight-in on all those trucks adds another $18,000. At year end you count $440,000 still on hand. | Step | Amount | | --- | --- | | Beginning inventory, at cost | $410,000 | | Purchases, net of discounts and returns | $1,020,000 | | Freight-in | $18,000 | | Cost of goods available for sale | $1,448,000 | | Ending inventory, at cost | $440,000 | | **Cost of goods sold** | **$1,008,000** | If your net sales for the year were $1,600,000, your gross profit is $592,000, a 37.0% gross margin. That margin is the money you run the store on, so getting COGS right is not bookkeeping trivia, because it is the difference between thinking you're making money and knowing it. ## What goes into COGS and what stays out This is where most COGS mistakes happen, and Publication 334 is more specific than people expect. | In COGS | Out of COGS | | --- | --- | | Merchandise purchased for resale, at the net price after trade discounts | Payroll for counter staff and yard crew | | Freight-in, express-in, cartage-in | Rent and utilities | | Purchases reduced by returns and allowances | Card processing fees | | | Freight-out to deliver to customers | | | Merchandise pulled for personal or family use | **Freight-in counts.** Publication 334 says "freight-in, express-in, and cartage-in on ... merchandise you purchase for sale are all part of cost of goods sold." That freight should be capitalized into the cost of the inventory and flow into COGS when the goods sell, not expensed the day the carrier bill shows up, and our guide on [landed cost for retail inventory](/resources/guides/landed-cost-for-retail-inventory/index.md) walks through spreading freight and fees across a purchase order. **Trade discounts come off the top.** Use only the net amount as your cost of merchandise purchased. Cash discounts for prompt payment can either go to a separate discount account or reduce your total purchases, but you have to pick one treatment and stay consistent, and you must deduct all purchase returns and allowances from total purchases. **Payroll stays out.** In Publication 334's words, "small merchandisers (wholesalers, retailers, etc.) usually do not have labor costs that can properly be charged to cost of goods sold." Your counter staff's wages are an operating expense, and freight-out to deliver an order to a customer is a selling expense for a similar reason: it is a cost of selling, not a cost of the goods. **The paint you take home stays out too.** Merchandise withdrawn for personal or family use has to be excluded from purchases, which is why line 36 is worded the way it is. Supplies the store uses up itself, as opposed to goods it sells, are generally deducted as a business expense when used, so ask your accountant how to record the box of trash bags you pulled off your own shelf. ## Periodic vs perpetual: two ways to the same number There are two ways a store arrives at COGS, and the difference is when you learn the number. Under the **periodic method**, you only know COGS after you count. You track purchases all year, do a big count at year end, plug beginning inventory, purchases, and ending inventory into the formula, and out comes COGS. It is the method the tax form is built around, and for a lot of stores it is the only time of year the number exists. Under the **perpetual method**, your POS records the cost of every item at the moment of the sale, usually at average cost, so COGS accumulates all year long and a profit and loss pulled on a Tuesday in June means something. The catch is that perpetual COGS is built from what the system thinks you have, so you still count, ideally with [regular cycle counts](/resources/guides/cycle-counting-for-retail-stores/index.md) rather than one annual marathon. At the count, the perpetual number and the count-based number should reconcile, and whatever doesn't is shrink or a receiving error. ## How shrink, count errors, and cost method move the number Take the worked example above, but say your year-end count comes in $12,000 light, so ending inventory is $428,000 instead of $440,000. Run the formula again and COGS climbs from $1,008,000 to $1,020,000, while your gross margin sags from 37.0% to 36.25%. You didn't sell more goods, but COGS went up anyway, because under the periodic method shrink hides inside COGS. The formula can't tell the difference between a gallon of paint a contractor bought and a gallon that grew legs, and stolen, broken, misreceived, or nibbled by whatever lives behind the feed pallets, it all lands on line 42. That is why [retail shrink](/resources/guides/retail-shrink-hardware-and-feed-stores/index.md) is worth tracking as its own number instead of letting it blend into the cost of everything you sold. Count errors do the same damage in both directions. Miss a pallet in the back corner of the lumber shed and COGS inflates, while counting the same skid twice deflates it, which feels nice until next year, when the error reverses and your margin takes the hit. Your cost method matters too. Publication 334 requires inventory to be valued at the beginning and end of each tax year, with a method that conforms to generally accepted accounting principles for similar businesses, clearly reflects income, and stays consistent from year to year. Average cost, where every receipt updates a running cost per item, is a common choice in a perpetual system, and which method fits your books is a question for your accountant. One more note from the same publication: a small business taxpayer, one with average annual gross receipts of $31 million or less for the three prior tax years (indexed for inflation) that is not a tax shelter, can choose not to keep an inventory, though it still needs a method that clearly reflects income. If that exception sounds like you, it is a conversation for your accountant, not a web page. ## Where COGS goes next: gross margin and inventory turns COGS is an ingredient, and it feeds two numbers every supply store should watch. **Gross margin** is net sales minus COGS, divided by net sales, and it is the pool of money that pays rent, payroll, insurance, and you. Our [gross margin formula guide](/resources/guides/gross-margin-formula/index.md) goes deeper, but the short version is that a one-point margin swing on $1.6 million in sales is $16,000, so the shrink example above is not small money. **Inventory turns** measure how fast stock sells through and gets replaced, and the formula is COGS divided by average inventory at cost. From the example, average inventory is ($410,000 + $440,000) ÷ 2 = $425,000, and $1,008,000 ÷ $425,000 gives you 2.37 turns. Whether that is healthy depends on your mix, and the [inventory turnover and GMROI guide](/resources/guides/inventory-turnover-ratio-and-gmroi-for-hardware-stores/index.md) has the benchmarks and the math. ## How Rundoo handles cost of goods sold Rundoo tracks inventory perpetually, so COGS builds with every sale instead of arriving as one January surprise. It keeps two costs per product: average cost, which every receipt updates and which drives cost of goods sold and margin reporting, and standard cost, which margin-based price tiers compute from. Freight and fees on a purchase order can be distributed into each line's cost, so they flow into average cost and into COGS when the items sell. On the accounting side, Rundoo posts two aggregated journal entries per day per location to QuickBooks: a Sales Journal that includes cost of goods sold, and a Purchase Journal that posts vouchered purchase orders as vendor bills to Inventory and Accounts Payable. Rundoo also keeps its own general ledger, profit and loss, and balance sheet under Admin > Reporting, and every general ledger entry drills back to the transaction behind it. Rundoo does not replace your accounting system, since stores keep QuickBooks for accounting and payroll, and the [QuickBooks sync guide](/resources/guides/pos-that-syncs-with-quickbooks-online/index.md) covers how the two fit together. Share Topics [Product](/resources/guides/index.md#pricing-and-payments) [← All guides](/resources/guides/index.md) ## Frequently asked questions How do you calculate cost of goods sold? Take your beginning inventory at cost, add your purchases for the year (net of trade discounts and purchase returns, plus freight-in), and subtract your ending inventory at cost. A store that starts the year with $410,000 of inventory, buys $1,020,000 of merchandise, pays $18,000 of freight-in, and ends the year with $440,000 on hand has a cost of goods sold of $1,008,000. On Schedule C (Form 1040) this is lines 35 through 42. Is freight included in cost of goods sold? Freight-in is, freight-out is not. IRS Publication 334 says freight-in, express-in, and cartage-in on merchandise you buy for resale are part of cost of goods sold, and the cleanest way to handle it is to build that freight into your inventory cost so it flows into COGS when the goods sell. Freight to deliver orders to your customers is a selling expense and belongs with your operating expenses. Is payroll part of COGS for a retail store? Usually not. IRS Publication 334 says small merchandisers, including wholesalers and retailers, usually do not have labor costs that can properly be charged to cost of goods sold. Wages for counter staff, yard crew, and delivery drivers are operating expenses for a store that resells goods. What is the difference between COGS and operating expenses? Cost of goods sold is the cost of the merchandise itself: what you paid vendors, plus freight-in, for the goods that sold. Operating expenses are the costs of running the store, such as payroll, rent, utilities, card processing fees, and outbound delivery. Sales minus COGS is gross profit, and gross profit minus operating expenses is operating profit. Does shrink increase cost of goods sold? Yes. When your year-end count finds less inventory than you expected, ending inventory is lower, the formula subtracts a smaller number, and COGS rises by the missing amount. In a worked example, $12,000 of shrink pushes COGS from $1,008,000 to $1,020,000 and takes gross margin on $1,600,000 of sales from 37.0% to 36.25%, even though no extra goods were sold. ## Find out what Rundoo can do for your business Learn how Rundoo can help you save time, money and hassle running your business. [Book a demo](/signup/index.md) ! ## See Rundoo in action [Product ### Tour the platform POS, inventory, payments, and AI for independent supply stores, in one system.](/product/index.md) [Customers ### Read customer stories See how real paint, hardware, farm, garden, and lumber stores run on Rundoo.](/clients/index.md) ## Keep reading [![Break-even point for a retail store, with worked math](https://pub-5247264bd04e4ebeaecbbedb3bebb9f8.r2.dev/static/images/articles/break-even-point-for-a-retail-store-photo.jpg) Product ### Break-even point for a retail store, with worked math A store's break-even point is its fixed costs divided by its contribution margin, so a supply store with $45,000 of monthly fixed costs and a 40% margin needs $112,500 of sales a month, about 111 customers a day, and here is how to run that math for your own store, a new hire, or a delivery truck.](/resources/guides/break-even-point-for-a-retail-store/index.md) [![Penny rounding: cash rounding to the nearest nickel](https://pub-5247264bd04e4ebeaecbbedb3bebb9f8.r2.dev/static/images/articles/cash-rounding-without-pennies-photo.jpg) Product ### Penny rounding: cash rounding to the nearest nickel With the penny out of production in the US and long gone in Canada, stores round the after-tax cash total to the nearest five cents and leave card, debit, check, and charge account sales exact to the cent, so here is the rule for every ending, worked examples, what states said about sales tax, and how to keep the drawer and the books straight.](/resources/guides/cash-rounding-without-pennies/index.md) [![Chargebacks: how they work and how to fight one](https://pub-5247264bd04e4ebeaecbbedb3bebb9f8.r2.dev/static/images/articles/chargebacks-for-retail-stores-photo.jpg) Product ### Chargebacks: how they work and how to fight one A chargeback is a card payment the customer's bank reverses and pulls back through your processor, so here is how the four Visa dispute categories work, what evidence wins, how to respond step by step, and how a supply store prevents the common ones.](/resources/guides/chargebacks-for-retail-stores/index.md)