Marginal cost calculator
If producing 10 more units raises total cost by 50, each extra unit costs 5. Turn two production snapshots into the cost of one more unit for pricing, a cost review or a homework problem. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Delta total cost
- 50
- Delta quantity
- 10
- Marginal cost
- 5
Marginal cost is the extra outlay of producing one more unit of output: the change in total cost divided by the change in quantity. In discrete production data that identity is MC equals ΔTC over ΔQ, the two-point slope of the total-cost schedule between two output levels you already observed. This marginal cost calculator takes those two changes, divides them, and returns the cost per extra unit so you can mark a homework problem, price a short production run, or pin a cost review without fitting a continuous cost curve.
What discrete marginal cost measures: extra outlay per extra unit
The discrete marginal cost of an extra unit is not the average cost of the whole run and not the last invoice line you paid a supplier. Total cost is the outlay of producing a given quantity, in one currency. Quantity is the number of units of that same good.
Their first differences — how much total cost moved when output moved — are ΔTC and ΔQ. Dividing them is the two-point approximation of the derivative dTC/dQ that textbooks call marginal cost. When output rises by ten units and total cost rises by fifty, the extra cost per unit is five.
When output rises by one unit, ΔQ is one and MC equals the change in total cost itself, which is the one-additional-unit reading of the same formula. The identity is silent on whether those extra units were produced in the short run or the long run, and it does not split fixed cost from variable cost: whatever you put in ΔTC is what gets divided.
A fall in total cost as output rises yields a negative MC, which this calculator reports rather than hides, because a two-point slope can be negative even if a firm's long-run average cost is not. You supply two finite numbers that already share one story — same product, same period, same unit of account — and the calculator divides them and rounds so goldens compare byte-for-byte across runtimes.
Where a marginal cost calculator earns its keep
Operations and cost-accounting desks use a marginal cost calculator to turn two production snapshots into one extra-unit figure before they open a regression of total cost on output or a step-cost model of a plant. Pricing teams pin that same number next to a contribution-margin case so a high sticker is not mistaken for a high extra cost when volume moved with it.
Tutors and exam-prep generators need a deterministic oracle that marks wrong a zero quantity change instead of silently returning Infinity that a buggy grader might treat as success. Product and strategy groups wire the contract into offer reviews and onboarding quizzes that must show MC for a sample ΔTC and ΔQ without calling a cost-curve fitter.
This is a different search and a different job from an average-cost identity that divides total cost by quantity at one point, from a Lerner index that takes MC as an input rather than computing it, and from a break-even identity that never sees a change in output: those tools start from different fields and answer different questions. Failed validation does not consume balance.
Keep the quantity change non-zero, pin the rounded extra-unit cost in tests, and you get a reproducible MC for teasers, homework checks, and edge workers without standing up a microeconomics engine of your own. Continuous derivatives, multi-product cost allocation, and capacity-constraint shadows stay outside this identity on purpose: fold them in your own layer after you have the raw two-point number.
What you can do with it
Turn two cost snapshots into an extra-unit figure
Enter how much total cost moved and how much output moved, then pin MC so the next production increment is priced from the two-point slope, not from average cost.
FAQ
How is this different from average cost?
Average cost divides total cost by quantity at one production point (TC/Q). Marginal cost divides the change in total cost by the change in quantity between two points (ΔTC/ΔQ). They answer different searches and take different inputs.
Can marginal cost be negative?
Yes. When total cost falls as output rises, or when both changes have opposite signs, the two-point slope is negative. This calculator reports that signed result instead of rejecting it.
Do I enter total costs or the change between them?
Enter the changes. Subtract the earlier total cost from the later one and the earlier quantity from the later one, then enter those two differences. The calculator divides the cost change by the quantity change.
Does it separate fixed and variable costs?
No. Whatever change you enter as total cost is what gets divided. Decide beforehand which cost you mean: cash outlay, fully loaded manufacturing cost or variable cost only, and use it for both production levels.
What happens if the quantity did not change?
The calculator rejects it, because dividing by a zero change in quantity is undefined. Marginal cost needs two different output levels; a zero change in cost with a real change in quantity simply gives zero.
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/fin/marginal-cost \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"delta_total_cost":50,"delta_quantity":10}'const res = await fetch("https://api.kit.forhosting.com/fin/marginal-cost", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"delta_total_cost": 50,
"delta_quantity": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/fin/marginal-cost",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"delta_total_cost": 50,
"delta_quantity": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/fin/marginal-cost", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"delta_total_cost":50,"delta_quantity":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"delta_total_cost":50,"delta_quantity":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/fin/marginal-cost", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"delta_total_cost": 50,
"delta_quantity": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "fin.marginal_cost",
"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
A change in quantity of zero fails with invalid_input because the ratio is undefined.
What discrete marginal cost measures: extra outlay per extra unit
A zero change in quantity is not a slope: dividing by zero is undefined, so the task fails with invalid_input instead of inventing Infinity. Pair the JSON with your own rule for which cost is truly total: cash outlay, fully loaded manufacturing cost, or variable cost only. This endpoint divides the two numbers you send; it does not look up a cost function, convert currencies, or estimate a continuous derivative from a scatter of points.
Input contract, response shape, and error behaviour
A negative change in quantity is allowed and then MC is the signed two-point slope of the cost schedule, which is the honest reading when output fell. A negative change in total cost is allowed and then MC can be negative or, with a negative quantity change, positive. Zero change in total cost with a non-zero quantity change yields a marginal cost of zero: extra units did not move the cost total. Example: a total-cost change of fifty and a quantity change of ten yield a marginal cost of five. Example: a total-cost change of one hundred and a quantity change of three yield a repeating third, rounded stably. Keep requests small, pin the rounded result in tests, and you get a reproducible extra-unit cost for worksheets, LMS plugins, and edge workers without standing up a cost-function estimator of your own. POST a JSON body with two required finite numbers. delta_total_cost is the change in total cost in one currency between two production levels; aliases delta_tc, dtc, change_in_total_cost, and tc_change map to the same field so a worksheet can keep its column names. delta_quantity is the change in output in units of the good; aliases delta_q, dq, change_in_quantity, and quantity_change are accepted. Each numeric field may arrive as a JSON number or a numeric string. Missing fields, empty strings, and non-finite values — NaN, Infinity, or text that does not parse as a number — fail with invalid_input naming the field. Those failures are not billed. On success the body echoes delta_total_cost and delta_quantity rounded to twelve decimal places, reports marginal_cost as their ratio, and includes a formula string restating MC = ΔTC / ΔQ. Pricing is a flat $0.002 per successful request.
Integration use cases
Classroom and homework checks
Let students submit ΔTC and ΔQ and verify MC = ΔTC / ΔQ against the textbook identity, including the invalid_input case when quantity does not change.
Short-run pricing and cost reviews
Drop two accounting snapshots into a CI fixture or an offer review and read the extra-unit cost without fitting a continuous total-cost curve.
Technical questions
How is marginal cost calculated from the change in total cost and quantity?
Send a finite delta_total_cost and a finite non-zero delta_quantity. The API returns marginal_cost = delta_total_cost / delta_quantity, plus the formula MC = ΔTC / ΔQ.
What happens if the change in quantity is zero?
The task fails with invalid_input. Marginal cost is undefined when ΔQ is zero, because that amount is the denominator of ΔTC/ΔQ, and the call is not billed.
What does the marginal cost calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.