How to Find Outliers Using IQR
To find outliers using the IQR, sort the data, find the first quartile (Q1) and the third quartile (Q3), then subtract: IQR = Q3 − Q1. Build the fences Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. Any value outside the fences is a potential outlier — flag it and investigate it, but do not delete it.
This guide shows you how to find outliers using the IQR method step by step, with three fully worked examples in which every number has been checked on the free Quartile Calculator. You will also see why different calculators give slightly different quartiles, why the IQR method beats z-scores on skewed data, and exactly what to do after a value is flagged.
What Is an Outlier?
An outlier is a value that sits unusually far from the rest of your data — far enough to look as though it came from a different process, a different population, or a plain mistake. A daily sale of £5,000 in a shop that usually takes £200–£400 is an outlier. So is a test score of 12 in a class where everyone else scored between 60 and 95.
Being flagged is not the same as being wrong. An outlier is a potential outlier: a value worth a closer look. It might be a typing error, a unit mix-up (centimetres entered as inches), or a genuine but rare event (that £5,000 sale really did happen). The IQR method tells you which values to investigate. It does not tell you which values to delete — that decision comes later.
Outliers matter because they distort the summaries you actually use. One extreme value can drag the mean a long way and inflate the standard deviation, which then makes every other value look ordinary. That is the masking problem, and it is the main reason a method that never uses the mean or the standard deviation — the IQR method — is such a useful first check.
The IQR Method in 4 Steps
The IQR method, also called Tukey’s fences, takes four steps. You need nothing more than the sorted data and a calculator — no assumption about the shape of the distribution, and no standard deviation at all.
Step 1: Sort the data
Put the values in ascending order, smallest first. The IQR method only cares about the order of the values, not their size — which is exactly why one enormous value cannot drag the fences around.
Step 2: Find Q1 and Q3
Q1, the first quartile, is the value one quarter of the way through the sorted data: 25% of the values sit below it. Q3, the third quartile, is the value three quarters of the way through: 75% of the values sit below it. The middle half of your data lives between Q1 and Q3. (Quartiles can be computed in more than one way — see Why Do Quartile Methods Disagree? below — but the step itself is the same.)
Step 3: Find the IQR
Subtract: IQR = Q3 − Q1. The IQR — the interquartile range — is the width of the middle half of the data, a measure of spread that ignores the tails entirely.
Step 4: Build the fences and flag what falls outside
Lower fence = Q1 − 1.5 × IQR. Upper fence = Q3 + 1.5 × IQR. Any value below the lower fence or above the upper fence is a potential outlier. Values that stay inside the fences are not outliers, whatever they look like at first glance.
The Fences, Plainly
The whole method is two formulas:
- Lower fence = Q1 − 1.5 × IQR
- Upper fence = Q3 + 1.5 × IQR
Anything below the lower fence or above the upper fence is a potential outlier. Anything between the fences is not.
Why 1.5? The multiplier is a convention, not a law of nature. John Tukey introduced it in Exploratory Data Analysis (1977) because fences at 1.5 × IQR keep the false-alarm rate low without hiding real outliers: for perfectly normal data, the inner fences flag only about 0.7% of values — roughly 7 in every 1,000. A smaller multiplier would cry wolf constantly; a larger one would let genuine outliers slip through.
The fences are built from quartiles, so they inherit the quartiles’ toughness. Q1 and Q3 are positions in the sorted data: moving the largest value from 21 to 21,000 changes Q1 and Q3 not at all, so the fences do not move either. That is the whole advantage of the IQR method over the z-score rule, which we come back to in the section on the masking problem. For the authoritative reference, the NIST/SEMATECH e-Handbook of Statistical Methods gives the same inner- and outer-fence definitions used here.
Mild vs Extreme Outliers
The IQR method has two levels of flag, not one. The inner fences, at 1.5 × IQR, mark mild outliers: values that are unusual but not far outside the bulk of the data. The far fences, at 3 × IQR, mark extreme outliers: values that sit far beyond even the mild ones.
Two formulas, then:
- Inner fences (mild): Q1 − 1.5 × IQR and Q3 + 1.5 × IQR
- Far fences (extreme): Q1 − 3 × IQR and Q3 + 3 × IQR
A value between the inner and far fences is a mild (or “outside”) outlier. A value beyond a far fence is an extreme (or “far out”) outlier. A value beyond an inner fence is always an outlier of some kind; one beyond a far fence is an outlier of the serious kind.
This is also how a box plot works. The box spans Q1 to Q3, a line marks the median, and the whiskers stretch to the most extreme values that still sit inside the inner fences. Everything beyond the whiskers is drawn as a dot — a mild outlier as a small dot, an extreme outlier usually as a larger or differently shaped one. The plot and the fences are the same rule, drawn.
Worked Example 1: No Outliers
Start with a dataset that has no outliers at all. Nine values, in the order they were recorded: 3, 7, 8, 5, 12, 14, 21, 13, 18. Step 1 is to sort them: 3, 5, 7, 8, 12, 13, 14, 18, 21. The median is 12.
Now work out the quartiles three ways, as the Quartile Calculator does — run this dataset through the Quartile Calculator and compare each line:
Tukey’s hinges count the median in both halves, so the lower half is 3, 5, 7, 8, 12 and the upper half is 12, 13, 14, 18, 21. The exclusive method leaves the median out of both halves (3, 5, 7, 8 and 13, 14, 18, 21). The linear method interpolates to the exact quartile positions instead of taking a median of halves. The results:
| Method | Q1 | Q3 | IQR | Inner fences | Outliers |
|---|---|---|---|---|---|
| Tukey | 7 | 14 | 7 | −3.5 to 24.5 | None |
| Exclusive | 6 | 16 | 10 | −9 to 31 | None |
| Linear | 7 | 14 | 7 | −3.5 to 24.5 | None |
All three methods agree: there are no outliers. Every value from 3 to 21 sits comfortably inside even the narrowest fences (−3.5 to 24.5), and the method with the widest fences stretches −9 to 31. The quartiles differ between methods — Q1 is 7 by Tukey and linear, but 6 by the exclusive method — yet the verdict does not change. That is the normal outcome for ordinary data.
Worked Example 2: One Extreme Outlier
Now add a single extreme value and watch the method work. The dataset is 1, 2, 3, 4, 5, 6, 7, 8, 9, 100 — already sorted. The median is 5.5, halfway between 5 and 6.
Using Tukey’s hinges: the lower half is 1, 2, 3, 4, 5, so Q1 = 3; the upper half is 6, 7, 8, 9, 100, so Q3 = 8. IQR = 8 − 3 = 5. The inner fences are 3 − 1.5 × 5 = −4.5 and 8 + 1.5 × 5 = 15.5. The value 100 sits above 15.5 — it is an outlier.
Is it a mild or an extreme outlier? The far fences are 3 − 3 × 5 = −12 and 8 + 3 × 5 = 23. The value 100 is above 23 as well, so it is an extreme outlier, not just a mild one.
Notice what the 100 did not do: it did not move the fences. Q1, Q3 and the IQR come from the ordered middle of the data — the 100 could be 1,000 and the fences would be identical; only the flagged value would be further outside. Try the same numbers in the Quartile Calculator and check: the calculator flags 100 as an extreme outlier under every method it shows.
Worked Example 3: Small Dataset
Now a short dataset of eight values: 1, 2, 3, 4, 5, 6, 7, 8. Small samples are where the quartile methods show their disagreements most clearly — and where the verdict matters more than the exact quartiles.
Tukey’s method and the exclusive method agree here. The median is 4.5, the lower half is 1, 2, 3, 4, so Q1 = 2.5; the upper half is 5, 6, 7, 8, so Q3 = 6.5. IQR = 6.5 − 2.5 = 4. The inner fences are 2.5 − 1.5 × 4 = −3.5 and 6.5 + 1.5 × 4 = 12.5. Nothing in 1–8 comes close to either fence. No outliers.
The linear method gives slightly different quartiles — Q1 = 2.75, Q3 = 6.25, IQR = 3.5 — and fences of −2.5 and 11.5. Still no outliers: the verdict is the same, and every value is well inside the fences on either calculation. Check the figures in the Quartile Calculator to see all three methods side by side.
The lesson: with eight values the quartiles can differ by a quarter of a point between methods, but the verdict does not change. Do not let a small difference in Q1 or Q3 worry you — and do be careful about flagging outliers from very small samples at all, since the fences sit far outside the data almost by definition.
Why Do Quartile Methods Disagree?
There are at least nine accepted ways to compute a quartile. Every one of them sorts the data first; they differ in how they handle the values around the quartile position when it falls between two values. That is why a textbook and a spreadsheet can give different Q1 values for the same dataset — and both can be right under different definitions.
The three methods this site’s Quartile Calculator shows are the ones you will meet most often:
- Tukey’s hinges: the median of the lower half and the median of the upper half, with the overall median counted in both halves when the count is odd. This is the method the 1.5×IQR rule itself was defined against.
- Exclusive method: like Tukey’s, but the overall median is left out of both halves (this is Excel’s QUARTILE.EXC in spirit, and the method Moore and McCabe’s textbook uses).
- Linear method: treats the sorted data as points on a line and interpolates to the exact quartile position — Excel’s QUARTILE.INC, and NumPy’s default.
The practical advice is simple: pick one method, state it, and use it consistently for the whole calculation. If you are writing up results, name the method — “quartiles by the linear (QUARTILE.INC) method” — so a reader can reproduce your fences exactly. The Quartile Calculator shows all three methods side by side for exactly this reason.
IQR vs Z-Scores: The Masking Problem
Here is the dataset: 10, 11, 12, 12, 13, 14, 15, 15, 15, 16, 90, 95. Twelve values, and two of them — 90 and 95 — sit far above the rest. Work the IQR method on it, using the linear quartile method so the calculation can be reproduced exactly (the linear method is Excel’s QUARTILE.INC and NumPy’s default).
The data are already sorted. Q1 = 12, Q3 = 15.25, so IQR = 15.25 − 12 = 3.25. The inner fences are 12 − 1.5 × 3.25 = 7.125 and 15.25 + 1.5 × 3.25 = 20.125. Both 90 and 95 sit above 20.125. The far fences are 12 − 3 × 3.25 = 2.25 and 15.25 + 3 × 3.25 = 25.00. Both 90 and 95 sit above 25.00 too — both are extreme outliers.
Now try the z-score rule on the same data — the rule that flags values with |z| > 3. The mean is 26.50 and the sample standard deviation is 30.90, both dragged far up by the two large values. The z-score of 95 is (95 − 26.50) / 30.90 ≈ 2.22, and of 90 it is (90 − 26.50) / 30.90 ≈ 2.05. Neither reaches 3, so the z-score rule flags nothing. That is the masking problem in one line: the outliers inflate the very mean and standard deviation they are measured against, and so they hide themselves.
Why does the IQR method survive? Quartiles are positions in the sorted data: adding 90 and 95 to the end of the list barely moves Q1 and Q3, so the fences barely move. (On the calculator’s default Tukey method, Q1 = 12 and Q3 = 15.5, and the far fence is 26 — 90 and 95 are extreme outliers there too.) The z-score rule, by contrast, starts with the mean and standard deviation, two summaries that extreme values drag around. Use z-scores when your data are roughly normal and you trust the mean; use the IQR method when you do not. The Standard Deviation Calculator works out the mean, and both the population and sample standard deviations, from your own data.
IQR vs the Empirical Rule
The empirical rule and the IQR method are both ways to flag outliers, and they answer slightly different questions. The empirical rule works in standard deviations: flag anything beyond ±2σ as a mild outlier and anything beyond ±3σ as an extreme one, and it only makes sense when the data are approximately normal. The IQR method works in positions: it asks where a value sits in the sorted order, and it makes no assumption about the shape of the data.
The two rules also flag at very different rates. For perfectly normal data, the IQR inner fences flag roughly 0.7% of values, while the empirical rule’s ±2σ band flags 4.28%. The IQR rule is the stricter flagger — it catches less, and it is the more conservative of the two — which is why it is the safer default when you do not know the distribution.
Our companion guide works the empirical rule through on a real dataset: test scores with a mean of 86 and a standard deviation of 13.77, where the ±2σ range is 58.46–113.54 and the score of 120 is flagged as a mild outlier, while at ±3σ (44.69–127.31) nothing is flagged. See how to identify outliers using the empirical rule for the full worked example.
Rule of thumb: if you know the data are roughly normal, use the empirical rule and its ±2σ/±3σ cut-offs; if you do not know — or the data are skewed — use the IQR method. If both methods flag the same value, you can be confident it is worth investigating.
What to Do After You Flag an Outlier
Investigate it. Never let software delete values for you without a reason, and never delete a flagged value silently. The usual steps, in order:
- Check for a data-entry error. Was a decimal point missed (12 entered as 120)? Were the units wrong (kilograms entered as grams)? If it is an error, correct it and record the correction.
- Check whether it could be real. Look at the surrounding context: the same person, sensor or shop on neighbouring days, the original record, or a second measurement. A genuine extreme is still data.
- Decide, and say what you decided. The honest options are: correct it if it is an error; keep it and report your results with and without it (a sensitivity analysis); or winsorise it — pull it back to the nearest fence value — and say so plainly. What you must not do is delete it, say nothing, and report the cleaned data as if it were the whole dataset.
Common Mistakes
- Deleting every flagged value. A flagged value is a suspect, not a mistake. Delete only after you find an error — and record the deletion.
- Using the fences on tiny samples. With four or five values, the fences sit so far out that nothing can be flagged; with eight, the same is nearly true. The IQR method needs enough values for the quartiles to mean something.
- Mixing quartile methods mid-calculation. If Q1 comes from Tukey and Q3 from the linear method, the IQR is meaningless. Pick one method and use it for both quartiles.
- Treating “outside the fence” as “wrong data”. The fence is a screening threshold. A value outside it is a candidate for investigation, not a verdict.
- Using the z-score rule on skewed data. On skewed data the mean and standard deviation are already misleading, so z-scores built from them are too. Use the IQR method there.
What is the 1.5×IQR rule?
The 1.5×IQR rule says a value is a potential outlier when it lies more than 1.5 interquartile ranges below the first quartile (Q1) or above the third quartile (Q3). Lower fence = Q1 − 1.5 × IQR; upper fence = Q3 + 1.5 × IQR. Anything outside the fences gets flagged; anything inside does not. The 1.5 is Tukey’s convention from 1977, chosen because it flags only about 0.7% of perfectly normal data.
What is the difference between a mild and an extreme outlier?
A mild outlier sits between the inner fences (1.5 × IQR from the quartiles) and the far fences (3 × IQR from the quartiles). An extreme outlier sits beyond a far fence — more than 3 × IQR from Q1 or Q3. In a box plot, mild outliers are the dots just past the whisker; extreme outliers are the dots a long way past it. Mild outliers deserve a check; extreme outliers deserve a serious investigation.
Why do different calculators give different quartiles?
Because there are at least nine accepted ways to compute a quartile, and calculators choose different ones. Tukey’s hinges take the median of each half; the exclusive method leaves the overall median out of the halves; the linear method (Excel’s QUARTILE.INC) interpolates between values. The quartiles can differ by a small amount — a quarter of a point in the small-dataset example above — but the verdict (outlier or not) usually does not change.
FAQs
How do I find outliers using the IQR method?
Sort your data from smallest to largest, find the first quartile (Q1) and the third quartile (Q3), and subtract: IQR = Q3 − Q1. Then build the fences — the lower fence is Q1 − 1.5 × IQR and the upper fence is Q3 + 1.5 × IQR. Any value below the lower fence or above the upper fence is a potential outlier. The free Quartile Calculator does the whole calculation and shows all three quartile methods side by side.
How do I calculate the IQR?
Sort your data, find Q1 (the value one quarter of the way through) and Q3 (the value three quarters of the way through), then subtract: IQR = Q3 − Q1. The IQR is the width of the middle half of your data.
How do you calculate Q1 and Q3?
Sort the data, then find the values one quarter and three quarters of the way through it. There are several accepted ways to do this — Tukey’s hinges, the exclusive method and the linear method can give slightly different quartiles — so name the method you used. The Quartile Calculator shows all three methods side by side.
How do I find outliers with a box plot?
Draw the box from Q1 to Q3 with a line at the median, and draw the whiskers to the most extreme values that still fall inside the inner fences (Q1 − 1.5 × IQR and Q3 + 1.5 × IQR). Any value beyond a whisker is plotted as a dot — that dot is an outlier. Values beyond the far fences (3 × IQR) are often plotted with a different symbol.
Can outliers be valid data?
Yes. A flagged value can be a genuine rare event — a record measurement, a true extreme, or a legitimate value from a skewed distribution. Investigate it first, and only delete it if you find an actual error.
Is the IQR method better than using z-scores?
For skewed data, or data that already contains extreme values, yes: quartiles are not dragged around by the values they measure, while the mean and standard deviation are — so z-scores can miss (mask) the very outliers they are meant to find. For roughly normal data with no extreme values, both methods work well.
Should I remove outliers from my dataset?
Not automatically. Investigate first: correct genuine errors, keep genuine values, and say what you did. Ideally, report your results with and without the flagged values — a sensitivity analysis — so readers can see how much the outliers matter. Never delete a flagged value silently.
When should I not use the IQR method?
On very small samples — with four or five values the fences sit so far out that nothing can be flagged — and when you need a formal statistical test for a specific distribution. For roughly normal data with a known mean and standard deviation, the empirical-rule approach may be more informative.
Conclusion
The IQR method gives you a fast way to find outliers without assuming your data are normal: sort the data, find Q1 and Q3, and flag anything outside the fences at Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. The worked examples above show the method at work — a dataset with no outliers at all, a single value of 100 that is an extreme outlier, and a small dataset where the three quartile methods disagree slightly but reach the same verdict. Remember that a flagged value is a suspect, not a mistake: investigate it before you decide anything. When you know your data are roughly normal, the empirical-rule approach is a useful alternative. Try it on your own data with the Quartile Calculator, and browse all our statistical tools for other calculations.
Quartile Calculator
Find Q1, Q3 and the IQR, and get the 1.5×IQR and 3×IQR fences for any dataset, with a box plot.
ToolsTry Calculator →● LiveEmpirical Rule Outlier Detector
Flag outliers with the ±2σ and ±3σ rules — the empirical-rule view of the same question.
ToolsTry Calculator →● LiveOutlier Threshold Calculator
Work out the μ ± kσ limits for any mean and standard deviation.
ToolsTry Calculator →● LiveStandard Deviation Calculator
Mean, variance and standard deviation from your own data, ready for a z-score check.
ToolsTry Calculator →