The IQR rule is a method for identifying outliers in a dataset using the interquartile range, or IQR. It works by building “fences” around your data: any value that falls more than 1.5 times the IQR below the first quartile (Q1) or above the third quartile (Q3) is flagged as an outlier. To use it, you first need to understand what the IQR is and how to calculate it.
How to Calculate the IQR
The interquartile range describes the middle 50% of values in a dataset. To find it, follow these steps:
- Sort your data from smallest to largest.
- Find the median of the entire dataset (the middle value).
- Find Q1 by taking the median of the lower half of the data (everything below the overall median).
- Find Q3 by taking the median of the upper half of the data (everything above the overall median).
- Subtract: IQR = Q3 − Q1.
If your dataset has an odd number of values, the overall median is a single number sitting right in the middle. When you split the data into halves to find Q1 and Q3, you exclude that median from both halves. If a half itself has an even count, average its two middle numbers to get the quartile value.
A Quick Example
Say you have test scores: 65, 70, 72, 75, 78, 82, 85, 88, 92. That’s nine values, so the median is 78 (the fifth number). The lower half is 65, 70, 72, 75, giving Q1 = (70 + 72) / 2 = 71. The upper half is 82, 85, 88, 92, giving Q3 = (85 + 88) / 2 = 86.5. The IQR is 86.5 − 71 = 15.5.
The 1.5 × IQR Rule for Outliers
This is the part most people are searching for. Once you have Q1, Q3, and the IQR, you build two boundaries called “fences”:
- Lower fence: Q1 − 1.5 × IQR
- Upper fence: Q3 + 1.5 × IQR
Any data point that falls below the lower fence or above the upper fence is considered an outlier. Using the test score example above: the lower fence would be 71 − 1.5(15.5) = 47.75, and the upper fence would be 86.5 + 1.5(15.5) = 109.75. Every score in the dataset falls within those boundaries, so there are no outliers.
Now imagine a student scored 40 on that same test. Since 40 is below the lower fence of 47.75, it would be flagged as an outlier. The same would happen if someone scored 115, since that exceeds the upper fence.
To see this in action with simpler numbers: if Q1 = 80 and Q3 = 90, the IQR is 10. Multiplying by 1.5 gives 15. The lower fence is 80 − 15 = 65, and the upper fence is 90 + 15 = 105. Anything below 65 or above 105 is an outlier.
Mild vs. Extreme Outliers
The 1.5 multiplier catches what statisticians call mild outliers. There’s a stricter version that uses 3 × IQR to identify extreme outliers, which are values so far from the rest of the data that they almost certainly represent errors or truly unusual cases.
- Mild outlier: falls beyond Q1 − 1.5 × IQR or Q3 + 1.5 × IQR
- Extreme outlier: falls beyond Q1 − 3 × IQR or Q3 + 3 × IQR
The boundaries at 1.5 × IQR are called inner fences, and the boundaries at 3 × IQR are called outer fences. In the test score example (IQR = 15.5), a score of 40 would be a mild outlier, while a score of, say, negative 5 would be an extreme outlier. In a perfectly normal distribution, roughly 99.3% of all data points fall within the inner fences, meaning only about 0.7% of values get flagged as mild outliers.
How Box Plots Use the IQR Rule
If you’ve seen a box-and-whisker plot, you’ve already seen the IQR rule at work. The “box” in a box plot spans from Q1 to Q3, so its width represents the IQR. The “whiskers” extend outward from the box, but they don’t just stretch to the minimum and maximum values in the dataset. Instead, each whisker reaches to the farthest data point that is not an outlier, meaning the farthest value still within the 1.5 × IQR fence.
Any values beyond the whiskers are plotted as individual dots. This makes outliers visually obvious. If you see scattered dots sitting apart from the main plot, those are the data points the 1.5 × IQR rule flagged.
Why the IQR Rule Works Well
The biggest advantage of the IQR rule is that it’s resistant to the very outliers it’s trying to detect. Methods that rely on the mean and standard deviation can be thrown off by extreme values, because those extreme values inflate the average and the spread. The IQR, by contrast, only looks at the middle 50% of the data, so a handful of wild values at the edges won’t distort the fences.
This makes the IQR rule especially useful for skewed data or datasets where you suspect errors. It’s commonly used in data cleaning before running further analysis: calculate the fences, flag anything outside them, then investigate whether those flagged points are genuine measurements or mistakes. The rule doesn’t automatically tell you to delete outliers. It tells you which values deserve a closer look.

