Bookkeeping & Accounting

How to Calculate Gross Margin

Published 28 June 2026 · Reviewed & signed by a licensed professional
How to calculate gross margin - Tranzesta guide

If you’ve ever wondered why a business can post strong sales yet still struggle to pay the bills, the answer usually lives in one number. Learning how to calculate gross margin reveals exactly how much money you keep from every dollar of sales after covering the direct cost of producing what you sell.

Gross margin is calculated by subtracting your cost of goods sold (COGS) from revenue, then dividing by revenue and multiplying by 100. The formula is: Gross Margin % = ((Revenue − COGS) ÷ Revenue) × 100. It shows the percentage of each sales dollar left to cover overhead and profit.

What is gross margin?

Gross margin (also called gross profit margin) is the percentage of revenue remaining after you subtract the direct costs of producing your goods or services. Those direct costs are your cost of goods sold — materials, direct labor, and other costs tied directly to making a sale.

It’s expressed as a percentage, which makes it easy to compare across products, time periods, and even competitors of different sizes. A 45% gross margin means that for every $1 in sales, you keep 45 cents to cover rent, salaries, marketing, and profit.

The gross margin formula

There are two related figures people often mix up: gross profit (a dollar amount) and gross margin (a percentage). Here’s how they connect:

  • Gross profit = Revenue − Cost of goods sold (COGS)
  • Gross margin % = (Gross profit ÷ Revenue) × 100

Always start with gross profit in dollars, then convert it to a percentage. The percentage is what lets you benchmark performance over time.

What counts as cost of goods sold (COGS)?

Getting gross margin right depends entirely on classifying costs correctly. COGS includes only the costs directly tied to producing your product or delivering your service:

  • Raw materials and components
  • Direct labor (wages for people who make the product)
  • Manufacturing supplies and packaging
  • Freight-in and shipping of materials to you

It does not include operating expenses like office rent, marketing, administrative salaries, or software subscriptions. Those belong below the gross profit line and are factored into operating and net margins instead.

How to calculate gross margin: step by step

Follow these four steps to find your gross margin:

  • Step 1: Add up total revenue for the period.
  • Step 2: Total your cost of goods sold for the same period.
  • Step 3: Subtract COGS from revenue to get gross profit.
  • Step 4: Divide gross profit by revenue and multiply by 100 to get the gross margin percentage.

A worked example

Imagine a coffee roaster that sells $500,000 of beans in a year. Its direct costs — green coffee, roasting labor, and packaging — total $300,000.

Item Amount
Revenue $500,000
Cost of goods sold (COGS) $300,000
Gross profit ($500,000 − $300,000) $200,000
Gross margin (($200,000 ÷ $500,000) × 100) 40%

This roaster keeps 40 cents of every sales dollar after direct costs. That $200,000 is what’s left to cover rent, marketing, administrative pay, and ultimately profit.

Gross margin vs. net margin vs. markup

These three terms get confused constantly, but they answer different questions. Here’s how they compare for the coffee roaster above, assuming $150,000 of operating expenses:

Metric Formula Result
Gross margin (Gross profit ÷ Revenue) × 100 40%
Net margin (Net profit ÷ Revenue) × 100 10%
Markup (Gross profit ÷ COGS) × 100 66.7%

Notice that markup and margin are not the same. A 66.7% markup on cost produces only a 40% margin on revenue — a critical distinction when you set prices. Classifying every cost correctly also keeps your books accurate, which is why our resources on business deductions are worth reviewing alongside your margin work.

What is a good gross margin?

There’s no universal “good” number — it depends heavily on your industry. High-volume, low-cost businesses run on thin margins, while specialized or premium businesses command much higher ones.

  • Grocery and retail: often low, sometimes in the 20–30% range.
  • Manufacturing: typically moderate, varying widely by sector.
  • Software and digital services: often very high, sometimes 70%+ because COGS is minimal.

The most useful comparison is against your own history and direct competitors. A margin that’s slipping quarter over quarter is a warning sign worth investigating, even if it’s still above your industry average.

How to improve your gross margin

If your margin is too low, you have two levers: raise revenue per sale or lower direct costs. Practical tactics include:

  • Negotiating better pricing or terms with suppliers.
  • Reducing waste and improving production efficiency.
  • Raising prices strategically on your strongest products.
  • Shifting your mix toward higher-margin products or services.
  • Cutting shrinkage, returns, and freight costs.

Understanding your margin also feeds directly into pricing and break-even decisions. Pair sharper margins with smart tax planning so that more of every improved dollar actually reaches your bottom line.

Why gross margin matters for taxes and planning

Gross margin isn’t a tax figure itself, but accurate COGS classification directly affects your taxable income. Misclassifying operating expenses as COGS — or vice versa — can distort both your margins and your tax return. The IRS provides guidance on COGS in its small business resources; always confirm current rules on IRS.gov and review business cost reporting at the IRS Small Business and Self-Employed Tax Center.

Frequently asked questions

How do you calculate gross margin?

Subtract cost of goods sold from revenue to get gross profit, then divide gross profit by revenue and multiply by 100. The formula is: Gross Margin % = ((Revenue − COGS) ÷ Revenue) × 100. The result shows what percentage of each sales dollar remains after direct production costs.

What is the difference between gross profit and gross margin?

Gross profit is a dollar amount — revenue minus cost of goods sold. Gross margin is that same figure expressed as a percentage of revenue. Gross profit tells you how much you kept; gross margin tells you the rate at which you kept it, making it easy to compare across periods.

Is gross margin the same as markup?

No. Gross margin is gross profit divided by revenue, while markup is gross profit divided by cost. The same dollar of profit produces a higher markup percentage than margin percentage. For example, a 66.7% markup on cost equals only a 40% gross margin on revenue.

What is a good gross margin percentage?

It depends on your industry. Grocery and retail often run 20–30%, while software can exceed 70% because direct costs are minimal. Rather than chasing a single benchmark, compare your margin against your own history and direct competitors to spot trends and problems early.

What costs are included in gross margin?

Gross margin only factors in cost of goods sold — direct costs like raw materials, direct labor, packaging, and inbound freight. It excludes operating expenses such as rent, marketing, and administrative salaries. Those are accounted for separately when calculating operating and net margins.

Build a clear, profitable picture of your business

Knowing how to calculate gross margin is the first step; using it to price smarter and pay less tax is where it pays off. Tranzesta helps you classify costs correctly, sharpen your margins, and keep more of what you earn. Book a free consultation today.

Disclaimer: This article is for general informational purposes only and is not tax, legal, or accounting advice. Tax rules and figures change and vary by situation and tax year. Verify current figures on IRS.gov and consult a qualified tax professional before acting.

This article is general information, not personalised tax advice. Tax rules change and depend on your circumstances — speak to a qualified professional in the relevant jurisdiction before acting. Tranzesta serves clients across the US, UK & UAE.

Talk to a real, signing professional

AI precision, human accountability — across the US, UK & UAE.

Book a free consultation