Aviy
CalculatorsGross Margin FormulaGross Margin PercentageGross Margin RatioCalculate Gross MarginGross Margin Definition

Gross Margin Calculator: Formula and Examples

Gross Margin Calculator: Formula and Examples - Aviy AI invoicing
17 min read

Gross margin is the percentage of revenue left after subtracting the cost of goods sold. To calculate it, subtract COGS from revenue to get gross profit, divide gross profit by revenue, then multiply by 100. The formula is: Gross Margin = ((Revenue − COGS) ÷ Revenue) × 100.

A gross margin calculator answers one of the most important questions in business: for every pound or dollar you earn, how much do you actually keep after covering the direct cost of delivering it? Gross margin is the percentage of revenue left after subtracting the cost of goods sold, and it is the cleanest single number for judging whether your pricing and delivery are healthy. In this guide you will get the exact formula, three fully worked examples, realistic benchmarks, and a clear way to read your own result.

Whether you sell physical products, bill hours as a consultant, or run an agency with a team, gross margin tells you whether the core of your business is profitable before overhead, tax and admin enter the picture. It is the foundation that every other profitability metric builds on.

What Is Gross Margin?

Gross margin is the share of your revenue that remains after you pay the direct costs of producing what you sell. Those direct costs are called the cost of goods sold, or COGS. Whatever is left over is gross profit, and when you express that gross profit as a percentage of revenue, you have your gross margin.

The reason gross margin matters so much is that it isolates the economics of your actual offer. It strips out rent, software subscriptions, marketing and salaries that are not tied directly to delivery, and shows you whether each sale carries its own weight. If your gross margin is thin, no amount of cost-cutting elsewhere will fix the underlying problem.

A high gross margin means you have room to cover overhead, reinvest in growth and still take home profit. A low gross margin means you are working hard for very little, and you should look at either your prices or your direct costs before anything else.

Gross margin vs gross profit

People often use these terms interchangeably, but they are different. Gross profit is a money amount, like $40,000. Gross margin is that amount expressed as a percentage of revenue, like 40 percent. The percentage is what lets you compare a small project to a large one, or your business to an industry benchmark, on equal terms.

The Gross Margin Formula

The gross margin formula has two simple steps. First you find gross profit, then you turn it into a percentage.

Gross Profit = Revenue − Cost of Goods Sold (COGS)

Gross Margin (%) = (Gross Profit ÷ Revenue) × 100

Or, combined into one line:

Gross Margin = ((Revenue − COGS) ÷ Revenue) × 100

That is the whole calculation. A calculator or spreadsheet does the arithmetic, but the value comes from feeding it the right numbers. The hard part is defining revenue and COGS correctly, which is what the next section covers.

Understanding Each Input

The formula is only as accurate as the two inputs you put into it. Getting these definitions right is where most people slip up.

Revenue

Revenue is the total income from sales over a chosen period - a month, quarter or year. Use net revenue, meaning sales after deducting refunds, returns and discounts but before any costs. For a freelancer or agency, revenue is simply the total you invoiced and collected for the work, which you can pull straight from your invoicing records or analytics dashboard.

Cost of goods sold (COGS)

COGS is every direct cost of delivering what you sold. The key word is direct. Include costs that rise and fall with each sale and exclude general overhead that you would pay regardless.

For a product business, COGS typically includes:

  • Raw materials and components
  • Manufacturing or assembly labor
  • Inbound shipping and packaging
  • Payment processing fees tied to the sale

For a service business, COGS includes:

  • Direct labor for the people delivering the work
  • Subcontractors and freelancers hired for the project
  • Software or licenses used specifically to deliver that client's work
  • Direct project expenses you pass through

What does NOT belong in COGS: office rent, your own admin time, marketing spend, accounting fees and general software subscriptions. Those are operating expenses and they affect net margin, not gross margin.

Worked Example 1: A Product Business

Maya runs a small candle company. Last quarter she sold $20,000 worth of candles. Her direct costs were:

  • Wax, wicks and fragrance: $5,000
  • Jars and packaging: $2,400
  • Production labor: $4,000
  • Payment processing fees: $600

Step 1 - Total COGS: $5,000 + $2,400 + $4,000 + $600 = $12,000

Step 2 - Gross profit: $20,000 − $12,000 = $8,000

Step 3 - Gross margin: ($8,000 ÷ $20,000) × 100 = 40%

Maya keeps 40 pence of every pound to cover rent, marketing and her own salary. For a handmade physical product, 40 percent is workable but not generous. If she can lower materials cost through bulk buying or nudge prices up slightly, she pushes that margin toward a healthier 50 percent.

Worked Example 2: A Freelance Designer

James is a freelance graphic designer. In one month he invoiced $6,000 across several projects. He outsourced some illustration work and used a paid stock asset subscription specifically for one client:

  • Subcontracted illustrator: $900
  • Client-specific stock licenses: $150

Step 1 - Total COGS: $900 + $150 = $1,050

Step 2 - Gross profit: $6,000 − $1,050 = $4,950

Step 3 - Gross margin: ($4,950 ÷ $6,000) × 100 = 82.5%

James's gross margin is high because, like most solo service providers, his main "cost of goods" is his own time, which does not appear as COGS. That 82.5 percent looks impressive, but he still has to pay for software, his laptop, marketing and tax out of it. Gross margin is the start of the story for a freelancer, not the end.

Worked Example 3: A Marketing Agency

Priya runs a five-person marketing agency. Last quarter the agency billed $150,000. Her direct delivery costs were:

  • Salaries of the staff delivering client work: $72,000
  • Freelance specialists for overflow work: $12,000
  • Ad spend and tools billed against client projects: $9,000

Step 1 - Total COGS: $72,000 + $12,000 + $9,000 = $93,000

Step 2 - Gross profit: $150,000 − $93,000 = $57,000

Step 3 - Gross margin: ($57,000 ÷ $150,000) × 100 = 38%

A 38 percent gross margin is on the low side for an agency. Healthy agencies usually target 50 to 60 percent so they have enough cushion for overhead, owner pay and profit. Priya's number tells her that her team may be over-servicing accounts, under-charging, or carrying too much non-billable time. The calculation gives her a precise place to investigate.

How to Interpret Your Gross Margin

A single percentage means little in isolation. Interpretation depends on your business model, your industry and the trend over time.

A useful way to read your result:

  • Below 20%: Tight. Common in low-margin retail and resale, but risky for service businesses. Investigate pricing and direct costs urgently.
  • 20%-40%: Moderate. Typical for many product businesses and busy agencies. Workable, but watch it closely.
  • 40%-60%: Healthy for most product and service businesses with delivery costs.
  • Above 60%: Strong. Common for software, consulting and solo service providers whose main input is their own time.

The single most valuable habit is tracking the trend. A margin that drifts down month after month is a warning sign long before it shows up in your bank balance. A margin that climbs as you grow means your pricing and delivery are scaling well.

Gross Margin Benchmarks by Business Type

Benchmarks vary widely, so treat the table below as rough guidance rather than hard rules. What matters most is comparing yourself to similar businesses and to your own past performance.

Business typeTypical gross margin rangeMain COGS driver
Software / SaaS70%-85%Hosting, support, payment fees
Solo consultant / freelancer70%-90%Subcontractors, project tools
Marketing / creative agency45%-60%Delivery staff salaries
Professional services firm40%-55%Billable staff time
E-commerce / physical product30%-50%Materials, manufacturing, shipping
Retail / resale20%-40%Wholesale cost of stock
Restaurant / food60%-70% (food cost ~30%)Ingredients, kitchen labor

If your margin sits well below the range for your type of business, that is a signal to examine pricing first and direct costs second. If you sit above the range, you may have pricing power you are not using elsewhere, or you may be under-investing in delivery quality.

Gross Margin vs Markup vs Net Margin

These three numbers are related but answer different questions, and confusing them leads to underpricing.

  • Gross margin is gross profit as a percentage of revenue. It tells you how much of each sale you keep after direct costs.
  • Markup is gross profit as a percentage of cost. It tells you how much you added on top of what something cost you.
  • Net margin is net profit (after all expenses and tax) as a percentage of revenue. It tells you what you ultimately take home.

A classic mistake is treating a 50 percent markup as a 50 percent margin. If something costs $100 and you add 50 percent markup, you sell at $150 - but your gross margin is only 33 percent ($50 ÷ $150). For a deeper look at the relationship, our guides on gross margin and markup walk through the conversions, and the distinction between gross and net profit is worth understanding clearly.

MetricBased onExample (cost $100, sell $150)
MarkupCost50%
Gross marginRevenue33%
Net marginRevenue (after all costs)varies, usually lower

When and Why to Use a Gross Margin Calculator

Gross margin is not a once-a-year number. It is a working tool you should reach for at specific moments.

When setting prices

Before you quote a project or set a product price, work backward from your target gross margin. If you want a 60 percent margin and your direct cost to deliver is $400, you need to charge at least $1,000. This is how a selling price calculation protects you from accidentally underpricing.

When reviewing performance

Run your gross margin every month. A steady or rising margin confirms your model works. A falling margin tells you to act before cash flow suffers.

When deciding what to scale

If one service line carries a 70 percent margin and another carries 25 percent, you now know where to focus your sales energy. Gross margin turns gut feeling into evidence.

When evaluating new work

A big contract is only good if it carries an acceptable margin. Calculating gross margin on the proposed work before you sign stops you from filling your calendar with busy, low-profit jobs.

Modern invoicing tools make this far easier because the revenue side of the equation already lives in your billing data. With Aviy's invoice analytics and business dashboard, the income figures you need are tracked automatically, so you are not rebuilding revenue totals by hand every month.

How to Improve Your Gross Margin

Improving gross margin comes down to two levers: raise revenue per sale or lower the direct cost per sale. Both are usually available even when they do not feel like it.

Raise prices or reposition

Most small businesses underprice. A modest, well-communicated price increase flows almost entirely to gross profit because your direct costs barely change. Repositioning toward higher-value clients does the same thing.

Reduce direct costs without cutting quality

Negotiate better rates with suppliers and subcontractors, buy materials in larger batches, or bring an outsourced step in-house if it is cheaper at your volume. Even trimming payment processing fees adds up over a year.

Improve delivery efficiency

For service businesses, faster delivery directly lifts margin because labor is your biggest COGS. Templates, automation and reusable processes mean the same revenue costs you less time to earn.

Shift your mix

Sell more of your high-margin offers and fewer low-margin ones. Bundling can also lift the blended margin by pairing a high-margin add-on with a popular core product.

Common Mistakes to Avoid

These errors quietly distort gross margin and lead to bad decisions.

  • Putting overhead in COGS. Rent, admin and marketing are not direct costs. Including them turns gross margin into something closer to net margin and makes it look worse than it is.
  • Forgetting your own labor. Solo operators leave their time out of COGS, which is fine for gross margin, but they then forget that the margin still has to pay them a wage.
  • Using gross revenue instead of net. Calculating margin on sales before refunds and discounts overstates the result.
  • Confusing markup with margin. A 40 percent markup is not a 40 percent margin. This single error causes chronic underpricing.
  • Calculating it once and forgetting it. Gross margin only earns its keep when you track the trend over time.
  • Blending everything together. A healthy overall margin can hide an unprofitable client or product line. Break it down.

Best Practices for Tracking Gross Margin

Follow these steps to make gross margin a reliable part of how you run your business.

  1. Define COGS consistently. Write down exactly which costs count as direct, and apply that definition every period so your numbers are comparable.
  2. Use net revenue. Always start from revenue after refunds and discounts.
  3. Calculate monthly. A monthly cadence catches problems early and reveals trends a yearly view misses.
  4. Segment it. Track margin per client, product and service line, not just the company total.
  5. Set a target. Decide what gross margin your model needs to thrive, then price and deliver to hit it.
  6. Compare to benchmarks. Check your margin against similar businesses to know whether you have a pricing problem or a cost problem.
  7. Connect it to pricing. Feed your target margin back into every quote and product price so you never sell below your floor.
  8. Automate the data. Pull revenue from your invoicing system so the calculation is fast and accurate every time.

Summary

A gross margin calculator turns one of the most important questions in business - how much of each sale you actually keep - into a clear percentage. The formula is simple: subtract cost of goods sold from revenue to get gross profit, then divide gross profit by revenue and multiply by 100. The discipline lies in defining revenue and COGS correctly, tracking the result every month, and breaking it down by client and service line.

Use your gross margin to set prices, decide what to scale, and catch profitability problems early. Compare it to benchmarks for your industry, but pay even closer attention to your own trend over time. When you keep the revenue side of the equation organized through clean, automated invoicing, calculating and improving your gross margin becomes a routine part of running a healthier, more profitable business.

Frequently asked questions

What is the formula for gross margin?

The gross margin formula is ((Revenue − Cost of Goods Sold) ÷ Revenue) × 100. First subtract your direct costs (COGS) from revenue to get gross profit, then divide gross profit by revenue and multiply by 100 to express it as a percentage. This shows the share of every sale you keep after covering the direct cost of delivering it, before overhead, tax and other operating expenses.

How do you calculate gross margin percentage?

Take your revenue for a period, subtract the cost of goods sold to find gross profit, then divide gross profit by revenue and multiply by 100. For example, $20,000 revenue with $12,000 COGS gives $8,000 gross profit, and $8,000 ÷ $20,000 × 100 equals a 40 percent gross margin. Always use net revenue after refunds and discounts for accuracy.

What is a good gross margin for a small business?

It depends heavily on your model. Solo consultants and software businesses often exceed 70 percent, agencies target 45 to 60 percent, product businesses sit around 30 to 50 percent, and retail can be 20 to 40 percent. Rather than chasing a universal number, compare yourself to similar businesses and watch whether your own margin is rising or falling over time.

What is the difference between gross margin and gross profit?

Gross profit is a money amount - revenue minus cost of goods sold, such as $8,000. Gross margin is that same gross profit expressed as a percentage of revenue, such as 40 percent. The percentage lets you compare projects of different sizes and benchmark against other businesses, while the money figure tells you how much cash the sale actually generated.

How is gross margin different from markup?

Gross margin is gross profit as a percentage of revenue, while markup is gross profit as a percentage of cost. If something costs $100 and sells for $150, the markup is 50 percent but the gross margin is only 33 percent. Confusing the two leads to chronic underpricing, so always be clear which base - cost or revenue - you are calculating from.

What counts as cost of goods sold for a service business?

For service businesses, COGS includes direct delivery labor, subcontractors and freelancers hired for client work, project-specific software or licenses, and pass-through expenses billed to the client. It excludes general overhead like office rent, marketing, accounting fees and admin time. The test is whether a cost rises directly with each unit of work delivered.

How can I improve my gross margin?

You can raise revenue per sale through price increases or repositioning toward higher-value clients, or lower direct costs by negotiating with suppliers, buying in bulk, and delivering more efficiently with templates and automation. Shifting your mix toward higher-margin offers also helps. Because direct costs barely change when you raise prices, a modest increase flows almost entirely to gross profit.

Should I include my own salary in COGS?

For gross margin in a solo business, your own time is usually not recorded as COGS, which is why freelancer gross margins look very high. However, you must still pay yourself a wage out of that margin. If you employ staff who deliver client work, their salaries do belong in COGS because they are a direct cost of delivery.

How often should I calculate gross margin?

Monthly is ideal for most small businesses. A monthly cadence catches declining margins early, before they damage cash flow, and reveals trends that a yearly review would miss. Beyond the company-wide figure, calculate margin per client and per service line regularly so you can spot any single relationship that is quietly unprofitable.

Can gross margin be negative?

Yes. If your cost of goods sold is higher than your revenue, gross profit is negative and so is your gross margin. This means you are losing money on the core delivery of your product or service before any overhead is even counted. A negative gross margin is a serious warning that demands an immediate review of pricing and direct costs.

Conclusion

A gross margin calculator gives you the single clearest read on whether your core offer is profitable: the percentage of revenue left after the direct cost of delivery. With the formula ((Revenue − COGS) ÷ Revenue) × 100 and a consistent definition of your direct costs, you can calculate gross margin in seconds and use it to price work, choose what to scale and catch problems before they reach your bank account.

Treat gross margin as a living number, not a yearly afterthought. Track it monthly, break it down by client and service line, and compare it to the benchmarks for your kind of business. Do that, and your gross margin becomes one of the most useful decision-making tools you own.

Sources and further reading