Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Gross margin calculator

Enter your revenue and cost of goods sold to get gross profit, gross margin and markup. Or work backwards from a target margin to a selling price.

Private: calculated on your device. Nothing you type is sent anywhere.

Estimates for planning, not financial, tax or legal advice. Figures use US rules unless the page says otherwise.

Next: Need net or operating margin, or several costs per item? Use the profit margin calculator. Then find your break-even point.

The gross margin formula

Gross profit = revenue − cost of goods sold (COGS)
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:

COGS = beginning inventory + purchases + direct labor + materials and supplies + other direct costs − ending inventory
  • 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:

IndustryGross margin
Auto and truck makers10.41%
Grocery and food retail26.31%
Restaurants and dining32.24%
Apparel56.88%
Semiconductors58.97%
Software (system and application)71.72%
All US companies in the data37.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?

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • $50,000 revenue, $30,000 COGS: gross margin 40% ✓
  • Same: gross profit $20,000 and markup 66.67% ✓
  • $30 cost at a 40% target margin: price $50 ✓
  • $100 of sales with $120 of COGS: −20% margin ✓
  • A 100% target margin is impossible ✓
  • Edge: a negative target margin is rejected ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking cookies, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

How do you calculate gross margin?

Subtract cost of goods sold from revenue to get gross profit, then divide by revenue. $50,000 of sales with $30,000 of COGS is a $20,000 gross profit and a 40% gross margin.

Is freight included in cost of goods sold?

Freight-in, the cost of shipping inventory to you, is part of COGS. Shipping orders out to customers (freight-out) is an operating expense, so it doesn't lower gross margin.

What is a good gross margin?

It depends on the industry. In NYU Stern professor Aswath Damodaran's January 2026 data, US grocery retailers average about 26%, restaurants about 32% and software companies about 72%.

Is gross margin the same as gross profit?

Gross profit is a dollar amount. Gross margin is that amount as a percent of revenue. The SEC notes that some companies call the dollar figure "gross margin" too.

Can gross margin be negative?

Yes. If goods cost more than they sold for, gross profit and gross margin are negative. $100 of sales with $120 of COGS is a −20% gross margin.

Related calculators