# What is the percent difference?

Finds the percentage difference between two positive numbers, compared with their average, or a number from the other and the difference.

- Page: https://www.acalculator.org/math/percentage-difference-calculator
- JSON spec: https://www.acalculator.org/math/percentage-difference-calculator.json
- Version: 5adba1d752b3

## Default answer

Example with the default inputs (Value A 20, Value B 30): The percentage difference between 20 and 30 is 40%.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| a | Value A | The first value, more than 0. |
| b | Value B | The second value, more than 0. |
| diff | Percentage difference | The gap between A and B as a percent of their average: 0 up to (but not including) 200. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| a | Value A | The first value, more than 0. |
| b | Value B | The second value, more than 0. |
| diff | Percentage difference | The gap between A and B as a percent of their average: 0 up to (but not including) 200. |
| difference | Difference | The gap between the two values: \|A − B\|. |
| average | Average | The mean of the two values: (A + B) ÷ 2. |

## Method

d = |A − B| ÷ ((A + B) ÷ 2) × 100: the gap between A and B as a percent of their average.

## Assumptions

- 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

1. a = 20, b = 30 gives diff = 40%, difference = 10, average = 25. Source: hand calculation in content.mdx: |20 − 30| ÷ 25 × 100 = 40%.
2. a = 100, b = 125 gives diff = 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.
3. a = 125, b = 100 gives diff = 22.222222%. Source: hand calculation in content.mdx: the same two numbers in the other order give the same difference.
4. a = 20, diff = 40% gives b = 30. Source: hand calculation in content.mdx: B = 20 × 2.4 ÷ 1.6 = 30, or 20 × 1.6 ÷ 2.4 = 13.333….
5. a = 7.5, b = 7.5 gives diff = 0%, difference = 0. Source: hand calculation in content.mdx: equal values have no difference.

## FAQ

### 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.

## Sources

- Wikipedia, Relative change (the percentage difference measured against the arithmetic mean of the two values): https://en.wikipedia.org/wiki/Relative_change
