What is the percent difference?
Enter two positive numbers to see how far apart they are as a percent of their average.
- Percentage difference
- 40%
The percentage difference between 20 and 30 is 40%.
- Difference
- 10
- Average
- 25
Percentage difference: 40%. The percentage difference between 20 and 30 is 40%.
How to calculate
Finds the percentage difference between two positive numbers, compared with their average, or a number from the other and the difference.
Example with the default inputs (Value A 20, Value B 30): The percentage difference between 20 and 30 is 40%.
Formula: d = |A − B| ÷ ((A + B) ÷ 2) × 100: the gap between A and B as a percent of their average.
- Both values are more than 0, so the difference is from 0% up to (but not including) 200%.
- The order of A and B does not matter.
- Finding a value from the other value and the difference gives two answers, one above and one below the other value: both are shown.
Worked examples
Each example is checked against the calculator on every build.
- Value A 20, Value B 30 gives Percentage difference 40%, Difference 10, Average 25.Source: hand calculation in content.mdx: |20 − 30| ÷ 25 × 100 = 40%
- Value A 100, Value B 125 gives Percentage difference 22.222222%, Difference 25, Average 112.5.Source: hand calculation in content.mdx: 25 ÷ 112.5 × 100 = 22.22%; Python 3: 25 / 112.5 * 100 = 22.22222222222222
- Value A 125, Value B 100 gives Percentage difference 22.222222%.Source: hand calculation in content.mdx: the same two numbers in the other order give the same difference
- Value A 20, Percentage difference 40% gives Value B 30.Source: hand calculation in content.mdx: B = 20 × 2.4 ÷ 1.6 = 30, or 20 × 1.6 ÷ 2.4 = 13.333…
- Value A 7.5, Value B 7.5 gives Percentage difference 0%, Difference 0.Source: hand calculation in content.mdx: equal values have no difference
How it works
For two positive values A and B, the percentage difference d is the gap between them as a percent of their average:
d = |A − B| ÷ ((A + B) ÷ 2) × 100
|A − B| is the size of the gap without its sign, so the order of A and B does not matter.
Fill in any two of the three and the calculator finds the third:
- Percentage difference: d = |A − B| ÷ ((A + B) ÷ 2) × 100.
- Value B from A and d: B = A × (200 + d) ÷ (200 − d) (the value above A) or B = A × (200 − d) ÷ (200 + d) (the value below A), the same as A × (2 + r) ÷ (2 − r) and A × (2 − r) ÷ (2 + r) with r = d ÷ 100. The calculator uses the form in d, which keeps its accuracy close to 200%. Both fit, so it shows both. When d = 0, both are A.
- Value A from B and d: the same two formulas with A and B swapped.
It also shows the difference |A − B| and the average (A + B) ÷ 2.
These two formulas come from the definition. If B is above A, d ÷ 100 × (A + B) ÷ 2 = B − A, so r(A + B) = 2(B − A) and B(2 − r) = A(2 + r). If B is below A, r(A + B) = 2(A − B), so B(2 + r) = A(2 − r).
Assumptions
- Both values are more than 0. The percentage difference is then at least 0% and less than 200%.
- Percentages are in percent points: type 40 for 40%.
Worked examples by hand
20 and 30. The difference is |20 − 30| = 10 and the average is (20 + 30) ÷ 2 = 25, so d = 10 ÷ 25 × 100 = 40%.
100 and 125. The difference is 25 and the average is 112.5, so d = 25 ÷ 112.5 × 100 = 22.222222%. Swapping them (125 and 100) gives the same 22.222222%.
20 and a 40% difference. r = 0.4. Above: B = 20 × 2.4 ÷ 1.6 = 30. Below: B = 20 × 1.6 ÷ 2.4 = 13.333333. Check: 20 and 13.333333 are 6.666667 apart with an average of 16.666667, and 6.666667 ÷ 16.666667 = 40%.
7.5 and 7.5. The difference is 0, so d = 0%.
Other questions people ask
How do I calculate the percentage difference?
Take the gap between the two numbers, divide it by their average, and multiply by 100: |A − B| ÷ ((A + B) ÷ 2) × 100. For 20 and 30, the gap is 10 and the average is 25, so the difference is 10 ÷ 25 × 100 = 40%.
What is the difference between percentage difference and percentage change?
A percentage change has a before and an after, and divides by the old value: 100 to 125 is +25%, but 125 to 100 is −20%. A percentage difference treats the two numbers the same way and divides by their average, so 100 and 125 are 22.22% apart in either order. Use a percentage change when one value came first.
When should I use a percentage difference?
When neither number is the reference, for example two measurements of the same thing, the prices of one item in two shops, or results from two labs. If one value is the true or expected value, use percent error; if one value came first, use percentage change.
Why can the percentage difference not reach 200%?
For two positive numbers the gap is always smaller than their sum, which is twice the average. So the difference is below 2 × 100% = 200%. It gets close to 200% only when one number is tiny next to the other.
Can I find a number from the other number and the percentage difference?
Yes, and there are two answers, one above and one below. With ratio r = difference ÷ 100, the number above is A × (2 + r) ÷ (2 − r) and the one below is A × (2 − r) ÷ (2 + r). From 20 with a 40% difference, the answers are 30 and 13.33.
Does the order of the numbers matter?
No. |A − B| is the same as |B − A|, and the average is the same either way, so swapping the numbers gives the same percentage difference.