The Margin Gap · Marketing Profit
How to Calculate Contribution Margin: Formulas, a Free Calculator, and a Real Campaign Example
To calculate contribution margin, subtract your variable costs from your revenue. That one number shows how much of every sale is left to cover fixed costs and turn into profit. This guide covers the three standard formulas, gives you a calculator, and then shows how to calculate contribution margin for a marketing campaign, where most businesses get it wrong.
Key takeaways
- Contribution margin = revenue − variable costs. The contribution margin ratio is that number divided by revenue.
- Per unit, it’s selling price minus variable cost per unit. That tells you how many units you need to sell to break even.
- For a marketing campaign, variable costs include the cost to deliver the work, ad spend, partner payouts, and fees, and revenue should be what you actually kept after refunds.
- A campaign can show a 4.8 ROAS and only a 22% contribution margin. The worked example below shows exactly how.
- CDAI calculates this for every campaign, every night, from the CRM and ad accounts you already use.
What Is Contribution Margin?
Contribution margin is the money left from a sale after you pay the costs that rise and fall with that sale. Those are your variable costs: materials, labor on the job, shipping, payment fees, sales commissions, and, for a marketing campaign, the cost of winning the customer.
What is left “contributes” toward your fixed costs, like rent, salaries, and software, which you pay no matter how much you sell. Once fixed costs are covered, every extra dollar of contribution margin is profit. Investopedia and the standard managerial accounting texts define it the same way.
That is why finance teams love it. Revenue tells you how big a sale was. Contribution margin tells you whether it was worth making. (For the history and variations of the term, see Wikipedia’s entry on contribution margin.)
Before you calculate contribution margin, sort every cost into one of two buckets: does it go up when you sell more (variable), or would you pay it anyway (fixed)? Getting that split right matters more than any formula.
The Contribution Margin Formulas
You can calculate contribution margin three ways, and you will use all three. Each one answers a slightly different question.
- Total contribution margin tells you how many dollars a product line, month, or campaign contributed.
- Contribution margin per unit tells you what each sale adds, which is what you need for pricing and break-even math.
- The contribution margin ratio tells you what share of every revenue dollar is left. It’s the easiest way to compare products or campaigns of different sizes. Xero’s guide to the contribution margin ratio walks through more examples.
How to Calculate Contribution Margin, Step by Step
Here is how to calculate contribution margin for any product or service, using a simple example. You only need two numbers to start: revenue and variable costs.
- Find your revenue. A product sells for $50, and you sold 1,000 units: $50,000 in revenue.
- List every variable cost. Materials, labor, shipping, and payment fees come to $20 per unit: $20,000 in total.
- Subtract. $50,000 − $20,000 = $30,000 total contribution margin, or $30 per unit.
- Divide by revenue for the ratio. $30,000 ÷ $50,000 = 60%. Sixty cents of every dollar is left for fixed costs and profit.
- Use it for break-even. With $12,000 in fixed costs, you break even at $12,000 ÷ $30 = 400 units. Every unit after that adds $30 of profit, so 1,000 units produce $18,000 in profit.
That is the textbook way to calculate contribution margin. It works cleanly for products because the variable costs are easy to see. Marketing is harder, because the costs that decide a campaign’s profit live in different systems. More on that below.
Contribution Margin Calculator
Use this free calculator to calculate contribution margin two ways: the standard version, or for a single marketing campaign. Switch tabs and type over the example numbers.
Calculate contribution margin
60 cents of every revenue dollar is left to cover fixed costs and profit.
How to Calculate Contribution Margin for a Marketing Campaign
Most guides stop at products and units. But if you spend money on ads or buy leads, the question that matters most is whether each campaign made money. That is where contribution margin gets tricky, and where ad dashboards quietly mislead.
To calculate contribution margin for a campaign, use the same formula with campaign-specific inputs. When you calculate contribution margin this way, the result is the profit a campaign really produced:
- Revenue is the revenue the campaign actually closed, minus refunds, cancellations, and chargebacks. It is not the conversion value an ad platform reports.
- Variable costs are everything that rose because of that campaign:
- the cost to deliver the work it won
- ad spend
- lead vendor and partner payouts
- payment and financing fees
- sales commissions
- compliance costs on bought leads
Some teams call the result “contribution margin after marketing.” The Corporate Finance Institute describes it as contribution margin after deducting variable and marketing costs. Whatever you call it, it is the number that tells you whether to spend more. MarTech makes the same case for judging marketing on contribution margin rather than revenue.
Worked example: a $50,000 home services campaign
Here is an illustrative example with realistic numbers, the same ones preloaded in the calculator above. Follow along and you can calculate contribution margin for any campaign in about five minutes.

| Line | Amount |
|---|---|
| Closed revenue from the campaign | $240,000 |
| Refunds ($36,000) and chargebacks ($12,000) | −$48,000 |
| Revenue actually kept | $192,000 |
| Cost to deliver the work (labor and materials, 45% of revenue kept) | −$86,400 |
| Ad spend | −$50,000 |
| Lead partner payouts | −$6,000 |
| Financing fees on financed jobs | −$7,000 |
| Contribution margin | $42,600 |
| Contribution margin ratio ($42,600 ÷ $192,000) | 22.2% |
| Dashboard ROAS ($240,000 ÷ $50,000) | 4.8× |
On the ad dashboard, this campaign looks like a star: $240,000 in revenue on $50,000 in spend. The real picture is still profitable, but at a 22.2% contribution margin it earns about 22 cents on each dollar it brings in, not the 79 cents that “revenue minus ad spend” implies. That changes how aggressively it should be scaled, and it is exactly the kind of gap most owners never see.
Contribution Margin vs. Gross Margin vs. ROAS
These three numbers get mixed up constantly. Here is how they differ:
| Metric | Formula | What it answers | What it leaves out |
|---|---|---|---|
| Contribution margin | Revenue − all variable costs | Did this sale or campaign make money after the costs it created? | Fixed costs (by design) |
| Gross margin | (Revenue − cost of goods sold) ÷ revenue | How profitable is what we sell, before selling costs? | Marketing, commissions, and other variable selling costs |
| ROAS | Revenue ÷ ad spend | How much revenue did each ad dollar bring in? | Cost to deliver, partner payouts, refunds, fees, and profit |
That is why businesses that calculate contribution margin per campaign make better budget calls than those that stop at ROAS. HubSpot defines ROAS as revenue for every dollar spent on advertising, a useful speed check but not a profit number. If you want a marketing-specific profit metric, see our guide to net marketing contribution, which is closely related and built for measuring marketing’s profit impact.
Five Mistakes to Avoid When You Calculate Contribution Margin
Most errors come from the inputs, not the formula. Watch for these five whenever you calculate contribution margin:
1. Using reported revenue instead of revenue you kept
Refunds, cancellations, and chargebacks often arrive weeks after the sale. If you calculate contribution margin on the revenue number from the day of the sale, you overstate it every time.
2. Counting refunds twice
Subtract refunds and chargebacks from revenue or count them as a cost, never both. Double counting is one of the most common spreadsheet errors. In the example above it would turn a $42,600 contribution margin into a $5,400 loss on paper.
3. Stopping at ad spend
Ad spend is only one variable cost of a campaign. Lead vendor and partner payouts, financing and payment fees, commissions, and the cost to deliver the work all belong in the calculation.
4. Measuring the channel instead of the campaign
“Paid social ran a 25% contribution margin” can hide one campaign at 45% and another losing money. Budget moves campaign by campaign, so that is the level to measure.
5. Giving ads credit for revenue they didn’t earn
Referral and word-of-mouth customers often get attributed to whatever ad they clicked last. That inflates the campaign’s revenue, and its contribution margin along with it.
More on hidden costs: how chargebacks inflate true marketing cost and how financing fees eat home services margin. For a deeper look at the ROAS gap, see why ROAS can look good while campaigns lose money.
What Is a Good Contribution Margin?
There is no single “good” number, because it depends on your fixed costs. A business with low overhead can thrive on a lower ratio. A business with a large team and office needs a higher one. The test is simple: your total contribution margin has to be bigger than your fixed costs, or you are losing money overall.
What the ratio means is straightforward. A 40% contribution margin means 40 cents of every revenue dollar is left after variable costs. A 30% contribution margin leaves 30 cents. Whether that is “good” depends on whether those cents cover your overhead with room to spare, and on whether the number is rising or falling over time.
For marketing campaigns, the most useful comparison is campaign against campaign. Once you calculate contribution margin for each one, the budget decisions get much clearer. Your highest-margin campaigns deserve more budget; the ones near zero deserve a hard look. That comparison only works if every campaign is measured the same way.
How CDAI Calculates Contribution Margin on Every Campaign, Every Night
Doing this by hand for one campaign is a spreadsheet exercise. Doing it for every campaign, every night, while refunds and chargebacks keep arriving, is a full-time job. CDAI (Capital, Decision, Accuracy, Intelligence), the engine behind Allocera Intelligence, does it automatically, working with the tools you already use. Instead of trying to calculate contribution margin in a spreadsheet after the money is spent, you see it every morning.
It connects to your existing stack. Meta, Google Ads, LinkedIn, HubSpot, and Salesforce connect in one click. CallRail connects with an API key. There are also built integrations for Ringba, Boberdoo, Bing, and Stripe, plus CSV import and a webhook for any other system. You can start with one CRM and one ad account; see how it works.
Then, every night, for every campaign, it:
- Calculates real profit. It takes the revenue each campaign actually closed and subtracts every real cost of winning it: ad spend, fees, partner payouts, refunds, chargebacks, compliance costs, and any operating costs you add, like fulfillment.
- Gives each campaign a clear decision: scale, hold, cut, pause, quarantine, renegotiate, investigate, or flag. You stay in control of every move.
- Judges each campaign on the right timeline. It uses a rolling window matched to your sales cycle (30 days by default), so nothing gets cut before its deals could close.
- Checks its own work. Every night it rechecks recent decisions against the raw numbers, and it grades past decisions against what actually happened, with the dollar impact.
- Never guesses. Referral and offline revenue is counted but never forced into a campaign. Data that doesn’t add up gets flagged instead of acted on, and personal data is scrubbed before anything is stored.
It works alongside your CRM and attribution tools, not instead of them. They tell you who the customer is and which touchpoint gets credit. CDAI tells you whether the campaign made money after every cost.
Validated before release
Before release, CDAI’s decisions were checked in a controlled validation across 9 businesses in 7 industries: 89.5% accurate overall (1,210 of 1,352 scored decisions), with the underlying math matching 100%. Every decision type:
| Decision | What it tells you | Accuracy |
|---|---|---|
| Scale | Spend more here | 98.0% (818 of 835) |
| Hold | Keep this steady | 95.2% (40 of 42) |
| Pause | Stop this now | 85.2% (144 of 169) |
| Flag | A person should look at this | 70.9% (200 of 282)The other 82 were neutral; none were wrong. |
| Cut | Reduce spend | 55.6% (5 of 9)All misses came from one deliberately extreme stress-test business. |
| Investigate | Something needs a closer look | 100% (2 of 2) |
| Renegotiate | A partner is taking too much | 100% (1 of 1) |
| Quarantine | Suspicious data, kept out of decisions | Caught correctly in all 12 cases. The outcome depends on a person acting on it, so these 12 count as misses in the overall number. |
Read the full method and results in our contribution margin marketing validation report. Industry deep dives: HVAC and plumbing, personal injury law, and senior living.
Contribution Margin FAQs
How do you calculate contribution margin?
Subtract total variable costs from revenue. For example, $50,000 in revenue minus $20,000 in variable costs is a $30,000 contribution margin. Divide by revenue to get the ratio: $30,000 ÷ $50,000 = 60%.
How do you calculate contribution margin per unit?
Subtract the variable cost per unit from the selling price per unit. A product that sells for $50 with $20 of variable cost has a $30 contribution margin per unit. Divide your fixed costs by that number to find your break-even point in units.
How do you calculate the contribution margin ratio?
Divide contribution margin by revenue and multiply by 100. The ratio shows what share of every revenue dollar is left after variable costs. It’s the best way to compare products or campaigns of different sizes.
What is the difference between contribution margin and gross margin?
Gross margin subtracts only the cost of goods sold. Contribution margin subtracts all variable costs, including selling and marketing costs that rise with each sale. That makes contribution margin the better number for deciding where to spend.
What does a 40% contribution margin mean?
It means 40 cents of every revenue dollar is left after variable costs, available to cover fixed costs and produce profit. Whether that is enough depends on your fixed costs.
Is a 30% contribution margin good?
It can be, depending on your overhead. A 30% ratio leaves 30 cents per revenue dollar. If that covers your fixed costs with room to spare and it is holding steady or rising, it is healthy for your business.
Can I calculate contribution margin in Excel or Google Sheets?
Yes. Put revenue in cell B1 and total variable costs in B2. Contribution margin is =B1-B2, and the ratio is =(B1-B2)/B1 formatted as a percentage. The formula is easy. The hard part is keeping the inputs current when refunds, payouts, and fees live in different systems.
What costs should I include when I calculate contribution margin for ads?
Include every cost that rose because of the campaign: ad spend, lead vendor and partner payouts, the cost to deliver the work it won, payment and financing fees, sales commissions, and compliance costs on bought leads. Leave out fixed overhead like rent and salaries. Subtract refunds and chargebacks from revenue.
Do refunds and chargebacks affect contribution margin?
Yes. They reduce the revenue you actually kept. Subtract them from revenue once, never again as a cost, and tie them back to the campaign that produced the original sale.
Stop Calculating Contribution Margin by Hand
Connect the CRM and ad accounts you already use. CDAI will calculate contribution margin for every campaign and tell you what to do about it, every night.