The gross margin formula
Gross margin = gross profit ÷ revenue × 100
Markup = gross profit ÷ COGS × 100
Price for a target margin = cost ÷ (1 − margin)
Gross margin looks only at the cost of the goods themselves. It tells you how much of each sales dollar is left to pay for everything else, like rent, wages and marketing. For margins after those costs (operating and net margin) or a quick margin-vs-markup conversion, use the profit margin calculator.
Worked example
A shop sells $50,000 of goods that cost it $30,000.
- Gross profit = 50,000 − 30,000 = $20,000
- Gross margin = 20,000 ÷ 50,000 = 40%
- Markup = 20,000 ÷ 30,000 = 66.67%
Working backwards: an item that costs $30 needs a price of 30 ÷ (1 − 0.40) = $50 for a 40% gross margin.
What goes in cost of goods sold
COGS is the direct cost of the goods you actually sold in the period, not everything you spent. The IRS works it out from your inventory, the same way Schedule C (Part III) does:
- In COGS: products bought for resale, raw materials and parts, the wages of people who make the product, and costs to get goods ready to sell, such as freight-in (shipping to bring inventory to you) and containers or packaging that are part of the product.
- Not in COGS: rent on a store or office, marketing, office and sales salaries, shipping to customers (freight-out) and interest. Those are operating expenses and lower your operating margin, not your gross margin.
Why inventory changes the answer
If you buy more than you sell, the extra sits in ending inventory and isn't part of COGS yet. Say you start the year with $8,000 of stock, buy $34,000 more, pay $1,000 of freight-in and count $13,000 left at year end. COGS is 8,000 + 34,000 + 1,000 − 13,000 = $30,000, even though you spent $35,000 in the year. Counting purchases as COGS would understate your gross margin in a year you stock up and overstate it in a year you sell inventory down. How you value inventory (for example first-in, first-out) also moves COGS when prices change.
Typical gross margins by industry
A "good" gross margin depends on what you sell. Aswath Damodaran of NYU Stern publishes average margins for US public companies. His January 2026 data shows:
| Industry | Gross margin |
|---|---|
| Auto and truck makers | 10.41% |
| Grocery and food retail | 26.31% |
| Restaurants and dining | 32.24% |
| Apparel | 56.88% |
| Semiconductors | 58.97% |
| Software (system and application) | 71.72% |
| All US companies in the data | 37.76% |
These are averages for large public companies, which may count costs differently from a small business. Compare yourself with businesses like yours, and track your own margin over time.
Getting a realistic number
- Use the same period for revenue and COGS, and take returns and discounts off revenue first.
- Count inventory at the start and end of the period; don't just add up purchases.
- For more on reading margins, see what is gross margin?