Free tool
Gross margin calculator
Gross margin is profit over revenue. $50,000 of revenue on $10,000 of cost is a margin of 80.0% and a markup of 400.0%.
- Cost of revenue
- $10,000
- Gross profit
- $40,000
- Gross margin
- 80.0%
- Markup on cost
- 400.0%
- Revenue needed for target margin
- $66,667$66,666.67 before rounding to whole dollars, to reach a margin of 85.0% on the same cost
- Hosting and infrastructure: $4,000
- Payment fees: $1,600
- Customer support: $3,000
- Software inside the product: $1,400
- Gross profit: $40,000
How this was worked out
- Cost of revenue: $4,000 + $1,600 + $3,000 + $1,400 = $10,000.
- Gross profit: $50,000 - $10,000 = $40,000.
- Gross margin is profit over revenue: $40,000 / $50,000 = 80.0%.
- Markup is profit over cost: $40,000 / $10,000 = 400.0%.
- Revenue for a margin of 85.0% on $10,000 of cost: $10,000 / (1 - 0.85) = $66,667.
- That is $16,667 more than the $50,000 you have, so the same costs would need that much extra revenue (or lower costs) to reach the target.
How the calculator works
Add up the costs of delivering what you sold, subtract them from revenue to get gross profit, and divide by revenue for the margin. Divide the same profit by cost instead and you get the markup. For a revenue target, divide cost by one minus the margin you want.
In symbols:
gross profit = revenue - cost
margin = gross profit / revenue
markup = gross profit / cost
revenue needed for margin m = cost / (1 - m)
markup to margin: margin = markup / (1 + markup)Worked examples
A subscription business with four cost lines
Revenue is $50,000 for the month. The payment line is 500 payments of $100 at 2.9% + $0.30, which comes to $1,600.
| Measure | Value |
|---|---|
| Revenue | $50,000 |
| Hosting and infrastructure | $4,000 |
| Payment fees | $1,600 |
| Customer support | $3,000 |
| Software inside the product | $1,400 |
| Cost of revenue | $10,000 |
| Gross profit | $40,000 |
| Gross margin | 80.0% |
| Markup on cost | 400.0% |
| Revenue needed for target margin | $66,667 |
The business keeps 80.0% of each revenue dollar. To reach a margin of 85% on these costs it would need $66,667 of revenue.
One total instead of lines
With $20,000 of revenue and one cost figure of $14,000, the margin is 30.0% and the markup is 42.9%. A 70% margin on the same cost would need $46,667 of revenue.
| Measure | Value |
|---|---|
| Revenue | $20,000 |
| Cost entered as one total | $14,000 |
| Cost of revenue | $14,000 |
| Gross profit | $6,000 |
| Gross margin | 30.0% |
| Markup on cost | 42.9% |
| Revenue needed for target margin | $46,667 |
A month where costs exceed revenue
Revenue of $8,000 against $9,600 of cost leaves -$1,600 of gross profit, a margin of -20.0%. A negative margin is a valid result, and the revenue-needed figure shows what a 60% margin would take on those costs: $24,000.
Reference tables
Markup against margin
A markup always looks bigger than the margin it produces. The table converts the common markups.
| Markup on cost | Gross margin |
|---|---|
| 25% | 20.0% |
| 50% | 33.3% |
| 100% | 50.0% |
| 200% | 66.7% |
| 300% | 75.0% |
| 400% | 80.0% |
The price a $20 unit cost needs
Price is cost divided by one minus the margin, so each step up in margin asks for a much larger price.
| Target margin | Price for a $20 cost |
|---|---|
| 50% | $40 |
| 60% | $50 |
| 70% | $66.67 |
| 80% | $100 |
| 90% | $200 |
The Stripe fee as a share of the plan price
Stripe's US domestic card rate is 2.9% + $0.30 (read 19 Oct 2026). The fixed part weighs most on small plans, so cheap plans lose a larger share of the price to payment fees.
| Plan price | Stripe fee on one payment | Fee as a share of the price |
|---|---|---|
| $10 | $0.59 | 5.9% |
| $29 | $1.14 | 3.9% |
| $49 | $1.72 | 3.5% |
| $99 | $3.17 | 3.2% |
| $299 | $8.97 | 3.0% |
Edge cases
- Zero cost makes the markup undefined, because profit cannot be divided by nothing. The calculator says so and still shows the margin, which is 100.0%.
- Zero or blank revenue shows a prompt instead of a margin, because a margin needs revenue to divide by.
- A negative margin is allowed and explained, not rejected.
- A target margin of 100% or more is refused, and a blank target skips the revenue-needed result.
- The revenue-needed figure is rounded to whole dollars, with the exact cents in the note beside it.
- Blank cost lines count as zero. The one-total mode uses the single figure and ignores the lines.
Questions
How do gross margin and markup differ?
Margin is profit as a share of revenue, and markup is profit as a share of cost. The same sale gives two different percentages. With the starting figures, $40,000 of profit on $50,000 of revenue is a margin of 80.0% and, over $10,000 of cost, a markup of 400.0%. A markup of 25% is only a margin of 20.0%, so do not read one as the other.
Which costs belong in the cost of revenue for a subscription product?
Everything it costs to serve the product to customers who pay: hosting, payment fees, support and any software built into the product. The starting figures use $4,000, $1,600, $3,000 and $1,400 for those four lines, which add up to $10,000. Sales and marketing, research and general overhead sit below gross profit, not in it.
Are payment fees part of gross margin?
Yes, they are a cost of taking the revenue. The starting payment line is 500 payments of $100 at Stripe's US domestic card rate of 2.9% + $0.30, which is $3.20 a payment and $1,600 in total. Use the Stripe fee calculator to work out the fee on your own payment size.
How much revenue do I need to reach a target margin on the same costs?
Divide the cost of revenue by one minus the target margin. $10,000 of cost with a target of 85% needs $66,667 of revenue. Raising revenue and cutting cost both move the margin, and the calculator shows the revenue figure for any target below 100%.
Can gross margin be negative?
Yes. When serving customers costs more than they pay, gross profit is negative and the margin is too. With $8,000 of revenue and $9,600 of cost, gross profit is -$1,600 and the margin is -20.0%. The calculator accepts this and says so rather than showing an error.
Why is a 100% target margin not allowed?
A margin of 100% would need a price with no cost behind it, and the formula divides by one minus the target, which is zero at 100%. Any real cost, even $0.01, keeps the margin below 100%, so enter a target between 0% and 99.9%.
How is gross margin different from net margin?
Gross margin stops after the costs of delivering the product. Net margin also removes operating costs such as sales, marketing and overhead, so it is always lower than or equal to gross margin. This calculator covers the gross figure only, so a gross margin of 80.0% says nothing yet about what is left after those costs.
Related tools
The Stripe fee calculator works out the payment line. The price increase calculator shows what a higher price does to revenue, the MRR calculator tracks the revenue side, and the customer lifetime value calculator turns a margin into value per customer. The metrics glossary defines each term.
Sources
- Stripe pricing, domestic card rate: https://stripe.com/pricing. Read on 19 Oct 2026.