What is the absolute difference?
The absolute difference between two numbers is simply how far apart they are on the number line, ignoring direction. Mathematically it is written \(\left| x - y \right|\) and is always a non-negative value. Because distance has no sign, \(\left| x - y \right|\) equals \(\left| y - x \right|\) — the order in which you enter the two numbers never changes the answer. This is a pure algebra tool and works identically everywhere, with no region-specific rules.
How to use this calculator
Enter your two values in the x and y fields. They can be positive, negative, decimals, or zero. Press calculate and you will see the absolute difference plus a "show the work" row that substitutes your numbers into the formula so you can follow each step.
The formula explained
The rule is $$\text{absoluteDifference} = \left| x - y \right|$$ First subtract y from x to get a signed difference. Then apply the absolute value function: if the result is already zero or positive, keep it; if it is negative, drop the minus sign. Equivalently, \(\text{abs}(x - y) = \max(x - y,\ y - x)\).
Worked example
Suppose \(x = 3\) and \(y = 9\). Subtract: \(3 - 9 = -6\). Take the magnitude: \(\left| -6 \right| = 6\). So the absolute difference is 6. With negatives, \(x = -3\) and \(y = -9\) gives $$(-3) - (-9) = -3 + 9 = 6,$$ and \(\left| 6 \right| = 6\).
FAQ
Does the order of x and y matter? No. \(\left| x - y \right| = \left| y - x \right|\), so swapping the inputs returns the same result.
Can the answer be negative? Never. The absolute value function guarantees a result that is zero or positive.
What if x equals y? The difference is 0, which is a valid answer, not an error.