Gross margin subtracts cost of goods sold, fixed and variable, from revenue. Contribution margin subtracts only the costs that rise with each sale or customer, wherever they sit on the P&L. In the example below, one month of books gives a $49 AI product a 51.7% gross margin and a 69.4% contribution margin.
You need both. Gross margin is the line your board and investors benchmark, and contribution margin per customer tells you which accounts, plans and features pay for themselves. Both sit inside our guide to AI unit economics.
Gross margin vs contribution margin: the difference in one table
The two metrics differ in which costs they subtract. Gross margin takes cost of goods sold, often labeled cost of revenue at a SaaS company, and that line mixes fixed costs such as support staff with variable ones such as model API calls. Contribution margin takes every variable cost and no fixed ones, so it can include costs booked below the gross profit line, such as payment fees.
| Gross margin | Contribution margin | |
|---|---|---|
| Costs subtracted | Cost of goods sold (cost of revenue) | Variable costs only |
| Fixed costs inside | Yes: support staff, base hosting | None |
| Variable costs booked outside COGS | Left out (payment fees in G&A, for example) | Included |
| Where it appears | Income statement, right after COGS | Internal reports and models |
| Who reads it | Board, investors, acquirers | Founders, finance, whoever owns pricing |
| Level | Company or product line | Customer, plan or feature |
| Main use | Benchmarks and valuation | Pricing, plan limits, which accounts to fix |
Source: AccountingTools for the definitions and placement. The last three rows describe common SaaS practice.
Steven Bragg at AccountingTools calls contribution margin the recommended method of analysis, because gross margin depends on how you allocate fixed costs. That allocation problem is the reason a per-customer gross margin misleads, and the customer table further down shows it with numbers.
How to calculate gross margin and contribution margin
Gross margin is revenue minus cost of goods sold, divided by revenue. The AccountingTools gross margin definition places it on the income statement right after the cost of goods sold line and before selling, general and administrative expenses. Contribution margin is revenue minus variable costs, and you can state it in dollars or as a ratio of revenue.
Gross margin = (Revenue − COGS) ÷ Revenue Contribution margin = (Revenue − Variable costs) ÷ Revenue Contribution per customer = Customer revenue − that customer's variable costs
For an AI product, the variable costs per customer come in three groups:
- Model API calls, priced from each call's input, output and cache tokens.
- Usage-based services behind the AI feature, such as embeddings and a vector database.
- Payment processing. Stripe's standard US card rate is 2.9% + 30¢ per successful charge, or $1.72 on a $49 charge.
Some teams also subtract variable selling costs such as commissions, which gives a contribution margin after sales. Pick one definition, write it down, and keep it the same from month to month so the trend means something.
Costs that sit between fixed and variable
Some costs move in steps. Base hosting stays flat until you add a database replica, and a support team stays the same size until ticket volume forces a new hire. Treat a step cost as fixed for decisions about one customer, and revisit the split when a plan or a customer segment would push you to the next step.
AI cost can also sit in both columns. Per-token API calls are variable. Reserved GPU capacity or a provider commitment you pay whether or not customers use it is fixed, so keep it in gross margin and out of contribution margin. If a provider credit lowers your bill, book the credit apart from usage so contribution margin per customer reflects list price, the price you would pay once the credit runs out.
Why AI products need both margins
Classic SaaS could run on gross margin alone, because serving one more customer cost close to nothing. Inference breaks that: every customer request triggers a model call, and the bill grows with usage. In 2020, Andreessen Horowitz reported AI companies often ran 50% to 60% gross margins, against 60% to 80% or more for comparable SaaS. ICONIQ's State of AI report (July 2026) put the average AI product at 45% gross margin in 2025, with 53% projected for 2026.
Gross margin for the board
Your board and investors compare your gross margin with those benchmarks, follow its trend quarter by quarter, and price it into valuation. Report it on a consistent COGS policy with inference inside COGS, and show the AI share as its own line so they can watch it move. The line-by-line treatment, including evals and free-tier usage, is in SaaS COGS when you sell AI.
Contribution margin per customer for decisions
Gross margin can't tell you whether to keep a customer, change a plan limit or move a feature to a cheaper model. Each of those decisions changes variable costs, and contribution margin measures variable costs. Your support team and base hosting cost the same whether a given customer stays or leaves, so loading a share of them onto each account distorts the answer.
Example: one month of a $49 AI product, measured both ways
Example. An AI writing product has 1,200 customers on a $49 monthly plan, or $58,800 in monthly revenue. Its books put payment fees in G&A, and its base hosting and support team would cost the same at 1,000 customers as at 1,400. The table runs the same month through both formulas.
| Line | Gross margin view | Contribution margin view |
|---|---|---|
| Revenue (1,200 × $49) | $58,800 | $58,800 |
| Model API calls (variable, COGS) | $14,700 | $14,700 |
| Vector database and embeddings (variable, COGS) | $1,200 | $1,200 |
| Base production hosting (fixed, COGS) | $4,500 | Left out |
| Support and DevOps staff (fixed, COGS) | $8,000 | Left out |
| Payment processing (variable, G&A) | Left out | $2,065 |
| Costs subtracted | $28,400 | $17,965 |
| Gross profit or contribution | $30,400 | $40,835 |
| Margin | 51.7% | 69.4% |
Example data. Monthly figures. Payment fees use Stripe's 2.9% + 30¢ on each $49 charge.
The figures split for two reasons. Gross margin carries $12,500 of fixed COGS that contribution margin leaves out, and contribution margin carries $2,065 of payment fees that gross margin leaves in G&A. Model calls average $12.25 per customer, a quarter of the price, and both margins carry that cost in full.
How to calculate contribution margin per customer
Contribution margin per customer starts from that customer's revenue and subtracts the variable costs that customer caused. Model API cost varies the most between accounts, so you need it per customer, which means tagging each model call with the billing customer ID when your code makes it. The smaller costs can follow simple rules: $1.00 of vector database and $1.72 of payment fees per customer in this example.
The table shows six of the 1,200 customers. The last column spreads the $12,500 of fixed COGS evenly, $10.42 per customer, to show what a per-customer gross margin would report.
| Customer | AI cost | Other variable costs | Contribution | Contribution margin | Gross margin with fixed COGS spread |
|---|---|---|---|---|---|
| Northwind | $2.10 | $2.72 | $44.18 | 90.2% | 72.4% |
| Birchline | $9.40 | $2.72 | $36.88 | 75.3% | 57.5% |
| Larkspur | $24.60 | $2.72 | $21.68 | 44.2% | 26.5% |
| Quillmere | $39.00 | $2.72 | $7.28 | 14.9% | −2.9% |
| Oakhaven | $51.90 | $2.72 | −$5.62 | −11.5% | −29.2% |
| Fenmoor | $88.75 | $2.72 | −$42.47 | −86.7% | −104.4% |
Example data. Every customer pays $49 a month. Other variable costs are $1.00 of vector database and embeddings plus $1.72 of payment fees. The last column leaves out payment fees, which this company books to G&A.
Quillmere is where the two views disagree. The spread gross margin says Quillmere loses money, yet the account adds $7.28 a month toward fixed costs. If Quillmere churns, monthly profit drops by $7.28 and the $10.42 of support and hosting stays on the books. Oakhaven and Fenmoor are underwater on both views, because their model calls alone cost more than the $49 they pay. The full method, with annual plans and seats, is in our customer profitability analysis.
What to do with a negative contribution margin
A customer with negative contribution loses you money every month the account stays, so fix the account before you reprice the plan. An upgrade to a $199 plan gives Fenmoor $103.18 of contribution, a 51.8% margin, after the higher payment fee. Holding Fenmoor's AI spend to $30 a month keeps the $49 price and lifts contribution to $16.28, or 33.2%.
Lancelot sees AI cost against what each customer pays in Stripe or RevenueCat, and acts on the customers losing money: it drafts an upgrade offer with your own Stripe Payment Link for you to send, holds a customer to the plan's normal daily spend, or switches them to a cheaper model you approved in advance. Every action starts as a suggestion, runs within limits you set, and has Undo (Margin intelligence).
Questions about gross margin vs contribution margin
What is the difference between gross margin and contribution margin?
Gross margin subtracts cost of goods sold, which mixes fixed and variable costs, from revenue. Contribution margin subtracts only variable costs, including ones booked outside COGS such as payment fees. Gross margin is the reported figure investors benchmark; contribution margin is the internal figure you compute per customer, plan or feature.
What is the gross margin definition?
Gross margin is revenue minus cost of goods sold, divided by revenue. For a SaaS or AI company, cost of goods sold covers hosting, production support, third-party software inside the product and model API calls. It appears on the income statement right after the cost of goods sold line.
How do you calculate contribution margin per customer?
Take the customer's monthly revenue and subtract the variable costs that customer caused: model API calls from tagged usage, usage-based services such as embeddings, and payment fees. A $49 customer with $24.60 of AI cost and $2.72 of other variable costs contributes $21.68, a 44.2% contribution margin.
Is contribution margin higher than gross margin?
In most SaaS books, yes. Contribution margin leaves out fixed costs such as support staff and base hosting, and those tend to outweigh the variable costs it adds, such as payment fees. In this post's example, the same month shows a 69.4% contribution margin and a 51.7% gross margin.
Are AI inference costs fixed or variable?
Inference billed per token by an API provider is a variable cost, because each customer request triggers it and usage scales it. It belongs in both COGS and contribution margin. Reserved GPU capacity that you pay for whether or not anyone uses it behaves more like a fixed cost.
Which margin should I report to my board?
Report gross margin, on a consistent COGS policy with inference included, because that is the figure investors benchmark. Add contribution margin by plan and the count of customers with negative contribution, since those show where gross margin will move next quarter.
Should payment processing fees go in contribution margin?
Yes. Payment fees scale with every charge, so they are a variable cost and belong in contribution margin whether your books place them in COGS or G&A. On a $49 charge at Stripe's standard 2.9% + 30¢, the fee is $1.72.
Contribution margin per customer feeds plan pricing, payback and the gross margin your board sees, and our guide to AI unit economics shows how those pieces connect.







