The interquartile range (IQR) is the width of the middle half of a data set, from the first quartile (Q1, the value below which 25% of the data fall) to the third (Q3, the value below which 75% fall). Because it ignores the extremes, it is a robust measure of spread. John Tukey used it to define a simple rule for spotting outliers: values too far outside the middle half are flagged. This calculator takes your quartiles and your smallest and largest values and checks whether either lies beyond the fences.
How the calculation works
- IQR = Q3 − Q1
- Lower fence = Q1 − 1.5 × IQR, and upper fence = Q3 + 1.5 × IQR
- Extreme fences = Q1 − 3 × IQR and Q3 + 3 × IQR
- A value outside the fences is a mild outlier; outside the extreme fences, an extreme outlier.
- Quartile coefficient of dispersion = (Q3 − Q1) ÷ (Q3 + Q1)
Example
With Q1 = 12 and Q3 = 20, the IQR is 8. The fences are 12 − 12 = 0 and 20 + 12 = 32, and the extreme fences are −12 and 44. The smallest value, 4, is inside the fences. The largest, 41, is above 32 but below 44, so it is a mild outlier.
Why use fences
The mean and standard deviation are pulled by outliers, while quartiles are not, which makes the IQR rule reliable even when the data contain the very values you are looking for. The rule works well for roughly symmetric data. For skewed data, such as incomes or response times, many ordinary values may be flagged, so look at the shape of the distribution before deciding.
What to do with outliers
First check for mistakes: a misplaced decimal, a wrong unit or a sensor fault. If the value is real, keep it but consider reporting results with and without it, or use measures that resist outliers, such as the median. Remove a value only with a clear reason that you can state in your report.