Cost of Sales Calculator
Cost of sales = beginning inventory + purchases + direct labor + freight-in - ending inventory. Example A: 120,000 + 540,000 + 18,000 - 95,000 = $583,000, a 65.51 percent ratio on $890,000 of net sales.
All calculations run in your browser. Nothing you type is uploaded anywhere.
Add up beginning inventory, purchases and direct costs, subtract ending inventory, and turn cost of sales into a ratio and gross margin.
Key takeaways
- Cost of sales = beginning inventory + purchases + direct labor + freight-in + other direct costs - ending inventory
- Example A: 120,000 + 540,000 + 18,000 - 95,000 = $583,000, a 65.51 percent ratio and $307,000 of gross profit on $890,000 of sales
- Cost of sales ratio = cost of sales x 100 / net sales, and gross margin is 100 minus the ratio
- Example B, a maker with direct labor: $426,000 of cost of sales on $600,000 of sales, a 71.00 percent ratio and $213 of cost per unit
- One point of ratio on $890,000 of sales is $8,900 of gross profit, which is why the ratio is worth tracking every period
On this page
What Cost of Sales Covers
Cost of sales is the direct cost of the goods or services you sold in a period. That means the merchandise a store bought, the raw materials a factory turned into product, the labor that touched the product, and the freight to get materials in the door. It is usually the single largest expense line on an income statement, which makes it the fastest place to look when profit moves without any change in sales.
The line's boundaries matter. Rent for the office, the sales team's salaries, marketing, accounting software and insurance all sit below cost of sales, in operating expenses. Putting an indirect cost into cost of sales, or leaving a direct one out, quietly changes gross margin and makes two businesses look alike or different when they are not.
Public companies report the same concept as cost of sales or cost of revenue on their income statements, and small businesses report it on tax returns. The formula below is the one IRS Publication 334 uses for cost of goods sold on Schedule C, and it works for a one person Etsy shop and a multi warehouse retailer alike.
The Cost of Sales Formula
The calculator adds up everything that went into what you sold, then removes what you still hold.
Cost of sales = beginning inventory + purchases + direct labor + freight-in + other direct costs - ending inventory.
Cost of sales ratio = cost of sales x 100 / net sales.
Gross profit = net sales - cost of sales.
Example A shows the flow: a retailer starts the year with $120,000 of inventory, buys $540,000 more, pays $18,000 of freight-in and ends the year with $95,000 on the shelves. Cost of sales is 120,000 + 540,000 + 18,000 - 95,000 = $583,000. On $890,000 of net sales, the ratio is 583,000 x 100 / 890,000 = 65.51, so every sales dollar carried 65.5 cents of direct cost, leaving gross profit of 890,000 - 583,000 = $307,000.
The inventory difference is the part people skip. Purchases alone are not cost of sales, because some of what you bought is still unsold stock. Ending inventory is subtracted for the same reason: cash spent on goods you still own is not yet a cost of anything you sold.
Cost of Sales vs Operating Expenses
The dividing line is causation. Cost of sales rises and falls with the volume you sell; operating expenses run whether you sell anything or not. When in doubt, ask whether the cost would disappear if you sold nothing tomorrow. The inventory on the shelf and the labor that built it would; the lease on the showroom would not.
| Cost | Where it belongs | Why |
|---|---|---|
| Merchandise or raw materials bought for resale | Cost of sales | Direct: it exists only to be sold |
| Direct labor on the product | Cost of sales | Tied to units made or sold |
| Freight-in on materials | Cost of sales | Cost of getting goods ready to sell |
| Shipping to customers | Usually operating expense | Frequently reported below the line; some firms include it |
| Rent, utilities, office salaries, marketing, insurance | Operating expense | Indirect: they run even with zero sales |
IRS Publication 334 walks through the same split for Schedule C filers: merchandise bought for sale and costs that go into inventory belong in cost of goods sold, while selling and administrative costs do not (IRS Publication 334). For a manufacturer, some factory overhead such as equipment depreciation and factory utilities gets allocated into the inventory cost, which is why a maker's cost of sales carries more lines than a reseller's.
The Ratio and Gross Margin
The cost of sales ratio, cost of sales divided by net sales, is the number to track over time, because it normalizes for growth. Gross margin is its mirror image: gross margin = 100 - cost of sales ratio. Example A's 65.51 percent ratio means a 34.49 percent gross margin, so a $1 sale leaves 34.5 cents to cover rent, marketing, payroll and profit.
Small ratio moves are big money. Example A sells $890,000 a year, so a single point of ratio is 890,000 x 0.01 = $8,900 of gross profit. If supplier inflation pushed the ratio from 65.51 to 68.00 percent on the same sales, cost of sales would rise to 890,000 x 0.68 = $605,200 and the year would give up 605,200 - 583,000 = $22,200 of gross profit with no change in revenue.
The Census Bureau's Annual Retail Trade Survey publishes gross margin ratios by retail industry, so you can benchmark your ratio against your trade before deciding whether a change is your problem or the market's (Census Bureau ARTS). Grocery retail runs on thin margins and high turns; furniture runs the other way. Comparing a bike shop to a supermarket tells you nothing.
| Cost of sales ratio | Gross margin | Gross profit on $890,000 of sales |
|---|---|---|
| 60.00% | 40.00% | 890,000 x 0.4 = $356,000 |
| 65.51% (Example A) | 34.49% | $307,000 |
| 71.00% (Example B) | 29.00% | 890,000 x 0.29 = $258,100 |
Service Businesses Have No Inventory
A consultant, agency, salon or repair shop sells time and skill, so the inventory terms are zero. Cost of sales does not disappear: it becomes the labor and contract costs delivered to clients. The formula still works, just enter zero for beginning and ending inventory and use the other fields.
Example: a design agency bills $900,000 for the year. Its designers' direct salaries are $380,000 and freelance subcontractors cost $40,000, with no materials to speak of. Cost of sales is 0 + 0 + 380,000 + 0 + 40,000 - 0 = $420,000, a ratio of 420,000 x 100 / 900,000 = 46.67 percent and a gross margin of 53.33 percent. The agency's rent and the owner's admin staff stay in operating expenses.
The judgment call for a service business is which salaries are direct. A developer assigned full time to client projects is cost of sales; the same developer on internal tooling is not. Many firms split a person's pay by the share of their time that is billable, which is the same logic a manufacturer uses when it allocates labor to work in process.
Two Worked Examples
Example A is the retailer from the formula section: $120,000 beginning inventory, $540,000 of purchases, $18,000 freight-in, $95,000 ending inventory, $890,000 of net sales and 1,500 units sold. Cost of sales is $583,000, the ratio 65.51 percent, gross profit $307,000 and the cost per unit sold is 583,000 / 1,500 = $388.67 against an average selling price of 890,000 / 1,500 = $593.33.
Example B is a small maker that builds its own product: $40,000 beginning inventory, $260,000 of materials bought, $150,000 of direct labor, $6,000 freight-in and $30,000 ending inventory. Cost of sales is 40,000 + 260,000 + 150,000 + 6,000 - 30,000 = $426,000. On $600,000 of sales the ratio is 426,000 x 100 / 600,000 = 71.00 percent, and gross profit is 600,000 - 426,000 = $174,000. Across 2,000 units that is 426,000 / 2,000 = $213 of cost per unit against a $300 price, leaving $87 of gross profit per unit.
| Line item | Example A (retailer) | Example B (maker) |
|---|---|---|
| Beginning inventory | $120,000 | $40,000 |
| Purchases | $540,000 | $260,000 |
| Direct labor | $0 | $150,000 |
| Freight-in and other direct | $18,000 | $6,000 |
| Ending inventory | $95,000 | $30,000 |
| Net sales | $890,000 | $600,000 |
| Cost of sales | $583,000 | $426,000 |
| Cost of sales ratio | 65.51% | 71.00% |
| Gross profit / margin | $307,000 / 34.49% | $174,000 / 29.00% |
| Cost per unit sold | $388.67 | $213.00 |
Using the Ratio to Catch Problems
Run the ratio period by period and investigate any move you cannot explain. A rising ratio on flat sales usually traces to one of four places: price discounting that shrank net sales, supplier or freight inflation that grew direct costs, inventory that was written down or shrinkage that was never recorded, or a mix shift toward lower margin products. Each has a different fix, and the ratio tells you that something moved long before the profit and loss statement makes it obvious.
Unit economics sharpen the picture. Example B earns 300 - 213 = $87 of gross profit per unit, so a 5 percent materials increase that adds 10.65 of unit cost takes 12 percent of the unit margin before anyone touches the budget. Selling more units does not fix a negative or thin unit margin; it just multiplies it.
| Scenario, Example A's $890,000 of sales | Cost of sales | Gross profit |
|---|---|---|
| Ratio holds at 65.51% | $583,000 | $307,000 |
| Ratio drifts to 66.51% | $591,900 | $298,100 |
| Ratio drifts to 68.00% | $605,200 | $284,800 |
The drift rows show the quiet leak: two and a half points of ratio cost Example A $22,200 of gross profit, the same amount as losing about $64,000 of sales at the original margin. Counting stock accurately at year end is part of the discipline, because an overstated ending inventory hides cost in the balance sheet and flatters this year's ratio at next year's expense.
Frequently asked questions
What is the formula for cost of sales?
Cost of sales = beginning inventory + purchases + direct labor + freight-in + other direct costs - ending inventory. Example A: 120,000 + 540,000 + 18,000 - 95,000 = $583,000 on $890,000 of net sales.
What is a good cost of sales ratio?
It depends on the trade: groceries run high ratios on fast turns while furniture runs the opposite. Judge your own trend first and benchmark against your industry; the Census Bureau's Annual Retail Trade Survey publishes gross margins by retail sector. A ratio of 65.51 percent on Example A's sales leaves a 34.49 percent margin.
How do I calculate cost of sales from purchases?
Add beginning inventory to purchases and direct costs, then subtract ending inventory. Buying $540,000 of goods does not cost you $540,000 in cost of sales if $95,000 of it is still on the shelf at year end.
What is the difference between cost of sales and COGS?
They describe the same idea: the direct cost of what you sold. Cost of goods sold is the tax return term used on Schedule C and IRS Publication 334; cost of sales or cost of revenue is the income statement label public companies use.
Are salaries included in cost of sales?
Only direct labor, the pay of people who make or handle the product. Office staff, salespeople and management belong in operating expenses. Example B carries $150,000 of direct labor inside its $426,000 of cost of sales.
Is shipping included in cost of sales?
Freight-in, the cost of getting materials to you, belongs in cost of sales, which is why Example A adds $18,000 of it. Shipping to customers is usually an operating expense, though some companies report it inside cost of sales, so check where a peer puts it before comparing.
How do I calculate gross margin from cost of sales?
Gross profit = net sales - cost of sales, and gross margin = gross profit x 100 / net sales. Example A: 890,000 - 583,000 = $307,000 of gross profit, a 34.49 percent margin on $890,000.
What does a rising cost of sales ratio mean?
Something in the direct cost chain moved: price discounting, supplier or freight inflation, inventory shrinkage or a mix shift to lower margin products. On Example A's $890,000 of sales, a drift from 65.51 to 68.00 percent gives up 605,200 - 583,000 = $22,200 of gross profit.
How does cost of sales work for a service business?
Enter zero for both inventory figures and use direct labor and subcontractors as your cost lines. An agency with $380,000 of direct pay and $40,000 of freelancers on $900,000 of revenue has cost of sales of $420,000 and a 46.67 percent ratio.
How do I find cost per unit sold?
Divide cost of sales by units sold. Example B: 426,000 / 2,000 = $213 per unit against a $300 average price, which leaves $87 of gross profit per unit. Example A: 583,000 / 1,500 = $388.67 per unit.
Does ending inventory affect cost of sales?
Every dollar of ending inventory removes a dollar of cost, because unsold goods are still an asset. Overstating ending inventory therefore flatters this year's cost of sales and pushes the error into next year, which is why physical counts matter.
Where does cost of sales appear on a tax return?
For a Schedule C filer it is line 42, built from inventory at the beginning of the year, purchases, costs of labor and materials, and other costs, minus inventory at the end of the year, following IRS Publication 334.
Spotted a wrong number or a broken result?
More Finance tools
- $100,000 Loan for 15 Years Calculator
- $15 an Hour Is How Much a Year?
- $15,000 Loan Over 5 Years Calculator
- $20 an Hour Is How Much a Year?
- $25 an Hour Is How Much a Year?
- $30 an Hour Is How Much a Year?
- 1 Year CD Rate Calculator
- 10 Year ARM Mortgage Calculator
- 10 Year Equipment Loan Calculator
- 10-Year Balloon Mortgage Calculator
- 10-Year Fixed Loan Calculator
- 10-Year Fixed Mortgage Calculator
- 10-Year Fixed Mortgage Rates Calculator
- 10-Year Second Mortgage Calculator
- 10/1 ARM vs 30 Year Fixed Calculator
- 1099 vs W-2 Calculator
Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.