Percentage difference calculator
10 and 6 differ by 50 %: their gap of 4 is half of their average, 8. Enter two values to get the percentage difference measured against their mean, with neither number treated as the starting point. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 10
- B
- 6
- Absolute difference
- 4
- Average
- 8
- Percentage difference
- 50
Percentage difference measures how far two numbers sit from each other relative to their arithmetic average, not relative to a designated starting value. That distinction matters in laboratories, finance, and quality control: percentage change asks how much a figure grew or shrank from an old baseline, while percentage difference is symmetric and answers how different two measurements are when neither one is privileged as the original. This calculator accepts two finite numbers a and b, takes the absolute gap, divides by the absolute value of their mean, multiplies by one hundred, and returns the percentage together with the echoed inputs, the absolute difference, and the average used in the denominator. Both numbers cannot be zero, and neither may be infinite or not-a-number, because the ratio would be undefined.
What percentage difference is and how the average-relative formula works
The percentage difference between two numbers is their absolute gap expressed as a percent of their arithmetic average. Write a and b for the two values. The identity used here is the absolute value of a minus b, divided by the absolute value of a plus b divided by two, then multiplied by one hundred.
Putting the average in the denominator is what makes the measure relative to the typical size of the pair instead of relative to whichever number you happened to type first. The absolute values keep the result non-negative: ten versus six, and six versus ten, both yield fifty percent, and a pair of negative prices such as minus ten and minus six also yields fifty percent because the gap is four and the mean magnitude is eight. Percentage change is a different question.
It divides the signed delta by the first value only, so it is directional, it treats the first number as a baseline, and it fails when that baseline is zero even if the second number is large. Search traffic for a percentage difference calculator is looking for the symmetric, average-relative figure, which is why this landing does not reuse a percent-of or percent-change engine.
A quick classroom check: one hundred and one hundred twenty differ by twenty; their mean is one hundred ten; twenty over one hundred ten times one hundred is about 18.1818 percent. When both inputs are zero the mean is zero and no finite percent exists, so the task is rejected. Opposite values that cancel, such as five and negative five, likewise produce a zero average and are rejected rather than returning infinity.
The calculator does not convert units, does not annualize a rate, and does not apply sample weights: it reports the elementary two-point percentage difference only.
Where an average-relative percent earns its keep, and what it is not
Use this percentage difference calculator when you have two peer measurements and you want a single symmetric percent that does not privilege either one as the baseline. Laboratory duplicates, two vendor quotes, two census vintages, and two sensor readings of the same quantity are the usual cases. If you instead have an old value and a new value and you care about growth or decline, you want percentage change, not percentage difference; that is a different search intent and a different formula.
Keep magnitudes inside the published absolute limit. Do not mix units in a single pair, such as dollars with cents or metres with kilometres, unless you have already converted. Prefer it when both figures are peers.
Round-trip checks are easy: compute the absolute gap and the absolute mean by hand and confirm the ratio times one hundred matches the published percent within twelve decimal places.
What you can do with it
Laboratory duplicate comparison
Compare two replicate readings of the same sample as a symmetric percent of their average, without treating either replicate as a baseline.
Vendor quote and bid spreads
Express how far two comparable quotes sit from each other relative to their mean, then decide whether the spread is large enough to renegotiate.
Classroom checks of the average-relative formula
Let students submit a and b and verify |a−b| over the mean times one hundred, including the both-zero rejection, against a deterministic oracle.
FAQ
How is percentage difference different from percentage change?
Percentage difference is symmetric and relative to the average of the two numbers. Percentage change is directional and relative to the first (old) value only.
Can I enter negative numbers?
Yes, as long as the pair is finite and the average is not zero. Minus ten and minus six yield fifty percent, the same as ten and six.
Does it matter which number I enter first?
No. The measure is symmetric, so 10 and 6 give 50 % and so do 6 and 10. Both values are treated alike and the gap is always reported as a positive percentage.
Why is the average used as the base?
Because neither number is the original. Dividing the gap by the mean of the pair measures the difference against the typical size of both values, instead of against whichever one happened to be typed first.
What happens if both numbers are zero, or 5 and −5?
The calculation is refused. In both cases the average is zero, so no finite percentage exists, and the calculator says so instead of returning an infinite or meaningless result.
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/math/percentage-difference \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":10,"b":6}'const res = await fetch("https://api.kit.forhosting.com/math/percentage-difference", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 10,
"b": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/percentage-difference",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 10,
"b": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/percentage-difference", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":10,"b":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":10,"b":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/percentage-difference", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 10,
"b": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.percentage_difference",
"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 | 1000000000000000 |
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
Invalid input is not billed; a successful API call costs $0.002.
Input contract, response shape, and when the calculation is undefined
A formula string restates the identity for display next to the answer. The two hard mathematical failures are both numbers equal to zero, and any pair whose mean is exactly zero because the values have equal magnitude and opposite sign. Validation failures are not billed. The capability does not accept a list of more than two numbers, does not weight observations, and does not convert currencies or physical units: keep a and b in one consistent unit before you call. Send a JSON body with two required finite numbers named a and b. Each field may arrive as a JSON number or as a numeric string that matches ordinary decimal or scientific notation; missing fields, empty strings, not-a-number values, and infinities fail with invalid_input and name the offending field. Absolute magnitudes above one quadrillion are rejected so products and quotients stay finite in IEEE double precision on the Worker and in the browser. A successful API request is charged the published $0.002 base price with unit item.
Where an average-relative percent earns its keep, and what it is not
Pair classroom examples deliberately: ten and six produce fifty percent; one hundred and one hundred twenty produce about 18.1818 percent; zero and zero demonstrates the invalid_input path. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately send zeros or non-numeric text. Pin the rounded percentage_difference field in tests. This page targets people searching for a percentage difference calculator, percent difference of two numbers, or relative percent difference versus the average; it is not a discount calculator, not a percent-of-total tool, and not a markup engine. API pricing remains the flat $0.002 per successful request.
Technical questions
How is percentage difference calculated?
Send finite numbers a and b. The API returns |a−b| / |(a+b)/2| × 100 as percentage_difference, plus the absolute difference and the signed average.
What happens if both numbers are zero?
The task fails with invalid_input. The average would be zero, so the percentage difference is undefined and the request is not billed.
What does the percentage difference calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.