Absolute Difference Calculator
The absolute difference between two numbers is simply the size of the gap between them, always reported as a non-negative value regardless of which number is larger. It is the distance between two points on a number line, the magnitude of an error, and the basis of tolerance checks across science and engineering. This tool takes two numbers and returns the absolute difference, the signed difference that keeps direction, and the average of the pair. Because absolute value removes the sign, swapping the two inputs leaves the absolute difference unchanged.
Absolute difference formula
Absolute difference = |a - b|
Signed difference = a - b
Average = (a + b) / 2
Here a and b are your two numbers. The vertical bars denote absolute value, which removes any negative sign, so the absolute difference is always zero or positive.
How absolute difference works
- The absolute difference is the magnitude of the gap between two numbers.
- It is never negative and equals zero only when the numbers are identical.
- Swapping the two inputs does not change the absolute difference.
- The signed difference keeps direction, positive when the first number is larger.
- Absolute difference is the one-dimensional measure of distance on a number line.
Absolute difference: frequently asked questions
What is the absolute difference between two numbers?
The absolute difference is the size of the gap between two numbers, always expressed as a non-negative value. You subtract one from the other and take the absolute value of the result: |a - b|. The absolute difference between 7 and 10 is 3, and the absolute difference between 10 and 7 is also 3.
What is the formula for absolute difference?
The formula is absolute difference = |a - b|, where the vertical bars mean absolute value, that is, the magnitude with any negative sign removed. Because absolute value strips the sign, the order of the two numbers does not matter: |a - b| always equals |b - a|.
How does it differ from the signed difference?
The signed difference, a - b, keeps the sign and tells you the direction: positive if the first number is larger and negative if it is smaller. The absolute difference discards the sign and reports only the magnitude of the gap. This calculator shows both so you can use whichever you need.
Can the absolute difference be negative?
No. By definition absolute value is never negative, so the absolute difference is always zero or positive. It equals zero only when the two numbers are identical. If you see a negative result you have computed the signed difference instead.
Where is the absolute difference used?
Absolute difference measures how far apart two quantities are without regard to which is bigger, used in error analysis, distance on a number line, tolerance checks, and comparing readings. It is the one-dimensional version of distance, which is why it never carries a sign.
Official sources
- National Institute of Standards and Technology: Digital Library of Mathematical Functions: notation and algebra.
- National Aeronautics and Space Administration: Mathematics reference.
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.