Gross profit margin is revenue minus cost of revenue, divided by revenue, times 100: the share of each sales dollar left after the direct cost of delivering what you sold. A company with $10,000,000 of revenue and $2,300,000 of cost of revenue has $7,700,000 of gross profit and a 77.0% gross margin.
Enter revenue and cost of revenue (cost of goods sold) for the same period, or the price and cost of one unit. The defaults are illustrative numbers for a $10M software company. Add a target margin to see the cost, or the revenue, that margin takes.
Most SaaS companies report two revenue lines with very different margins. Enter each line's revenue and its cost of revenue to see both margins and the blended one. The defaults are illustrative.
Subscription
Professional services and other
Get The Forecast Brief
You just worked out your gross profit margin. The Forecast Brief is a short email from Pete Furseth, ORM's COO, built on what ORM sees in its customers' forecasts.
Gross margin formulas, with Excel and Google Sheets versions
Every result in the calculator comes from one of these formulas. The examples use the default numbers, an illustrative software company with $10,000,000 of revenue.
| Measure | Formula | Excel or Sheets | Example (illustrative) |
|---|---|---|---|
| Gross profit | Revenue - cost of revenue | =B1-B2 | $10,000,000 - $2,300,000 = $7,700,000 |
| Gross profit margin | Gross profit / revenue x 100 | =(B1-B2)/B1 | $7,700,000 / $10,000,000 = 77.0% |
| Cost of revenue ratio | Cost of revenue / revenue | =B2/B1 | $2,300,000 / $10,000,000 = 23.0% |
| Markup on cost | Gross profit / cost of revenue | =(B1-B2)/B2 | $7,700,000 / $2,300,000 = 334.8% |
| Most cost for a target margin | Revenue x (1 - target margin) | =B1*(1-C1) | $10,000,000 x (1 - 80%) = $2,000,000 |
| Revenue or price for a target margin | Cost / (1 - target margin) | =B2/(1-C1) | $2,300,000 / (1 - 80%) = $11,500,000 |
| Blended SaaS gross margin | (Subscription gross profit + services gross profit) / total revenue | =((B4-B5)+(B6-B7))/(B4+B6) | ($7,600,000 - $100,000) / $10,000,000 = 75.0% |
B1 is revenue (or one unit's price), B2 cost of revenue (or unit cost) and C1 the target margin as a percentage. B4 and B5 are subscription revenue and its cost, B6 and B7 services revenue and its cost. Format the margin cells as percentages. If revenue can be blank, wrap each division in IFERROR so the sheet shows a blank instead of an error.
How to calculate gross profit margin, step by step
- Pick one period. A month, quarter or year. Revenue and cost of revenue must cover the same dates.
- Start from recognized revenue. Use revenue on the income statement, net of discounts and returns, not bookings or billings. An annual contract billed upfront is earned month by month.
- Add up cost of revenue. Only the costs of delivering what you sold in the period. For goods, that is the cost of the items sold. For software, it is hosting, support and the teams that run and deliver the service.
- Subtract. Revenue minus cost of revenue is gross profit.
- Divide by revenue. Gross profit / revenue x 100 is the gross margin.
- Split it by revenue line. If you sell subscriptions and services, calculate each line's margin. The blended number hides which one moved.
The gross margin formula entry in ORM's glossary covers the definition in more depth, and the cost of sales calculator builds the cost of revenue line itself, from inventory for goods or from hosting and support for SaaS.
What goes into SaaS cost of revenue
Gross margin is only as good as the cost of revenue line under it. Okta's fiscal 2026 10-K gives a typical public SaaS definition (Okta, Form 10-K, fiscal 2026): cost of subscription "primarily consists of expenses related to hosting our services and providing support", including the people behind its cloud infrastructure, product security and customer support, third-party hosting fees, software, outside delivery services, amortization of capitalized internal-use software and acquired technology, and allocated overhead. Cost of professional services is mainly the services delivery team, travel and outside contractors.
| Cost | Where it usually goes | Why |
|---|---|---|
| Hosting, cloud infrastructure, third-party APIs used to deliver the product | Cost of revenue | It rises with usage by paying customers |
| Customer support team and tools | Cost of revenue | It serves customers who already bought |
| Implementation, onboarding and training teams | Cost of services revenue | It delivers the services line |
| Customer success managers | Varies by company | Some companies count them as support, others as sales and marketing when their job is renewals and expansion. State your choice and keep it |
| Sales commissions | Sales and marketing | They are a cost of winning the customer, not of delivering the service |
| R&D for new features | Research and development | It builds the product; it does not deliver it |
Two companies with the same economics can report gross margins several points apart because one puts customer success in cost of revenue and the other does not. Before comparing your margin with a peer's, check what is in their line. ORM's entry on gross profit margin for SaaS walks through the same choices.
Worked example: subscription and services margins at Okta
Okta reports two revenue lines. The margins below are calculated from the figures in its fiscal 2026 10-K (dollars in millions, fiscal years ended January 31).
| Okta | 2024 | 2025 | 2026 |
|---|---|---|---|
| Subscription revenue | 2,205 | 2,556 | 2,855 |
| Cost of subscription revenue | 502 | 549 | 578 |
| Subscription gross margin | 77.2% | 78.5% | 79.8% |
| Professional services and other revenue | 58 | 54 | 64 |
| Cost of professional services and other | 79 | 69 | 83 |
| Services gross margin | -36.2% | -27.8% | -29.7% |
| Total gross margin | 74.3% | 76.3% | 77.4% |
The services line loses money every year, and the filing says so: "The cost of providing professional services has historically been higher than the associated revenue we generate." Services are only about 2% of Okta's revenue, so the blended margin stays close to the subscription margin. In a younger company where services are 10% or 20% of revenue, the same loss pulls the blended margin down by several points. That is why the calculator's SaaS tab shows both lines.
Stock-based compensation also sits inside cost of revenue: $84 million of it in fiscal 2026 ($74 million in subscription, $10 million in services). Without it, Okta's gross margin would be 80.2% instead of 77.4%. Say which version you are showing.
What is a good gross profit margin? Benchmarks by industry
Aswath Damodaran at NYU Stern publishes gross margins for US public companies by industry. The January 2026 update covers 5,994 firms (Damodaran, Margins by Sector (US), January 2026). Each figure is total gross profit divided by total sales for the industry, so the largest companies weigh most.
| Industry (number of firms) | Gross margin | Net margin |
|---|---|---|
| Software, system and application (309) | 71.72% | 25.49% |
| Drugs, pharmaceutical (228) | 71.73% | 18.54% |
| Software, entertainment (77) | 66.45% | 29.93% |
| Software, internet (29) | 62.58% | -0.93% |
| Semiconductor (66) | 58.97% | 30.45% |
| Apparel (35) | 56.88% | 3.85% |
| Healthcare information and technology (115) | 48.32% | 7.45% |
| Advertising (52) | 36.24% | -0.30% |
| Information services (15) | 34.08% | 6.53% |
| Business and consumer services (155) | 33.38% | 7.03% |
| Restaurant and dining (64) | 32.24% | 9.37% |
| Retail, grocery and food (15) | 26.31% | 1.32% |
| Computer services (64) | 24.26% | 4.45% |
| Total market (5,994) | 37.76% | 9.74% |
| Total market without financials (4,822) | 34.39% | 8.56% |
Two things stand out. First, a high gross margin does not mean a high net margin: internet software keeps 62.58% after delivery costs and ends at -0.93% after everything else. Second, the software rows are aggregates of large public companies. A private SaaS company should compare its subscription margin with its own history and with peers that define cost of revenue the same way. ORM's guide to what a good gross margin is for SaaS covers the SaaS ranges in more detail.
Gross margin vs net margin, contribution margin and markup
Gross margin is one of several ratios built on revenue and cost, and they are easy to mix up.
| Ratio | Subtracts | Divides by | Use it for | ORM tool |
|---|---|---|---|---|
| Gross margin | Cost of revenue | Revenue | Whether the product is profitable to deliver | This calculator |
| Contribution margin | All variable costs, including variable selling costs | Revenue | Pricing, unit economics, break-even | Contribution margin calculator |
| Net margin | Every cost, interest and tax | Revenue | Whether the company makes money | Net profit margin calculator |
| Markup | Cost of revenue | Cost | Setting prices from cost | Markup calculator |
The glossary entry on gross margin vs net margin covers the first and third in words. Gross margin also feeds customer lifetime value: lifetime value built on revenue instead of gross profit overstates what a customer is worth, which is why ORM's customer lifetime value calculator asks for gross margin.
Common gross margin mistakes
- Dividing by cost. That is markup. A $60 cost and $100 price is a 40% margin, not 66.7%.
- Using bookings or billings as revenue. Gross margin uses recognized revenue for the same period as the costs.
- Leaving support or hosting in operating expenses. It flatters gross margin and makes it hard to compare with peers.
- Putting commissions in cost of revenue. They are a selling cost. They belong in contribution margin, not gross margin.
- Reading only the blended margin. A growing services line can lower the blended margin while the subscription margin improves.
- Comparing GAAP with adjusted margins. Stock-based compensation in cost of revenue can move gross margin by a few points, as it did at Okta.
This calculator is for planning and analysis. It is not accounting or tax advice; your auditor decides how each cost is classified.
ORM's take on gross margin and the revenue forecast
Most cost of revenue in a SaaS company is planned ahead: hosting commitments, the support team, the services bench. Revenue is the line that moves. When bookings land later than plan, the support and services teams are already hired, and gross margin falls even though nothing changed in delivery.
That is the part ORM works on. We build bookings and ARR forecasts from your own CRM data, with a low case, an on-target case and an upper bound, so finance can plan delivery costs against a revenue range it trusts. ORM targets 95% accuracy on the forecasts it builds. To build the full income statement around the margin, use ORM's free profit and loss template.
Common questions
How do you calculate gross profit margin?
Subtract cost of revenue (cost of goods sold) from revenue to get gross profit, divide gross profit by revenue, then multiply by 100. With $10,000,000 of revenue and $2,300,000 of cost of revenue, gross profit is $7,700,000 and gross margin is 7,700,000 / 10,000,000 x 100 = 77.0%. In Excel or Google Sheets, put revenue in B1 and cost of revenue in B2 and use =(B1-B2)/B1, formatted as a percentage.
What is the difference between gross margin and gross profit?
Gross profit is a dollar amount: revenue minus cost of revenue. Gross margin is the same number as a share of revenue. A company with $10,000,000 of revenue and $2,300,000 of cost of revenue has $7,700,000 of gross profit and a 77.0% gross margin. Use the dollar figure to see what is left to pay for operating expenses, and the percentage to compare periods or companies of different sizes.
What is a good gross profit margin?
It depends on the industry. In Aswath Damodaran's January 2026 data for US public companies, the whole market's gross margin was 37.76%, software (system and application) was 71.72%, computer services 24.26% and grocery retail 26.31%. A SaaS company with most of its revenue from subscriptions usually sits far above the market average, and services-heavy revenue pulls it down.
What goes into cost of revenue for a SaaS company?
The costs of delivering the service to customers who already bought it: hosting and third-party infrastructure, the support team, the people who run the platform and its security, software and tools used to deliver the service, amortization of capitalized software, and the cost of the professional services team for implementation and training. Sales commissions, marketing, R&D and general overhead are operating expenses, not cost of revenue.
What is the difference between gross margin and markup?
Both use the same gross profit, but they divide by different numbers. Gross margin divides gross profit by revenue; markup divides it by cost. A product that costs $60 and sells for $100 has a 40% gross margin and a 66.7% markup. On a profitable sale, markup is always the larger number. The ORM markup calculator converts one into the other.
Can gross margin be negative?
It can, when the cost of delivering something is higher than what you charge for it. It is common for a single revenue line: Okta's professional services had a gross margin of about -30% in fiscal 2026, because services cost $83 million to deliver and earned $64 million. A negative gross margin for the whole company means each sale loses money before any operating expense is paid.
Plan delivery costs against a revenue forecast you trust
Cost of revenue is set months ahead. Revenue decides the margin. ORM forecasts the bookings.
Schedule a Demo