... LIVE
Please enter a valid number.
Please enter a valid number.
Absolute Difference |A − B|
Step-by-Step Working

Sources & Methodology

Formula verified against standard mathematics curriculum references (Khan Academy, NCTM) and IEEE absolute value definitions.
📖
Khan Academy — Absolute Value
Definition and properties of absolute value and absolute difference, used as curriculum reference for step-by-step output
🏛
National Council of Teachers of Mathematics (NCTM)
Mathematical standards for absolute value operations used to verify formula and notation
Formula: Absolute Difference = |A − B| = max(A,B) − min(A,B). Percentage difference = (|A − B| / ((|A| + |B|) / 2)) × 100 when neither value is zero. Percentage change from A to B = ((B − A) / |A|) × 100.

⏱ Last reviewed: April 2026

How to Calculate Absolute Difference

The absolute difference between two numbers is the non-negative distance between them. It answers the question: "how far apart are these two values?" without caring which one is larger. This makes it extremely useful in error analysis, statistics, quality control, and any comparison where direction doesn't matter — only magnitude does.

The Formula
|A − B| = |B − A| = max(A,B) − min(A,B)
Subtract the numbers in any order, then take the absolute value (remove any negative sign).

Examples:
|15 − 7| = |8| = 8
|7 − 15| = |−8| = 8 (same answer)
|−5 − 3| = |−8| = 8
|3.7 − 5.2| = |−1.5| = 1.5

Absolute Difference vs Percentage Difference

Absolute difference gives the raw gap in the same units as the original numbers. Percentage difference expresses how large the gap is relative to the average of the two values. Both are useful — absolute difference for direct comparisons, percentage difference for relative comparisons.

Percentage Difference = (|A − B| / ((A + B) / 2)) × 100
Example: A = 80, B = 100
Absolute difference = |80 − 100| = 20
Average = (80 + 100) / 2 = 90
Percentage difference = (20 / 90) × 100 = 22.2%

Common Absolute Difference Examples

AB|A − B|% DifferenceUse case
100752528.57%Score comparison
726845.71%Temperature change
-538250%Number line distance
1,20098022020.18%Price comparison
3.143.141590.001590.051%Pi approximation error
0-1010Distance from zero

Absolute Difference in Statistics (MAE and MAD)

Absolute differences are the building block of two important statistical measures. Mean Absolute Error (MAE) averages the absolute differences between predicted values and actual values — commonly used to evaluate forecast accuracy. Mean Absolute Deviation (MAD) averages the absolute differences between each data point and the dataset mean — a measure of data spread that is less sensitive to outliers than standard deviation.

💡 Key property: The absolute difference is always symmetric: |A − B| = |B − A|. This means the order of the two numbers never affects the result. It always equals the larger value minus the smaller value.
Frequently Asked Questions
The absolute difference between two numbers A and B is the non-negative distance between them, written |A − B|. It equals |B − A| — the order doesn't matter. Example: |3 − 8| = |−5| = 5. The result is always zero or positive, never negative.
The formula is |A − B| = |B − A| = max(A,B) − min(A,B). Subtract the two numbers in either order, then apply the absolute value function (remove any negative sign). The simplest approach is always to subtract the smaller from the larger.
The absolute difference between 7 and 12 is |7 − 12| = |−5| = 5. Equivalently, |12 − 7| = |5| = 5. The answer is the same either way: 5. This represents the distance between 7 and 12 on the number line.
Regular difference A − B can be negative (e.g., 3 − 8 = −5). Absolute difference |A − B| is always non-negative (|3 − 8| = 5). Use regular difference when direction matters (e.g., profit/loss). Use absolute difference when only the magnitude of the gap matters.
The absolute difference between −5 and 3 is |−5 − 3| = |−8| = 8. Or |3 − (−5)| = |3 + 5| = |8| = 8. Both give the same answer: 8. This is the distance from −5 to 3 on the number line (5 units to reach 0, then 3 more = 8 total).
No. The absolute difference is always zero or positive. The absolute value function always returns a non-negative result. The minimum is 0, which only occurs when A = B (the two numbers are equal and the distance between them is zero).
Absolute difference is the raw gap: |A − B|. Percentage difference is the gap relative to the average: (|A − B| / ((A+B)/2)) × 100. Example: A=80, B=100 gives absolute difference 20 and percentage difference (20/90) × 100 = 22.2%. Use percentage difference for relative comparisons.
The same formula applies: |A − B|. Example: |3.7 − 5.2| = |−1.5| = 1.5. Or |−2.4 − (−1.1)| = |−2.4 + 1.1| = |−1.3| = 1.3. Subtract in any order and take the absolute value. The process is identical to integers.
Absolute difference is used in price comparisons, temperature change, forecast error (MAE), manufacturing tolerances, statistical deviation (MAD), sports score comparisons, and any measurement where you need the gap between two values without caring about sign or direction.
The absolute difference between 100 and 75 is |100 − 75| = |25| = 25. The percentage difference is (25 / 87.5) × 100 = 28.57%. The percentage change from 100 to 75 is −25% (decrease).
In statistics, absolute differences power Mean Absolute Error (MAE) — the average of |predicted − actual| over all data points — and Mean Absolute Deviation (MAD) — the average of |value − mean|. Both are preferred when you want to avoid over-weighting outliers compared to squared-error methods.
Not exactly. Absolute value |x| applies to a single number. Absolute difference |A − B| applies to two numbers — it subtracts them first, then applies absolute value. Absolute difference uses absolute value as part of its formula, but the two terms are not interchangeable.
The absolute difference between 0 and −10 is |0 − (−10)| = |0 + 10| = |10| = 10. Or |−10 − 0| = |−10| = 10. The absolute difference is 10, which is the distance from −10 to 0 on the number line.
Related Calculators
Popular Calculators
🧮

Missing a Math Calculator?

Can’t find the math calculator you need? Tell us — we build new ones every week.