Outlier Calculator
Of the 15 delivery times below, 41 is the only outlier and the upper fence sits at 22.75 minutes. The calculator reports IQR fences, z-scores, modified z-scores and the Grubbs test at once, and names every rule that flagged each number, so you can see which cut-off caught which point.
| Outliers found | |
| Count of numbers | |
| Mean and standard deviation | |
| Median | |
| Q1 and Q3 | |
| Interquartile range | |
| Fences, lower and upper | |
| Median absolute deviation | |
| Grubbs statistic and critical value | |
| Grubbs verdict | |
| Value | z-score | Modified z | Flagged by |
|---|
Modified z uses 0.6745 x (x minus median) / MAD, the Iglewicz and Hoaglin form. Grubbs is the two-sided test from the NIST handbook. Nothing you paste is uploaded.
Paste a list of numbers and see which ones fall outside the interquartile fences, the z-score cut-off, the modified z-score cut-off and the Grubbs test.
Key takeaways
- The IQR fences sit at Q1 minus 1.5 IQR and Q3 plus 1.5 IQR, here 8.75 and 22.75
- The same data sorted by the median of halves gives Q3 of 18 and an upper fence of 24 instead
- 41 scores a z of 3.363 against a standard deviation of 7.037, and 22 scores only 0.663
- Drop 41 and the standard deviation falls from 7.037 to 2.678, which triples the z-score of 22
- The Grubbs statistic is 3.3630 against a critical value of 2.5483 at 15 numbers
On this page
What an outlier is, and what a flag means
An outlier is a value that sits far enough from the rest of a sample to deserve a second look. The NIST/SEMATECH e-Handbook puts the reason plainly: a suspected outlier may be a recording error, in which case it should be corrected or removed, or it may be a real event that the analysis has to accommodate rather than delete.
Those are two different jobs, and the arithmetic only handles the first half of either. A test says that a number is unusual for the shape the rest of the data describes. It does not say that the number is wrong, and it cannot tell you that a delivery did take 41 minutes because a van broke down.
Every rule on this page assumes one variable measured in comparable units, and the formal tests add an assumption that the data are roughly normal. Check that first. On a strongly skewed column such as household income or file size, the upper tail is long by design, and a fence built for a bell curve will flag ordinary values all day.
IQR fences: where the 1.5 comes from
The quartile rule needs three numbers: the first quartile Q1, the third quartile Q3 and the gap between them, the interquartile range. Half the data sits inside that gap. The fences sit one and a half IQRs beyond each quartile, and anything outside is flagged.
For normal data the quartiles land at 0.6745 standard deviations either side of the mean, so the IQR is 1.349 standard deviations. Add 1.5 IQRs to the upper quartile and the fence sits 0.6745 + 1.5 x 1.349 = 2.698 standard deviations out. On a bell curve that leaves about 0.7 percent of the data outside each fence, which is why 1.5 is a flag and not a verdict. Raise the multiplier to 3 and the fence moves to 0.6745 + 4.047 = 4.72 standard deviations, roughly one point in a million, and only the extreme cases survive.
The quartile itself has more than one definition, and the choice moves the fence; OpenStax Introductory Statistics works the same fences from the box plot side. Linear interpolation, the method behind Excel QUARTILE.INC and the default in most statistics packages, places Q1 and Q3 by position in the sorted list. The median of halves method, the Tukey hinge, splits the data at the median and takes the median of each half, and the NIST box plot page draws them that way. They agree closely on large samples and can disagree by half a gap on small ones.
| Quantity | Linear interpolation | Median of halves |
|---|---|---|
| Q1 | 14.0 | 14.0 |
| Q3 | 17.5 | 18.0 |
| IQR | 3.5 | 4.0 |
| Lower fence | 8.75 | 8.0 |
| Upper fence | 22.75 | 24.0 |
| Flagged values | 41 | 41 |
Both methods flag the same point here, but 22 has 0.75 of room under the first fence and 2.0 under the second. When a value sits that close to a line, say which quartile method produced the line, because the other one may put it on the other side.
The fifteen delivery times, worked through
The sample is 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 18, 19, 22 and 41 minutes. The sum is 260, so the mean is 17.3333. The median is the eighth value, 15. Q1 is 14 and Q3 is 17.5 by linear interpolation, so the IQR is 3.5, the lower fence is 14 - 5.25 = 8.75 and the upper fence is 17.5 + 5.25 = 22.75.
Only 41 clears a fence. The 22 sits 0.75 below the upper fence, which is inside, and nothing falls below 8.75 because the smallest value is 12. Apply the stricter 3 x IQR rule instead and the fences move to 3.5 and 28: 41 is still outside, and it is the only one.
Now compare the four rules on the two candidate points. The table shows the threshold each rule applies and what it makes of 22 and 41.
| Rule | Threshold for this sample | 22 | 41 |
|---|---|---|---|
| IQR fence, 1.5 x IQR | above 22.75 | inside | outside |
| IQR fence, 3.0 x IQR | above 28.00 | inside | outside |
| Z-score | above 3.000 | 0.663, inside | 3.363, outside |
| Modified z-score | above 3.500 | 2.361, inside | 8.768, outside |
| Grubbs test at 0.05 | above 2.5483 | not the extreme point | 3.3630, outside |
Four rules, one answer, which is the comfortable case. Disagreement between them is more informative than agreement, and the next two sections show why.
Z-scores and the masking problem
A z-score is how many standard deviations a value sits from the mean: (x - mean) divided by the standard deviation. For this sample the standard deviation is 7.0373, so 41 scores 3.363 and 22 scores 0.663. A cut-off of 3 flags 41 and nothing else.
The problem is that the outlier helps set the yardstick. Those fifteen numbers have a standard deviation of 7.0373 with 41 in the sample and 2.6777 without it, a factor of 2.63. One point in fifteen nearly tripled the spread, and every other z-score shrank by the same factor. Run the sample without 41 and the mean drops to 15.6429 while 22 climbs from 0.663 to 2.374. Same 22 minutes, a different verdict.
This is what NIST calls masking: an extreme point inflates the standard deviation enough to hide the next candidate. It is also why a fixed cut-off behaves oddly at small sample sizes. With n numbers the largest possible z-score is (n - 1) divided by the square root of n, so nine numbers can never produce a z above 2.67 and a cut-off of 3 will never fire on them, no matter how odd the data look. At fifteen numbers the ceiling is 3.615, and 41 is close to it.
Treat a z-score as a scale-free distance and keep the sample size in view. A z of 3 on 15 points and a z of 3 on 15,000 points are not the same evidence.
The modified z-score that survives masking
The fix is to build the yardstick from pieces that ignore the tail. Take the median instead of the mean, and the median absolute deviation instead of the standard deviation. The MAD is the median of the distances from each value to the median, and unlike the standard deviation it barely moves when one point runs away.
For the delivery times the median is 15. The distances are 3, 2, 2, 1, 1, 0, 0, 0, 1, 1, 2, 3, 4, 7 and 26, whose median is 2. The modified z-score multiplies (x - median) by 0.6745 and divides by the MAD, the form Iglewicz and Hoaglin describe in the NIST handbook. The constant 0.6745 is the value that makes the MAD match a standard deviation on normal data.
That gives 0.6745 x 26 / 2 = 8.768 for the 41 and 0.6745 x 7 / 2 = 2.361 for the 22. The usual cut-off is 3.5, so the 41 is flagged and the 22 is not, and the margin is wide in both directions. Drop the 41 and the MAD and the median stay at 2 and 15, so the 22 does not move at all. That stability is the whole point: the score of a point is not affected by its neighbours in the tail.
One failure mode to know about. If more than half the values are identical, the MAD is zero and the score cannot be formed. A column of mostly 5s with one 9 is the classic case, and the calculator reports it rather than dividing by zero.
The Grubbs test: one outlier, stated as a probability
Grubbs turns the question into a hypothesis test. The statistic is the largest absolute deviation from the mean, divided by the standard deviation: G = max|x - mean| / s. Here that is 23.667 / 7.0373 = 3.3630, and the critical value at 15 numbers and a two-sided 0.05 level is 2.5483, so the null hypothesis of no outliers is rejected.
The critical value is not a look-up constant in the formula, it comes from the t distribution: take (n - 1) over the square root of n, multiply by the square root of t squared over (n - 2 + t squared), and use the t value at a tail probability of alpha divided by 2n with n - 2 degrees of freedom. That is the version the NIST handbook prints, and it is what this calculator evaluates, so any sample size from 3 up works without a printed table.
| Number of values | Critical G at 0.05, two-sided |
|---|---|
| 5 | 1.715 |
| 6 | 1.887 |
| 7 | 2.020 |
| 8 | 2.127 |
| 9 | 2.215 |
| 10 | 2.290 |
| 11 | 2.355 |
| 12 | 2.412 |
| 13 | 2.462 |
| 14 | 2.507 |
| 15 | 2.548 |
The worked example in the NIST handbook is eight mass spectrometer readings on a uranium isotope, 199.31 through 202.18 with a 245.57 at the end. The mean is 206.4338, the standard deviation 15.8526 and G is 2.4688 against a one-sided critical value of 2.032 at 0.05, so the 245.57 is an outlier. Judged two-sided, as this calculator does by default, the critical value is 2.1266 and the conclusion is the same. The generalized ESD page in the same handbook covers several outliers at once, and NIST notes that Grubbs tests for a single outlier and that sequential passes are the wrong tool when several are suspected; the generalized ESD test is the one to reach for there.
Deciding what to do with a flagged value
A flag is the start of a decision, not the end of one. Go back to the source first: a timestamp, a meter reading, an order number. If the record shows a typo, the value is wrong and correcting it is not optional. If the record is clean, the number is data and deleting it is a choice with consequences.
Three paths cover most cases. Keep the point and switch to median-based statistics, reporting the median and the MAD instead of the mean and the standard deviation, which is the honest route when the tail is real. Keep the point and change the model, since a count with a long tail may fit a lognormal better than a normal, and the NIST handbook notes that a log transform brings such data back to a shape the tests can handle. Or drop the point and say so in the write-up, with the rule and the threshold named, so a reader can rebuild the analysis.
What not to do is drop it quietly. The mean of the fifteen delivery times is 17.33 minutes and the mean of the fourteen that remain is 15.64, a 1.7 minute shift that would quietly change any service level quoted from the data. The standard deviation calculator and the z-score calculator cover the pieces this page builds on if you want to run them one at a time.
Report the rule with the result. Saying that one value was outside the 1.5 IQR fence is checkable by anyone with the data; saying that one value was an outlier is an opinion wearing a number's clothes.
Frequently asked questions
What counts as an outlier?
A value far from the rest of the sample. The common tests are an IQR fence at 1.5 times the interquartile range, a z-score above 3, a modified z-score above 3.5 and the Grubbs test at a stated significance level.
How do I find outliers with the IQR rule?
Sort the data, find Q1, Q3 and the gap between them, then flag anything below Q1 minus 1.5 IQR or above Q3 plus 1.5 IQR. For the 15 delivery times that puts the fences at 8.75 and 22.75.
Why 1.5 times the interquartile range?
It is a convention rather than a law. On normal data it lands 2.698 standard deviations from the mean, which flags about 0.7 percent of values in each tail, enough to catch a suspicious point without flagging ordinary variation.
Does the quartile method change the answer?
It can. Linear interpolation gives Q3 of 17.5 on this sample and the median of halves gives 18, so the upper fence moves from 22.75 to 24. Both flag the 41, but a value near the line can fall on either side.
What is a z-score outlier?
A value more than 3 standard deviations from the mean. It is simple but sensitive to the outlier itself, because one extreme point inflates the standard deviation and shrinks every other z-score.
Why did the z-score of 22 change when I removed 41?
Because the standard deviation fell from 7.0373 to 2.6777 without that one point. The z-score of 22 rises from 0.663 to 2.374 with the same value, which is the masking effect.
What is a modified z-score?
0.6745 times the distance from the median, divided by the median absolute deviation. It leans on the median and the MAD, so one extreme value does not distort the yardstick. The usual cut-off is 3.5.
Why is the constant 0.6745 in the modified z-score?
It scales the median absolute deviation so that it matches a standard deviation when the data are normal, since 0.6745 standard deviations is where the median absolute deviation of a normal distribution lands.
What does the Grubbs test tell me?
Whether the single most extreme value is further from the mean than chance would explain at a chosen significance level. It returns a statistic and a critical value; the point is an outlier when the statistic is larger.
How is the Grubbs critical value calculated?
From the t distribution: (n - 1) divided by the square root of n, times the square root of t squared over (n - 2 + t squared), with t at a tail probability of alpha divided by 2n and n - 2 degrees of freedom.
Can Grubbs find more than one outlier?
Not safely by running it repeatedly. The test is built for one outlier, and repeated passes can mask or swamp the result. The generalized ESD test or the Tietjen-Moore test is the right tool for several.
What if half my values are identical?
The median absolute deviation becomes zero and the modified z-score cannot be formed. The calculator says so instead of dividing by zero, and the IQR or Grubbs rows still work.
Can I use this on skewed data such as income?
With care. The formal tests assume approximate normality, and a long tail is normal for income data. A log transform first, then the tests, gives a saner answer than flagging every high earner.
Should I delete a flagged outlier?
Only if the record shows the value is wrong. If the measurement is clean, keep it and report median-based statistics, or state clearly which rule you applied and what was removed.
How many numbers do I need?
Four is the minimum for quartiles and six is the realistic minimum for the tests to mean anything. With nine numbers the largest possible z-score is 2.67, so a cut-off of 3 can never fire.
Spotted a wrong number or a broken result?
More Math tools
Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.