Absolute Difference Calculator finds |a − b|, the distance between two numbers on the number line with the sign removed. Enter any two real numbers, and the tool subtracts them and strips the sign from the result.
Compute the absolute difference
The absolute difference formula is |a − b|, which subtracts b from a and then takes the absolute value of that result. For a = 12 and b = 19, the raw difference is 12 − 19 = −7, and the absolute value of −7 is 7.
Absolute Difference Calculator shows both the signed subtraction and the final unsigned distance, since seeing the intermediate negative number confirms why the absolute value step matters.
Understand why order does not matter
Absolute difference is symmetric: |a − b| always equals |b − a|, because taking the absolute value removes any distinction in sign that comes from the subtraction order. Computing |19 − 12| gives |7| = 7, the same result as |12 − 19| = |−7| = 7.
This symmetry matches the intuitive idea of "distance," since the distance from 12 to 19 is the same as the distance from 19 to 12.
Work through a negative-number example
Absolute difference works the same way when one or both inputs are negative. For a = −8 and b = 5, the raw difference is −8 − 5 = −13, and |−13| = 13. Absolute Difference Calculator handles negative inputs without any special-case logic, since subtraction and absolute value are both already well defined for negative numbers.
Distinguish absolute difference from plain subtraction
Plain subtraction, a − b, keeps its sign and tells you which of the two numbers is larger, while absolute difference discards that sign and only reports the magnitude of the gap.
For a = 5, b = 9: a − b = −4, showing a is smaller, but |a − b| = 4, showing only the size of the gap without indicating direction.
Absolute Difference Calculator reports both values together so the sign information is not lost even though the primary result is unsigned.
Use absolute difference to measure error
Absolute difference is the standard way to measure how far a measured or estimated value strays from a known correct value, without regard to whether the estimate was too high or too low.
If a recipe calls for 250 grams of flour and a scale reads 238 grams, the absolute difference is |250 − 238| = 12 grams, describing the size of the error regardless of which direction it went.
Use absolute difference to compare temperatures
Absolute difference applies naturally to temperature comparisons, where the direction of change matters less than the size of the swing. A city recording a high of 34 degrees and a low of −6 degrees on the same day has a temperature swing of |34 − (−6)| = |40| = 40 degrees.
Note the subtraction of a negative becomes addition here: 34 − (−6) equals 34 + 6, which is 40, before the absolute value step even needs to remove a sign, since the raw difference was already positive.
Absolute difference of equal values
When a equals b, the absolute difference is always exactly zero, since a − b becomes 0 and |0| = 0. This makes sense with the distance interpretation: the distance from a point to itself on the number line is zero.
Absolute Difference Calculator returns 0 whenever the two entered values match exactly, which is a useful check that two supposedly different measurements are in fact identical.
Avoid this common mistake
Reporting a signed difference when a problem specifically asks for absolute difference misses the point of the calculation. If a question asks "what is the absolute difference between 12 and 19," the answer is 7, not −7; the entire purpose of the absolute value is to remove the sign, so a negative answer indicates the absolute value step was skipped.
Frequently asked questions
What is absolute difference?
Absolute difference is the distance between two numbers on the number line, computed as |a − b|, the absolute value of their subtraction, with the sign of the result always removed.
How do you calculate the absolute difference between two numbers?
To calculate the absolute difference between two numbers, subtract one from the other and take the absolute value of the result, which removes any negative sign and leaves only the magnitude of the gap.
Does the order of subtraction matter for absolute difference?
The order of subtraction does not matter for absolute difference, since |a − b| always equals |b − a|; taking the absolute value erases whichever sign the subtraction order would have introduced.
What is the absolute difference between 12 and 19?
The absolute difference between 12 and 19 is 7, found by subtracting to get −7 and then taking the absolute value, which removes the negative sign.
How is absolute difference different from regular subtraction?
Absolute difference always returns a nonnegative result and discards information about which number was larger, while regular subtraction keeps its sign and tells you exactly which number was larger by how the result is signed.
Can absolute difference be negative?
Absolute difference can never be negative, since the absolute value operation by definition returns zero or a positive number, regardless of the sign of the value inside the absolute value bars.
What is the absolute difference between two equal numbers?
The absolute difference between two equal numbers is always zero, since subtracting a number from itself gives zero, and the absolute value of zero is zero.
How does absolute difference relate to distance on a number line?
Absolute difference is defined specifically to match the geometric idea of distance on a number line, since |a − b| always gives the nonnegative length of the segment connecting the points a and b, regardless of which one is to the left or right of the other.
Summary
Absolute Difference Calculator computes |a − b|, stripping the sign from the subtraction of two numbers to report the pure distance between them on the number line.
It works identically for positive, negative, and mixed-sign inputs, and it always returns a symmetric result: the absolute difference between a and b is exactly the same as the absolute difference between b and a.