What Is the Absolute Difference?
The absolute difference between two numbers is the distance between them on the number line, always expressed as a non-negative value. Written mathematically as \(|a - b|\), it ignores which number is larger and simply tells you how far apart the two values are. Because the result of a subtraction can be negative, the absolute value bars strip away the sign so the answer is never below zero.
How to Use This Calculator
Enter your first number in the Value A field and your second number in the Value B field. The calculator subtracts B from A and returns the absolute value of that result. It also shows the signed difference (A − B) so you can see the direction of the gap if that matters for your problem. Both whole numbers and decimals, positive or negative, are accepted.
The Formula Explained
The formula is simply $$d = |a - b|$$ First compute \(a - b\). If the result is negative, drop the minus sign; if it is positive or zero, leave it as is. For example, both \(10 - 3 = 7\) and \(3 - 10 = -7\) give an absolute difference of 7, because \(|7| = |-7| = 7\). The absolute difference is symmetric: \(|a - b| = |b - a|\).
Worked Example
Suppose Value A = 12 and Value B = 5. The signed difference is \(12 - 5 = 7\). Since 7 is already positive, the absolute difference is \(|7| = 7\). Now reverse them: A = 5, B = 12 gives \(5 - 12 = -7\), and \(|-7| = 7\) — the same answer.
FAQ
Can the absolute difference be negative? No. By definition it is always zero or positive.
What if both numbers are equal? The absolute difference is 0, since \(|a - a| = 0\).
Does the order of A and B matter? Not for the absolute difference — \(|a - b|\) equals \(|b - a|\). It only changes the sign of the displayed signed difference.