Consumer surplus calculator
If you would have paid 120 for a ticket and it costs 85, you keep 35 of consumer surplus. Enter your maximum willingness to pay and the actual price to value a deal, check homework or fill in a welfare worksheet. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Willingness to pay
- 120
- Price
- 85
- Surplus
- 35
Consumer surplus is the extra value a buyer keeps when the price paid sits below the most they would have paid. A shopper who would have paid one hundred twenty for a ticket and finds it at eighty-five keeps thirty-five of surplus; that gap is the individual identity used in introductory microeconomics, welfare checks, and pricing reviews. This consumer surplus calculator takes a maximum willingness to pay — the reservation price — and the actual price paid, subtracts, and returns the surplus so you can value a deal, check homework, or plug a figure into a welfare worksheet. Enter both amounts in the same currency; receive the surplus, the echoed inputs, and the formula surplus equals willingness to pay minus price. Zero surplus is allowed when the two amounts match: the buyer is indifferent.
What unit consumer surplus means: willingness to pay minus price
Unit consumer surplus is the extra money-metric value a buyer keeps on a single purchase when the ticket price is below their reservation price. Willingness to pay is the most they would still pay and walk away happy; the actual price is what the register, fare, or invoice charged. Subtracting them is the identity CS equals WTP minus P that every principles course writes on the first surplus slide.
A concert-goer who would have paid one hundred twenty and pays eighty-five keeps thirty-five of surplus; a commuter whose reservation fare is four and who pays four keeps zero and is indifferent; a buyer asked to pay more than their reservation price does not complete the trade under this contract. The identity is about one unit in one currency. It does not integrate a downward-sloping market demand curve, does not solve for an equilibrium quantity, and does not add up a basket of different goods.
Those jobs belong to a demand-function integral, not to this reservation-minus-ticket tool. You supply both amounts; the calculator subtracts them and rounds the surplus half-up to two decimal places so goldens compare byte-for-byte across runtimes. A free good with price zero is allowed and then surplus equals the full willingness to pay.
A negative reservation price or a negative paid price is rejected, because neither is a money amount this contract will treat as a purchase.
Where a unit consumer surplus calculator earns its keep
Households comparing a sale price against what they had already decided a gadget was worth use a consumer surplus calculator to turn that gut reservation into one comparable dollar figure before they buy. Tutors and exam-prep generators need a deterministic oracle that marks wrong the case price greater than willingness to pay instead of silently returning a negative surplus that a buggy grader might treat as success.
Product and pricing teams wire the same contract into offer pages and onboarding quizzes that must show surplus for a sample reservation and a posted price without calling a demand model. Failed validation does not consume balance. Keep price no greater than willingness to pay, pin the rounded surplus in tests, and you get a reproducible extra-value amount for teasers, homework checks, and edge workers without standing up a welfare ledger of your own.
Multi-unit baskets, income effects, and tax wedges stay outside this identity on purpose: fold them in your own layer after you have the raw unit surplus.
What you can do with it
Value a posted price against your reservation
Enter the most you would pay for a ticket, fare, or gadget and the price on the page, then pin surplus so the deal sits on a single dollar scale before you buy.
Classroom and homework checks
Let students submit willingness to pay and price paid and verify unit consumer surplus against the textbook identity CS = WTP − P, including the zero-surplus tie.
Offer pages and pricing quizzes
Show surplus for a sample reservation and a posted price in onboarding or A/B copy without integrating a market demand curve.
FAQ
What happens if the actual price exceeds willingness to pay?
Equal amounts are valid and yield zero surplus.
Is this the same as integrating a demand curve?
No. This calculator is the unit identity CS = WTP − P for one reservation and one ticket price. A market demand-function integral uses a different contract and a different search.
Can willingness to pay or the price be zero?
A price of zero (a free good) is allowed and then surplus equals the full willingness to pay. Both amounts zero yields surplus of zero. Negative amounts are rejected.
What is willingness to pay?
The most a buyer would still pay for one unit and walk away happy, also called the reservation price. Anything below it leaves the buyer with surplus; at exactly that price the buyer is indifferent.
How can I use consumer surplus before buying something?
Decide what the item is worth to you, then compare it with the sale price. The surplus turns that gut feeling into one comparable figure, so you can rank several offers by how much value each one leaves you.
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/consumer-surplus \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"willingness_to_pay":120,"price":85}'const res = await fetch("https://api.kit.forhosting.com/fin/consumer-surplus", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"willingness_to_pay": 120,
"price": 85
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/fin/consumer-surplus",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"willingness_to_pay": 120,
"price": 85
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/fin/consumer-surplus", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"willingness_to_pay":120,"price":85}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"willingness_to_pay":120,"price":85}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/fin/consumer-surplus", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"willingness_to_pay": 120,
"price": 85
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "fin.consumer_surplus",
"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
If the actual price exceeds willingness to pay the purchase would not happen under this contract and the task fails with invalid_input instead of a negative surplus.
What unit consumer surplus means: willingness to pay minus price
That last case is not a negative number on a statement: it is a deal that would not happen, so the calculator rejects it as invalid_input rather than inventing a loss.
Input contract, response shape, and error behaviour
Equal amounts are valid and return surplus of zero. Example: one hundred twenty of willingness to pay at a price of eighty-five yields surplus of thirty-five. Keep requests small, pin the rounded surplus in tests, and you get a reproducible welfare figure for worksheets, LMS plugins, and edge workers without standing up a demand-curve engine of your own. POST a JSON body with two required finite numbers. willingness_to_pay is the reservation price in one currency unit; aliases wtp, reservation_price, max_price, and max_wtp map to the same field so a survey export or a homework sheet can keep its column names. price is the actual amount paid in that same currency; aliases actual_price, paid, price_paid, and p are accepted. Each numeric field may arrive as a JSON number or a numeric string. Missing fields, empty strings, and non-finite values fail with invalid_input naming the field. On success the body echoes willingness_to_pay and price rounded to two decimal places, reports surplus as their difference rounded to two decimal places, and includes a formula string restating the identity. Pair the JSON with your own rule for which unit you are valuing — a ticket, a fare, a subscription month — because this endpoint subtracts the two numbers you send; it does not look up list prices, convert currencies, or scale by quantity.
Where a unit consumer surplus calculator earns its keep
This is a different search and a different job from the integral consumer-surplus calculator that takes a polynomial inverse-demand curve and a market price: that tool integrates willingness under the demand function down to equilibrium quantity. This tool prices one unit against one reservation and returns money.
Technical questions
How is consumer surplus calculated from willingness to pay and price?
Send finite non-negative numbers willingness_to_pay (the reservation price) and price (the amount paid). The API returns surplus = willingness_to_pay − price, rounded to two decimal places.
What does the consumer surplus calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.