Contribution margin calculator
A product sold at 50 with a variable cost of 30 leaves a contribution margin of 20 per unit, a 40% ratio. Enter the price and variable cost per unit to see what each sale adds toward fixed costs. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Selling price
- 50
- Variable cost
- 30
- Contribution margin
- 20
- Contribution margin ratio
- 0.4
- Contribution margin percent
- 40
Contribution margin is the money each sold unit leaves after its variable cost is paid, before any fixed cost is touched. Managers, cost accountants, and pricing teams use that remainder to decide whether a SKU should stay on the list, how deep a discount can go, and how many units a campaign must sell before overhead is covered. This contribution margin calculator takes selling price per unit and variable cost per unit, subtracts to obtain contribution margin per unit, then divides that remainder by selling price to obtain the contribution margin ratio and the matching percentage. Zero variable cost is allowed and yields a one hundred percent ratio. A selling price of zero is rejected because the ratio would divide by zero. A unit that does not cover its own variable cost returns a negative contribution margin instead of hiding the loss.
What contribution margin per unit and the ratio actually measure
Contribution margin per unit is selling price minus variable cost per unit. That remainder is the amount each extra sale contributes toward covering fixed costs and, after those are covered, toward operating profit. The contribution margin ratio is that remainder divided by selling price, so it states how many cents of each sales dollar remain after variable costs.
A product sold at fifty with a variable cost of thirty therefore has a contribution margin of twenty per unit and a ratio of zero point four, or forty percent. Those two figures are the backbone of cost-volume-profit analysis: they tell you whether a discount still leaves a positive contribution, how a product-mix shift changes the dollars available for overhead, and how many units a campaign must move before the fixed-cost hurdle is cleared. Contribution margin is not the same as profit margin.
Profit margin subtracts every cost, including rent, salaries, depreciation, and other fixed outlays, from revenue. Contribution margin deliberately ignores fixed costs so managers can see the incremental economics of one more unit. Variable costs move with volume—direct materials, piece-rate labor, per-unit freight, sales commissions, and packaging.
Fixed costs do not move in the relevant range. Mixing the two families is how a catalogue looks profitable in total while a SKU quietly loses money on every extra sale. This calculator implements only the unit identity: contribution margin equals selling price minus variable cost, and the ratio equals that margin divided by selling price.
It does not allocate overhead, compute break-even units, or convert currencies.
Where a contribution margin calculator earns its keep
Merchandisers and pricing teams need a reproducible unit contribution so a discount, a freight bump, or a packaging change can be judged before it hits the catalogue. A publisher ranking for contribution margin calculator is targeting people who already have a selling price and a variable cost and want the managerial-accounting remainder and its ratio, not a net profit margin, not a markup-to-margin conversion, and not a full break-even schedule.
Cost-volume-profit worksheets in a classroom or an LMS need an oracle that rejects a zero selling price and still returns a negative margin when variable cost exceeds price, because those two cases are how students confuse the identity. Engineers writing catalogue tests pin known-good pairs—fifty over thirty, a fractional shelf price, and a zero-price rejection—so a billing or pricing library cannot silently treat contribution margin as if it were profit margin. Failed validation does not consume balance.
What you can do with it
Price a SKU and set a discount floor
Enter unit selling price and variable cost to see contribution margin per unit and the ratio, then test a promotional price without dropping below variable cost.
Product-mix and CVP worksheets
Compare contribution margins across SKUs so mix shifts and campaign volume targets use the same unit remainder, not a blended profit margin.
Managerial-accounting homework checks
Students compute CM and the CM ratio by hand and compare against a deterministic result that rejects a zero selling price.
FAQ
How do I calculate contribution margin per unit?
Contribution margin equals selling price minus variable cost. Example: 50 − 30 = 20 per unit.
What is the contribution margin ratio?
It is contribution margin divided by selling price. The same example yields 20 / 50 = 0.4, or 40 percent. The response includes both the decimal ratio and the percentage.
How is this different from profit margin?
Contribution margin subtracts only variable cost. Profit margin subtracts all costs, including fixed overhead. Use this page for unit contribution; use a profit-margin tool when you need the all-in ratio.
What does a negative contribution margin mean?
That the unit does not even cover its own variable cost, so every extra sale loses money before any fixed cost is paid. The calculator shows the negative figure instead of hiding the loss.
Which costs count as variable?
Those that move with volume: direct materials, piece-rate labor, freight per unit, sales commissions and packaging. Rent, salaries and depreciation are fixed costs and stay out of this calculation.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/finance/contribution-margin \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"selling_price":50,"variable_cost":30}'const res = await fetch("https://api.kit.forhosting.com/finance/contribution-margin", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"selling_price": 50,
"variable_cost": 30
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/finance/contribution-margin",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"selling_price": 50,
"variable_cost": 30
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/finance/contribution-margin", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"selling_price":50,"variable_cost":30}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"selling_price":50,"variable_cost":30}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/finance/contribution-margin", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"selling_price": 50,
"variable_cost": 30
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "finance.contribution_margin",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs | 1000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Successful calls are billed at $0.002; invalid input is not charged.
Input contract, response shape, and validation
A variable cost above the selling price is not an error: the engine returns a negative contribution margin so a loss-making SKU is visible instead of rejected. Example: selling price fifty and variable cost thirty yield contribution margin twenty, ratio zero point four, and forty percent. POST a JSON body with two required finite numbers in the same currency. selling_price is the unit selling price and must be strictly greater than zero, because the contribution-margin ratio divides by that price; aliases price, unit_price, selling_price_per_unit, p, and sp are accepted so catalogue rows do not need a rename step. variable_cost is the unit variable cost and must be greater than or equal to zero; aliases variable_cost_per_unit, unit_variable_cost, vc, and variable are accepted. Each field may arrive as a JSON number or as a numeric string. Absolute values must stay within one trillion so intermediate products remain finite in IEEE double precision on the Worker and in the browser. Missing fields, empty strings, non-finite values, a non-positive selling price, a negative variable cost, or a value outside those limits fail with invalid_input naming the field and are not billed. On success the body echoes rounded selling_price and variable_cost, returns contribution_margin as their difference, contribution_margin_ratio as the decimal remainder over price, contribution_margin_percent as that ratio times one hundred, and a formula string you can print next to the numbers. Prefer JSON numbers over currency-formatted strings; dollar signs and thousands separators are not parsed. Pricing for a successful item is a flat $0.002.
Where a contribution margin calculator earns its keep
Keep requests small, pin the rounded contribution_margin and contribution_margin_ratio in tests, and you get stable unit-economics arithmetic for widgets, quote checkers, and edge workers without standing up a full cost-accounting suite of your own.
Technical questions
Can contribution margin be negative?
Yes. If variable cost exceeds selling price the unit does not cover its own variable cost, and the API returns a negative contribution margin and ratio instead of failing.
What does the contribution margin calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.