Cross-price elasticity of demand calculator
If demand for one good rises 5% when another good's price rises 10%, the cross-price elasticity is 0.5 and the goods are substitutes. Enter the two percentage changes to get the elasticity and its classification. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Percent change qty
- 5
- Percent change price
- 10
- Elasticity
- 0.5
- Elasticity abs
- 0.5
- Classification
- substitutes
Cross-price elasticity of demand measures how the quantity demanded of one good responds when the price of a different good changes. Unlike own-price elasticity, which stays on a single demand curve, the cross-price figure compares two markets and tells you whether the pair behaves as substitutes, complements, or unrelated goods. This cross-price elasticity of demand calculator takes the two percentage changes you already have from a problem set, a scanner panel, or a pricing notebook—percent change in quantity demanded of good A and percent change in the price of good B—divides them, and classifies the signed result. A positive elasticity means buyers switch toward A when B becomes more expensive, so the goods are substitutes. A negative elasticity means they buy less of A when B becomes more expensive, so the goods are complements. A zero elasticity means the price of B does not move demand for A, so the goods are unrelated.
The XED formula and what the sign of elasticity means
Cross-price elasticity of demand is the ratio of the percent change in quantity demanded of one good, usually called good A, to the percent change in the price of another good, usually called good B. The formula is a ratio of two already-computed percentages, so the scale you type cancels: ten divided by twenty is the same elasticity as zero point one divided by zero point two, provided both fields use the same convention. What does not cancel is the sign.
When the price of B rises and buyers demand more of A, the numerator and the denominator share a sign and XED is positive: the goods are substitutes, because A can take the place of B in the basket. Coffee and tea, butter and margarine, and competing bus and rail tickets are the usual classroom pairs.
When the price of B rises and buyers demand less of A, the signs oppose each other and XED is negative: the goods are complements, consumed together, such as printers and ink cartridges, game consoles and games, or cars and petrol. When quantity of A does not move at all while the price of B changes, the numerator is zero, XED is zero, and the goods are unrelated.
Own-price elasticity, which divides a quantity change by the price change of the same good, answers a different question and belongs on a different calculator.
Where a cross-price elasticity calculator earns its keep
Introductory microeconomics assigns cross-price problems because the sign is the grading key: students must say substitute, complement, or unrelated, not only compute a ratio. Tutoring platforms and LMS plugins need a deterministic oracle that never invents a relationship when the price change is zero and never flips the sign when both percentages are negative. Category managers comparing two SKUs after a competitor's price cut want the same XED the textbook defines, computed from the two percent changes they already have in a slide, without first reconstructing price and quantity levels.
Retail buyers watching a private-label item against a national brand, and product teams measuring whether an accessory really moves with a hardware price, use the same two-number contract. Pin the rounded elasticity fields in tests, reject a zero price change explicitly, and you get reproducible XED figures for homework, exam generators, and lightweight pricing notebooks without standing up a full demand-system estimator. Own-price midpoint elasticity—how quantity of A responds to the price of A—is a different search and a different page.
What you can do with it
Homework and exam XED checks
Students enter the two percentage changes from a problem set and verify signed elasticity plus the substitutes / complements / unrelated label against the textbook key.
LMS and tutoring auto-grading
Score cross-price items with a deterministic oracle that rejects a zero price change as undefined instead of inventing infinity or a fake relationship.
Category and competitor pricing notebooks
Turn two observed percent changes—your volume versus a rival's price move—into a path-independent XED without rebuilding levels in a spreadsheet.
FAQ
What is the cross-price elasticity of demand formula?
XED = (percent change in quantity demanded of good A) / (percent change in the price of good B). The ratio is the same whether both inputs are written as 5 and 10 or as 0.05 and 0.10.
How does the calculator tell substitutes from complements?
A positive XED means substitutes (demand for A rises when the price of B rises). A negative XED means complements. A zero XED, within a tight float tolerance, means the goods are unrelated.
Should I enter 10 or 0.10 for a ten percent change?
Either works if both fields use the same convention. Ten over twenty equals 0.10 over 0.20; mixing 10 with 0.20 would give the wrong ratio.
What does a cross-price elasticity of 0.5 mean?
It means demand for good A moves half as much as the price of good B, in the same direction. A 10% price rise for B lifts demand for A by 5%, so buyers treat the goods as substitutes.
Why can't the price change be zero?
Because the elasticity divides by the price change, and dividing by zero has no answer. The quantity change, by contrast, can be zero: that gives an elasticity of zero and the goods are labelled unrelated.
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/econ/cross-price-elasticity-demand \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"percent_change_qty":5,"percent_change_price":10}'const res = await fetch("https://api.kit.forhosting.com/econ/cross-price-elasticity-demand", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"percent_change_qty": 5,
"percent_change_price": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/econ/cross-price-elasticity-demand",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"percent_change_qty": 5,
"percent_change_price": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/econ/cross-price-elasticity-demand", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"percent_change_qty":5,"percent_change_price":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"percent_change_qty":5,"percent_change_price":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/econ/cross-price-elasticity-demand", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"percent_change_qty": 5,
"percent_change_price": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "econ.cross_price_elasticity_demand",
"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.
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
The XED formula and what the sign of elasticity means
In symbols, XED equals percent_change_qty divided by percent_change_price. This endpoint returns the signed elasticity, the absolute value, and a classification string so homework keys, tutoring oracles, and pricing notebooks can read the economic relationship without re-deriving the three-way rule.
Inputs, outputs, classification rules, and validation
Either field may be positive or negative; the quantity field may also be zero. Classification uses a tight floating-point tolerance around zero so a genuine zero numerator is labeled unrelated rather than a microscopic substitute. Example: five over ten yields elasticity zero point five and substitutes. Example: negative ten over twenty yields elasticity negative zero point five and complements. Example: zero over eight yields elasticity zero and unrelated. Failed validation is not billed. Send two finite numbers. percent_change_qty is the percent change in quantity demanded of good A. percent_change_price is the percent change in the price of good B. A falling price is a negative percent_change_price; a falling quantity is a negative percent_change_qty. Fields may arrive as JSON numbers or as numeric strings. Missing, empty, or non-finite values fail with invalid_input and name the field. The price percent change must be non-zero: a zero denominator would make elasticity undefined, so the API rejects that case instead of returning infinity. On success the response echoes both inputs and adds elasticity (the signed XED), elasticity_abs (the magnitude textbooks use when they talk about strong versus weak pairs), classification (substitutes, complements, or unrelated), and a short formula string.
Technical questions
Why must the price percent change be non-zero?
A zero percent_change_price makes the denominator zero, so elasticity is undefined. The API returns invalid_input instead of infinity.
What does the cross-price elasticity of demand calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.