A step-by-step guide to the IQR, with a worked example
Quick answer: The interquartile range is IQR = Q3 − Q1. Sort your data, find the first quartile (Q1, the 25th percentile) and the third quartile (Q3, the 75th percentile), then subtract Q1 from Q3. The result is the spread of the middle 50% of the data.
The interquartile range measures spread using only the central half of a data set, so it ignores the smallest and largest quarter of the values. That makes it far more resistant to outliers than the full range or the standard deviation, and it is the basis for the standard rule used to flag outliers on a box plot.
Data: 3, 7, 8, 5, 12, 14, 21, 13, 18
1. Sort it: 3, 5, 7, 8, 12, 13, 14, 18, 21 (n = 9).
2. The median is the 5th value: 12.
3. Lower half (values below the median): 3, 5, 7, 8 → Q1 = (5 + 7) ÷ 2 = 6.
4. Upper half (values above the median): 13, 14, 18, 21 → Q3 = (14 + 18) ÷ 2 = 16.
5. IQR = Q3 − Q1 = 16 − 6 = 10.
When the data set has an odd number of values, textbooks disagree on whether to include the median in each half. The example above uses the Tukey method, which excludes it. The Moore & McCabe method includes the median in both halves, and Excel’s QUARTILE.INC uses linear interpolation instead. These can give slightly different quartiles, so use the method your course expects — the IQR calculator lets you switch between all three.
Once you have the IQR, the standard outlier check is the 1.5 × IQR rule: any value below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR is a potential outlier. In the example, those fences are 6 − 15 = −9 and 16 + 15 = 31, so none of the values qualify.
It is the range of the middle 50% of your data — the distance between the 25th percentile (Q1) and the 75th percentile (Q3).
The full range depends on the two most extreme values, so a single outlier can distort it. The IQR ignores the outer quarters, making it more robust.
Yes. If at least half the values are identical so that Q1 equals Q3, the IQR is zero.