Contribution margin formula: ratio, per unit and an AI example

The contribution margin formula in three forms, the break-even math, and a $49 AI product where a 73.3% average hides 50 money-losing customers.

Brandon Holt
December 1, 2026
7
min read
Summarize
Contribution margin formula: ratio, per unit and an AI example

The contribution margin formula is revenue minus variable costs. As a ratio, it's (revenue − variable costs) ÷ revenue, and per unit it's price minus the variable cost of one unit. A $49 plan whose customers cost $13.07 each in variable costs contributes $35.93 per customer, a 73.3% contribution margin ratio.

For an AI product the hard part is the variable cost, which changes from one customer to the next and can hide a loss inside a healthy average. The worked example further down shows how that happens, and the method fits inside our guide to AI unit economics.

The contribution margin formula in three forms

Contribution margin is what's left of revenue after the costs that rise with each sale. You can state it in dollars for the whole business, in dollars for one unit, or as a share of revenue. AccountingTools defines the ratio as the percentage of sales revenue that remains after deducting variable costs.

Contribution margin          = Revenue − Variable costs
Contribution margin per unit = Price per unit − Variable cost per unit
Contribution margin ratio    = (Revenue − Variable costs) ÷ Revenue
                             = 1 − (Variable costs ÷ Revenue)

Each form answers a different question, so pick the one that matches the decision in front of you.

FormAnswersUse it for
Contribution margin ($)How much money is left to pay fixed costs this month?Monthly P&L, runway
Per unit ($)What does one more customer, seat or order add?Pricing a plan, deciding on discounts
Ratio (%)How many cents of each revenue dollar are left?Break-even, comparing plans of different prices

Fixed costs stay out of all three. Salaries, the base cost of your servers and your office don't change when one more customer signs up, so they sit below contribution margin and get paid out of it.

How to calculate contribution margin, step by step

Start with one month of numbers and a clear list of what counts as variable. For a SaaS product that sells AI features, the variable costs per customer usually come in three groups.

  • Model API calls. Every request a customer triggers is billed by tokens, so the cost grows with their usage.
  • Usage-based services behind the feature, such as embeddings, a vector database or transcription.
  • Payment processing. Stripe's standard rate is 2.9% + 30¢ per successful domestic card charge, which is $1.72 on a $49 charge.

Then run the formula in four steps:

  1. Add up revenue for the period, using what customers paid that month (annual plans divided by 12).
  2. Add up every variable cost for the same period.
  3. Subtract variable costs from revenue. That's contribution margin in dollars.
  4. Divide by revenue for the ratio, or divide both sides by the number of customers for the per-unit figure.

Example. An AI writing tool has 1,000 customers on a $49 plan, so revenue is $49,000 for the month. Its AI bill is $11,350 and payment fees are $1,720, so variable costs total $13,070. Contribution margin is $35,930, the ratio is 73.3%, and each customer contributes $35.93 on average.

Contribution margin ratio and break-even

The ratio tells you how much revenue you need to cover fixed costs. Break-even revenue is fixed costs divided by the contribution margin ratio. In the AccountingTools example, a company with a 60% ratio and a $60,000 loss needs $100,000 more in sales to break even, because $60,000 ÷ 60% = $100,000.

Break-even revenue   = Fixed costs ÷ Contribution margin ratio
Break-even customers = Fixed costs ÷ Contribution margin per customer

The AI writing tool spends $30,000 a month on salaries, base hosting and software. At a 73.3% ratio it breaks even at $40,913 of monthly revenue, or 835 customers at $35.93 each. With 1,000 customers it earns $5,930 above break-even.

835
customers to break even at $30,000 of fixed costs and a 73.3% ratio

That math assumes the ratio holds as you grow. For an AI product it only holds if new customers use AI the way current ones do, which is the assumption the next section tests.

Contribution margin per unit when the unit is a customer

The per-unit formula comes from manufacturing, where every unit costs about the same to make. A drum set costs the same to build whoever buys it. An AI customer is different: two people on the same $49 plan can cost $3 and $95 in model calls, so the average variable cost describes almost nobody.

Example. Split the AI writing tool's 1,000 customers by how much they use the AI feature. The $11,350 AI bill averages $11.35 per customer, but the spread is wide.

GroupCustomersAI cost eachPayment feeContribution eachRatio
Light users700$3.00$1.72$44.2890.4%
Regular users250$18.00$1.72$29.2859.8%
Heavy users50$95.00$1.72−$47.72−97.4%
All customers1,000$11.35 avg$1.72$35.93 avg73.3%

Example data. Payment fee at Stripe's 2.9% + 30¢ on a $49 charge.

The company-wide ratio of 73.3% looks healthy, and every number in it is correct. Underneath it, 50 heavy users cost $95 each and lose you $47.72 apiece, $2,386 a month in total. They are 5% of customers and 41.9% of the AI bill. If the next 200 sign-ups look more like them than like the light users, the break-even number from the previous section stops being true.

Now fix only the heavy users. Moving them to a cheaper model you've tested on their tasks cuts their AI cost from $95 to $40. Each one goes from −$47.72 to $7.28, the company gains $2,750 of contribution a month, and the ratio rises from 73.3% to 78.9% without a single price change.

+5.6 pts
on the contribution margin ratio from fixing 50 of 1,000 customers

To run this split on your own product, you need each customer's AI cost next to what they pay. Lancelot puts the two side by side for every customer, then fixes the ones losing you money, within limits you set: it can throttle them, switch them to a cheaper model you've approved, or draft an upgrade offer, with Undo on every change (Margin intelligence). Customer profitability analysis covers the wider method.

Common mistakes with the contribution margin formula

  • Counting fixed costs as variable. Base server costs and support salaries don't rise with each customer. Leave them out, or the ratio understates what each sale adds.
  • Using the average AI cost per customer. The average is right for the whole company and wrong for any single customer or plan, as the table above shows.
  • Forgetting payment fees. They scale with every charge, so they belong in contribution margin even when your books put them under general and administrative expenses.
  • Leaving out free users. Their AI calls are a variable cost with no revenue against it, so a free tier lowers the company ratio. Report it as its own plan.

Contribution margin is also easy to confuse with gross margin, which subtracts cost of goods sold and mixes in fixed costs. Gross margin vs contribution margin puts the two side by side on the same month of books.

Questions about the contribution margin formula

What is the contribution margin formula?

Contribution margin is revenue minus variable costs. As a ratio, divide that result by revenue: (revenue − variable costs) ÷ revenue. Per unit, subtract the variable cost of one unit from its price. Fixed costs such as salaries and base hosting stay out of the formula.

How do you calculate the contribution margin ratio?

Subtract total variable costs from total revenue, then divide by total revenue. A product with $49,000 of revenue and $13,070 of variable costs has a contribution margin of $35,930 and a ratio of 73.3%. You can also compute it as one minus the variable cost ratio.

What is contribution margin per unit?

Contribution margin per unit is the price of one unit minus the variable cost of that unit. For a subscription product the unit is usually a customer for a month. A $49 customer with $13.07 of variable costs contributes $35.93 toward fixed costs and profit.

How does contribution margin relate to break-even?

Divide fixed costs by the contribution margin ratio to get break-even revenue, or by contribution margin per customer to get break-even customers. With $30,000 of monthly fixed costs and a 73.3% ratio, a product breaks even at $40,913 of revenue, or 835 customers paying $49.

Are AI API costs variable costs?

Yes. Model APIs bill by the token, and each customer request triggers new tokens, so the cost rises with usage. They belong in contribution margin. Reserved GPU capacity that you pay for whether or not anyone uses it behaves more like a fixed cost.

Why does the average contribution margin hide losses on AI products?

AI cost varies widely between customers on the same plan, so an average blends light users who are very profitable with heavy users who lose money. In this post's example, a 73.3% company ratio contains 50 customers at −97.4% who cost 41.9% of the AI bill.

The contribution margin ratio is one line in a bigger model of what each customer earns you. For revenue, cost and margin per customer, plan and feature in one place, read our guide to AI unit economics.

Keep reading

All dispatches →
AI agent cost: what one task and one customer cost to run
Running AI in production
/
9
min read

AI agent cost: what one task and one customer cost to run

AI wrapper economics: price, model mix and your heaviest 5%
AI unit economics
/
8
min read

AI wrapper economics: price, model mix and your heaviest 5%

Usage-based billing for AI: what to meter and how Stripe bills it
Pricing AI products
/
9
min read

Usage-based billing for AI: what to meter and how Stripe bills it

What is a token in AI? Words per token, context and cost
Running AI in production
/
9
min read

What is a token in AI? Words per token, context and cost

Get the numbers when they change.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
New dispatches and model price changes. Unsubscribe anytime.