Absolute change calculator
The absolute change between 128.5 and 95.25 is 33.25, whichever value you type first. Enter two numbers to see how far apart they are, without the sign, for drift, price moves or forecast errors. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 128.5
- B
- 95.25
- Absolute change
- 33.25
The absolute change calculator takes two numeric values and returns how far apart they are, regardless of direction: |a − b|, always zero or positive. It answers the simplest and most common question in any comparison — how much did it move? — without you having to know which value came first or whether the change was an increase or a decrease. Non-numeric, missing or infinite inputs are rejected with a clear error instead of a silent NaN.
What absolute change means
Change between two values can be reported in two ways. The signed change, b minus a, tells you the direction: positive when the value grew, negative when it shrank. The absolute change throws the sign away and keeps only the magnitude.
That is what you want whenever the direction is irrelevant or already known: the drift of a sensor from its reference reading, the size of a price adjustment, the error between a forecast and the observed value, or the distance between two measurements of the same quantity. The absolute change is symmetric — |a − b| equals |b − a| — so the order of the two inputs never matters, and the result is always zero or greater. Zero means the two values are identical.
Because the result is a plain number in the same units as the inputs, it composes cleanly with any downstream check, for example alerting when the absolute change exceeds a threshold.
Where it fits in a pipeline
Absolute change is rarely the final answer; it is the building block other checks are made of. Monitoring jobs use it to compare a current metric against a baseline and trigger only when the magnitude of the movement crosses a limit, without caring about the sign. Reconciliation tasks use it to confirm that two systems agree within a tolerance, summing absolute changes across rows to get a total discrepancy.
Data-cleaning steps use it to flag outliers by their distance from a median or a previous value. Because this capability is deterministic, stateless and has no side effects, it is safe to call at any volume and to memoize.
What you can do with it
Alert on metric drift
Compare a current reading against its baseline and page someone when the absolute change crosses a threshold, regardless of direction.
Reconcile two systems
Check that an amount recorded in two databases matches within tolerance by verifying the absolute change is near zero.
Measure forecast error
Compute how far a prediction landed from the observed value; the absolute change is the absolute error used in MAE-style scoring.
FAQ
Does the order of the two values matter?
No. |a − b| equals |b − a|, so the result is identical either way.
Can I pass numbers as strings?
Yes. A non-empty string that parses as a finite number, such as "128.5", is accepted and converted before the subtraction.
What about Infinity or NaN?
They are rejected. Both inputs must be finite numbers, so the result is always a real, non-negative number.
Is anything stored?
No. The computation is stateless: the two values are read, the difference is returned, and nothing is kept.
What is the difference between absolute change and signed change?
Signed change, the second value minus the first, keeps the direction: positive for a rise, negative for a fall. Absolute change drops the sign and keeps only the size of the move, so it is never negative.
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/absolute-change \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":128.5,"b":95.25}'const res = await fetch("https://api.kit.forhosting.com/math/absolute-change", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 128.5,
"b": 95.25
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/absolute-change",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 128.5,
"b": 95.25
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/absolute-change", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":128.5,"b":95.25}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":128.5,"b":95.25}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/absolute-change", 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": 128.5,
"b": 95.25
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.absolute_change",
"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
How the calculation works
The same pure module runs in both places, so a result you verify interactively is the result your pipeline will receive. There are no hidden limits on magnitude beyond what finite doubles can represent. The endpoint accepts two fields, a and b, each of which must be a finite number. Numeric strings like "42.5" are accepted and converted, but anything that does not represent a finite number — null, booleans, NaN, Infinity, empty strings, objects — is rejected with an invalid_input error and is never billed. The result is computed as the absolute value of the difference, Math.abs(a − b), in double precision, exactly the same arithmetic your browser or any IEEE-754 runtime performs. There is no rounding policy applied on top: what the subtraction yields is what you get back, which keeps the API byte-for-byte reproducible between the free browser version and the paid endpoint.
Where it fits in a pipeline
It runs on our global edge with nothing stored after the response, and it is free to use interactively on this page — you pay only $0.002 per request when you automate it through the API.
Technical questions
What does it cost?
$0.002 per request via the API. It is also free to run in your browser on this page.
What happens with non-numeric input?
The request is rejected with an invalid_input error explaining which field failed. Errored requests are not billed.