Free calculator
Margin calculator for profit, gross and SaaS margin
Get profit margin from cost and price, the price that hits a target margin, gross and net margin from your P&L, SaaS gross margin from real cost lines, and your break-even point.
Your numbers
What one unit costs you to make, buy or deliver.
What the customer pays, before sales tax or VAT.
Runs in your browser. Nothing you type is sent or stored.
Profit margin
40%
$48 profit on a $120 price.
- Profit per unit
- $48
- Markup
- 66.67%
Where the price goes
- Cost$72
- Profit$48
Margin = profit ÷ price = $48 ÷ $120 = 40%
Markup = profit ÷ cost = $48 ÷ $72 = 66.67%
Quick answer
How do you calculate profit margin?
Profit margin = (price − cost) ÷ price × 100. A product that costs $72 and sells for $120 makes $48 of profit, a 40% margin. Gross margin is revenue minus the cost of goods sold, divided by revenue; net margin takes off every expense, interest and tax included. To hit a target margin, price = cost ÷ (1 − margin): a 40% margin on a $72 cost needs a $120 price.
How to use the margin calculator
- Pick a mode
Margin for one product, Price to hit a target margin, Net margin for a full P&L, SaaS for subscription gross margin, Break-even for the units you need to sell.
- Enter your numbers
Cost and price for one unit, or revenue and costs for one period. Keep every amount to the same month, quarter or year.
- Read the result
See the margin, the markup behind it, and where each part of the price or revenue goes.
- Share it
Copy the link to send the exact numbers to a cofounder or your accountant. Nothing is stored on our side.
How the calculator works
Margin is profit as a share of the selling price: (price − cost) ÷ price. Markup is the same profit as a share of cost: (price − cost) ÷ cost. A $72 item sold at $120 has a 40% margin and a 66.67% markup. Both describe the same $48.
Gross margin takes only the cost of goods sold off revenue. Operating margin also takes off operating expenses such as salaries, marketing and rent. Net margin takes off everything, interest and tax included, so it is the smallest of the three.
For a SaaS company, cost of revenue is what it costs to serve customers: hosting, AI inference, card fees, support and the third-party services that grow with usage. Card fees are the percentage fee on MRR plus the fixed fee times the number of charges. Sales, marketing and product development sit below gross profit, in operating expenses.
Break-even units are fixed costs ÷ (price − variable cost per unit), rounded up to a whole unit. Break-even revenue is fixed costs ÷ the contribution margin ratio.
Margin = (price − cost) ÷ price × 100
Price for a target margin = cost ÷ (1 − margin)
Gross margin = (revenue − COGS) ÷ revenue × 100
Net margin = net profit ÷ revenue × 100
Break-even units = fixed costs ÷ (price − variable cost per unit)Worked example
- A product costs $72 and sells for $120: profit is $120 − $72 = $48.
- Margin: $48 ÷ $120 = 40%. Markup: $48 ÷ $72 = 66.67%.
- For a 50% margin instead: $72 ÷ (1 − 0.50) = $144.
- A SaaS at $40,000 MRR spends $9,500 a month serving customers: gross margin is ($40,000 − $9,500) ÷ $40,000 = 76.25%.
- With $10,000 of fixed costs and $20 of contribution per unit ($50 price − $30 variable cost), break-even is $10,000 ÷ $20 = 500 units.
SaaS gross margin benchmarks
Published figures to compare the SaaS mode against. Each source counts cost of revenue its own way, so read them as reference points, not targets.
| Measure | Benchmark | Source |
|---|---|---|
| SaaS subscription revenue: median gross margin | 81% | Benchmarkit, 2025 B2B SaaS Performance Metrics Benchmarks |
| SaaS total revenue, services included: median gross margin | 77% | Benchmarkit, 2025 B2B SaaS Performance Metrics Benchmarks |
| Professional services revenue: median gross margin | 30% | Benchmarkit, 2025 B2B SaaS Performance Metrics Benchmarks |
| AI “Shooting Stars” (fast, efficient AI companies): gross margin | About 60% | Bessemer Venture Partners, The State of AI 2025 |
| AI “Supernovas” (fastest-growing AI companies): average gross margin | About 25%, often negative | Bessemer Venture Partners, The State of AI 2025 |
| Hosting: median spend as a share of ARR | 5% | SaaS Capital, 2026 spending benchmarks (1,000+ private B2B SaaS companies) |
| Customer support and success: median spend as a share of ARR | 9% | SaaS Capital, 2026 spending benchmarks (1,000+ private B2B SaaS companies) |
Medians and averages as each source reports them. Last verified 27 October 2026.
Gross margin vs net margin
Gross margin shows whether the product itself makes money: revenue minus the direct cost of delivering it. Net margin shows whether the whole company does, after salaries, marketing, rent, interest and tax. A business can have a strong gross margin and still lose money when operating costs run ahead of revenue, which is common for young SaaS companies that hire before they sell.
What counts as cost of revenue in SaaS
| Cost | In cost of revenue? | Why |
|---|---|---|
| Hosting and infrastructure | Yes | Serving customers needs it every month. |
| AI model and GPU costs for customer features | Yes | Every customer request costs money to answer. |
| Card and payment processing fees | Yes | Taken from every charge. |
| Customer support and onboarding | Usually | Keeps paying customers running. Some companies book it as an operating expense; say which. |
| Third-party APIs inside the product | Yes | Usage grows with customers. |
| Sales and marketing | No | Wins new customers: an operating expense. |
| Product development | No | Builds the product rather than delivering it: an operating expense. |
| Tools for your own team | No | General and administrative expense. |
How AI features change SaaS margins
Classic SaaS costs little to serve one more customer, which is why its gross margins are high. AI features add a cost to every request, in model API fees or GPU time. Bessemer’s State of AI 2025 found gross margins of about 60% for fast, efficient AI companies and about 25% on average for the fastest-growing ones, against a median of 81% on SaaS subscription revenue in Benchmarkit’s 2025 survey. Track AI inference as its own cost line and price heavy usage separately.
Margin questions
- How do I calculate profit margin?
- Subtract cost from price, divide by price and multiply by 100. A $120 sale that cost $72 leaves $48 of profit: $48 ÷ $120 = 40% margin.
- What is the gross margin formula?
- Gross margin = (revenue − cost of goods sold) ÷ revenue × 100. With $500,000 of revenue and $150,000 of cost of goods sold, gross profit is $350,000 and gross margin is 70%.
- What is the difference between gross profit and gross margin?
- Gross profit is an amount: revenue minus cost of goods sold. Gross margin is that amount as a percentage of revenue. $350,000 of gross profit on $500,000 of revenue is a 70% gross margin.
- How do I calculate net profit margin?
- Divide net profit by revenue and multiply by 100. Net profit is revenue minus every cost: goods, operating expenses, interest and tax. $80,000 of net profit on $500,000 of revenue is a 16% net margin.
- What is a good profit margin?
- It depends on the industry and on which margin you mean. For SaaS, Benchmarkit’s 2025 survey puts the median gross margin on subscription revenue at 81%. Compare yourself with businesses that sell the same way, and watch your trend over several months.
- How do I price a product for a 30% margin?
- Divide the cost by 1 minus the margin: price = cost ÷ 0.70. A $70 cost needs a $100 price for a 30% margin. Adding 30% to the cost gives $91, which is only a 23% margin.
- Is margin the same as markup?
- No. Margin is profit divided by the selling price; markup is profit divided by cost. The same $48 profit on a $72 cost and a $120 price is a 40% margin and a 66.67% markup.
- How do I calculate the break-even point?
- Divide fixed costs by the contribution per unit, which is the price minus the variable cost per unit. $10,000 of fixed costs at $50 a unit with $30 of variable cost needs $10,000 ÷ $20 = 500 units.
- What is contribution margin?
- What each sale adds towards fixed costs and profit: price minus variable cost per unit. Divide it by the price for the ratio. A $50 product with $30 of variable cost has a $20 contribution and a 40% contribution margin.
Cite this tool
Free to link and quote. Use this reference:
SaaSCity, "Margin Calculator", October 27, 2026. https://saascity.io/free-tools/margin-calculator
Sources
- OpenStax, Principles of Accounting, Volume 1, 6.6: the gross profit margin ratio
- OpenStax, Principles of Accounting, Volume 2, 3.1: contribution margin
- OpenStax, Principles of Accounting, Volume 2, 3.2: break-even point in units and dollars
- Benchmarkit, “2025 B2B SaaS Performance Metrics Benchmarks”
- Bessemer Venture Partners, “The State of AI 2025” (13 August 2025)
- SaaS Capital, 2026 spending benchmarks for private B2B SaaS companies
- Stripe Support, “Manually entered card payments” (standard US card rate)