How to find outliers in data
Find outliers with the 1.5 x IQR fences or z-scores, see how outliers pull the mean and SD but not the median, and decide whether to keep or remove them.
Finding Outliers: The 1.5 x IQR Rule and the Z-Score Approach
You have a dataset of 12 final exam scores: 55, 61, 65, 67, 72, 74, 78, 81, 84, 89, 93, and 198. That 198 is a recording error, the exam was out of 100. Knowing how to find outliers means you catch the mistake before you report the class average.
Two methods flag outliers: the Tukey fences (1.5 x IQR rule) and the z-score approach. A worked example shows how each outlier shifts your summary statistics, and tells you whether to keep, fix, or remove the suspicious point.
The 1.5 x IQR Fences
The most common outlier detection method in introductory statistics is the 1.5 IQR rule, also called Tukey's box plot fences. The rule identifies any point below the lower fence or above the upper fence as an outlier.
Calculate the interquartile range (IQR) first: IQR = Q3 − Q1. Then compute the fences:
Lower fence = Q1 − 1.5 × IQR
Upper fence = Q3 + 1.5 × IQR
Data points outside these fences are flagged as outliers. The 1.5 IQR rule is a heuristic, not a formal statistical test. As OpenStax Introductory Statistics 2e (sections 2.4 and 12.x) and the NIST/SEMATECH e-Handbook (section 7.1.6) both note, it is designed for box plot construction and for flagging points that need review, not for automatic removal.
For a dataset with a sample size under 10, the fences can be unreliable because Q1 and Q3 themselves are unstable. In very small samples, consider a direct review of the data or use a method like Hampel's rule (median absolute deviation, threshold 3.5 MAD), which the NIST e-Handbook lists among its outlier tests. For larger datasets, the 1.5 IQR rule is a fast, robust screening tool.
The Z-Score Approach and When It Fits
The z-score approach measures how many standard deviations a data point is from the mean. The z-score formula is:
z = (x − mean) / standard deviation
Common thresholds for flagging an outlier are |z| > 3, |z| > 2.5, or |z| > 2. The NIST e-Handbook lists all three thresholds as common choices, with 3 being the most frequently used for normally distributed data.
The z-score method assumes the data are approximately normally distributed. If the distribution is skewed or has heavy tails, the mean and standard deviation are themselves pulled by the extreme values, making the z-score less reliable. For normally distributed data, the empirical rule says about 0.3% of points fall beyond |z| > 3, so any point beyond that is a candidate outlier.
Use the z-score approach when your data is roughly symmetric and you have a sample size large enough to estimate the population standard deviation reliably (n > 30). For smaller samples, the sample standard deviation is itself an estimate, and a single extreme value can inflate it, masking outliers. In those cases, the modified z-score method (using the median and median absolute deviation, threshold 3.5) is more robust.
Worked Example: 12 Exam Scores
Step 1: The Five-Number Summary
Dataset: 55, 61, 65, 67, 72, 74, 78, 81, 84, 89, 93, 198
Sort the data. There are 12 values, so the median is the average of the 6th and 7th values: (74 + 78) / 2 = 76.
Q1 is the median of the lower half (the first six values): (65 + 67) / 2 = 66. Q3 is the median of the upper half (the last six values): (84 + 89) / 2 = 86.5.
IQR = Q3 − Q1 = 86.5 − 66 = 20.5.
Step 2: Apply Both Methods
Lower fence = 66 − 1.5 × 20.5 = 66 − 30.75 = 35.25.
Upper fence = 86.5 + 1.5 × 20.5 = 86.5 + 30.75 = 117.25.
The only data point outside the fences is 198, which lies above the upper fence. The score of 198 is flagged as an outlier by the 1.5 IQR rule.
Now apply the z-score approach.75.1.Since |z| > 3, the z-score method also flags 198 as an outlier.
Note how the single extreme value 198 inflates the mean from around 75 to 79.75 and blows up the standard deviation. This illustrates why the z-score method is less reliable with small samples when an extreme outlier is present: the outlier contaminates the very statistics used to detect it.
How Outliers Affect Each Statistic
An outlier does not just change one number; it ripples through every summary statistic. The table below shows how the 12 exam scores change when the outlier 198 is removed.
| Statistic | With Outlier (n=12) | Without Outlier (n=11) | Change |
|---|---|---|---|
| Mean | 79.75 | 74.36 | Pulled up by 5.39 |
| Median | 76.0 | 76.0 | No change |
| Standard deviation (sample) | 38.1 | 10.7 | Inflated by 27.4 |
| IQR | 20.5 | 19.0 | Slight increase (from 67.5 to 86.5 vs 67 to 86) |
| Range | 143 (198–55) | 38 (93–55) | Massive decrease |
| Skewness | 3.1 (positive) | 0.1 (nearly symmetric) | Drops from substantial to negligible |
Keep, Fix or Remove?
An outlier is flagged for review, not for automatic deletion. The three options are: keep it as a legitimate extreme value, fix it if it is an error, or remove it if it is an error and cannot be corrected.
In the exam score example, 198 is an error, the exam is out of 100. Fix it by correcting the grade if you have the true score, or remove the data point entirely if the true value is lost. Removing it changes the mean from 79.75 to 74.36, a practically meaningful difference for grade averages.
If the outlier is a legitimate value, for example, a CEO's salary in a dataset of employee salaries, keep it. Removing it would misrepresent the distribution, which is right-skewed by nature. In that case, report the median and IQR instead of the mean and standard deviation, because those robust statistics are not pulled by the legitimate outlier.
The 1.5 IQR rule flags points for investigation, not for ejection. OpenStax and the NIST e-Handbook both state this clearly. The question is not whether the point is outside the fence, but whether it represents a real observation from the population you are studying.
Frequently Asked Questions
What is the 1.5 IQR rule?
The 1.5 IQR rule defines outliers as any data point below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. It is a heuristic from John Tukey for box plot construction, not a formal statistical test. It flags points for review.
What is the outlier formula for the z-score method?
The z-score formula is z = (x − mean) / standard deviation. A common threshold for flagging an outlier is |z| > 3, though thresholds of 2.5 or 2 are also used.
What are the upper and lower fences?
The lower fence is Q1 − 1.5 × IQR and the upper fence is Q3 + 1.5 × IQR. Points below the lower fence or above the upper fence are considered outliers by the 1.5 IQR rule.
When should I use the z-score approach instead of the 1.5 IQR rule?
Use the z-score approach when your data is approximately normally distributed and your sample size is larger than 30. For smaller or skewed datasets, the 1.5 IQR rule or the modified z-score method is more robust.
Should I remove an outlier once I find it?
No. An outlier is flagged for investigation. Keep it if it is a legitimate extreme value. Fix it if it is a recording error and you have the correct value. Remove it only if it is an error and the true value cannot be recovered.