Outlier Formula - IQR Fences, Z-Scores, Examples

#Formula
TL;DR
The outlier formula flags any value below Q1−1.5×IQRQ_1 - 1.5 \times \text{IQR} or above Q3+1.5×IQRQ_3 + 1.5 \times \text{IQR}. This article covers both rules, five examples, and their limits.
BT
Bhanzu TeamLast updated on November 4, 20268 min read

Key Points

  • The standard outlier formula sets fences at Q1−1.5×IQRQ_1 - 1.5 \times \text{IQR} and Q3+1.5×IQRQ_3 + 1.5 \times \text{IQR}, and flags any value beyond them.

  • The NIST e-Handbook of Statistical Methods calls these inner fences, places outer fences at three times the IQR, and labels points beyond them mild and extreme outliers respectively.

  • A second approach uses the Z-score Zi=xi−xˉsZ_i = \frac{x_i - \bar{x}}{s}, measuring how many standard deviations a value sits from the mean.

  • The NIST e-Handbook warns that the maximum possible Z-score is n−1n\frac{n-1}{\sqrt{n}}, so on small samples no value can reach a large Z-score however extreme it looks.

  • Flagging a value as an outlier is not permission to delete it, because the rule identifies unusual values without explaining why they are unusual.

What Is the Outlier Formula?

The outlier formula identifies values sitting far enough from the bulk of a data set to deserve a second look, using quartile fences:

lower fence=Q1−1.5×IQR,upper fence=Q3+1.5×IQR\text{lower fence} = Q_1 - 1.5 \times \text{IQR}, \qquad \text{upper fence} = Q_3 + 1.5 \times \text{IQR}

Any observation outside those bounds is flagged. The NIST/SEMATECH e-Handbook of Statistical Methods calls these inner fences, with outer fences at three times the interquartile range.

The Two Standard Outlier Formulas

The quartile method assumes nothing about the shape of the data. It builds the fences from Q1Q_1, Q3Q_3 and the interquartile range, which all ignore the tails, so the rule is not distorted by the values it is looking for.

The Z-score method measures distance from the mean in units of standard deviation:

Zi=xi−xˉsZ_i = \frac{x_i - \bar{x}}{s}

Values with ∣Zi∣\lvert Z_i \rvert above about 3 are commonly flagged. The weakness is circular: an extreme value inflates both xˉ\bar{x} and ss, shrinking its own Z-score and hiding it. NIST addresses that with a modified Z-score built from the median:

Mi=0.6745(xi−x~)MADM_i = \frac{0.6745(x_i - \tilde{x})}{\text{MAD}}

where x~\tilde{x} is the median and MAD is the median absolute deviation. NIST reports a recommendation that modified Z-scores above 3.5 in absolute value be labelled potential outliers.

Why Z-Scores Fail on Small Samples

This is the detail most outlier guides omit. The NIST e-Handbook notes that the maximum possible Z-score in a sample of size nn is n−1n\frac{n-1}{\sqrt{n}}.

For n=5n = 5 that ceiling is 45≈1.789\frac{4}{\sqrt{5}} \approx 1.789, so on five observations no value can ever reach a Z-score of 3, however obviously it stands apart.

So applying a "Z above 3" rule to a small sample guarantees finding nothing. For n=10n = 10 the ceiling is about 2.846, still below 3, and the rule only becomes usable from about n=11n = 11.

Variable Key

Symbol

Meaning

Unit or type

Notes

Q1Q_1, Q3Q_3

first and third quartiles

same units as the data

the fence anchors

IQR\text{IQR}

interquartile range

same units as the data

Q3−Q1Q_3 - Q_1

1.51.5

inner fence multiplier

dimensionless

NIST uses 3 for outer fences

ZiZ_i

standard score

dimensionless

xi−xˉs\frac{x_i - \bar{x}}{s}

MiM_i

modified Z-score

dimensionless

median-based, threshold 3.5

MAD\text{MAD}

median absolute deviation

same units as the data

median(∣xi−x~∣)\text{median}(\lvert x_i - \tilde{x} \rvert)

Examples of the Outlier Formula

Example 1

A data set has Q1=32Q_1 = 32 and Q3=48Q_3 = 48. Find the inner fences and test whether 78 is an outlier.

IQR=48−32=16\text{IQR} = 48 - 32 = 16 lower=32−1.5(16)=8,upper=48+1.5(16)=72\text{lower} = 32 - 1.5(16) = 8, \qquad \text{upper} = 48 + 1.5(16) = 72

Final answer: Since 78>7278 > 72, the value 78 is a mild outlier, beyond the upper inner fence but inside the outer fence at 96.

Example 2

Test whether 100 is an outlier in 2, 4, 5, 6, 100 using a Z-score above 3.

The Z-score rule looks natural here, because 100 is obviously unlike the rest. The mean is 1175=23.4\frac{117}{5} = 23.4 and the sample standard deviation is about 42.56, so

Z=100−23.442.56≈1.80Z = \frac{100 - 23.4}{42.56} \approx 1.80

That is nowhere near 3, so the rule says 100 is not an outlier. Yet it plainly is.

Two things went wrong together. The value inflated both the mean and the standard deviation it is measured against, and with n=5n = 5 the largest possible Z-score is only 45≈1.789\frac{4}{\sqrt{5}} \approx 1.789, so the test could never flag anything.

The quartile method has no such ceiling. Sorted, the data gives Q1=4Q_1 = 4 and Q3=6Q_3 = 6, so IQR=2\text{IQR} = 2 and the upper fence is 6+1.5(2)=96 + 1.5(2) = 9:

100>9100 > 9

Final answer: 100 is an outlier by the IQR rule, and beyond the outer fence at 12 it is an extreme one.

Example 3

Find the outlier fences for 12, 14, 15, 15, 16, 18, 19, 45.

With N=8N = 8, the quartile positions are 0.25(9)=2.250.25(9) = 2.25 and 0.75(9)=6.750.75(9) = 6.75:

Q1=14+0.25(15−14)=14.25,Q3=18+0.75(19−18)=18.75Q_1 = 14 + 0.25(15-14) = 14.25, \qquad Q_3 = 18 + 0.75(19-18) = 18.75 IQR=4.5,upper fence=18.75+1.5(4.5)=25.5\text{IQR} = 4.5, \qquad \text{upper fence} = 18.75 + 1.5(4.5) = 25.5

Final answer: 45 is flagged, since 45>25.545 > 25.5, and it also passes the outer fence at 32.25, making it extreme.

Example 4

A sample of 11 values has xˉ=50\bar{x} = 50 and s=8s = 8. Is a value of 77 an outlier by the Z-score rule?

Z=77−508=3.375Z = \frac{77 - 50}{8} = 3.375

With n=11n = 11, the ceiling is 1011≈3.015\frac{10}{\sqrt{11}} \approx 3.015, so a Z-score of 3.375 is not attainable. The figures given are therefore inconsistent with a sample of this size.

Final answer: The value exceeds the maximum Z-score for n=11n = 11, so the stated mean, standard deviation and sample size cannot all be correct. Checking a Z-score against the ceiling catches transcription errors in reported summary statistics.

Example 5

Use the modified Z-score on 10, 11, 12, 13, 40.

The median is 12, and the absolute deviations from it are 2,1,0,1,282, 1, 0, 1, 28, whose median is 1, so MAD=1\text{MAD} = 1:

M=0.6745(40−12)1=18.89M = \frac{0.6745(40 - 12)}{1} = 18.89

Final answer: M≈18.89M \approx 18.89, far above the 3.5 threshold, so 40 is flagged.

The median and MAD both ignore the extreme value, so the modified score is not dragged down by it as the ordinary Z-score was in Example 2.

An Outlier Is Not Automatically an Error

What the rule tells you

What it does not tell you

The value lies far from the bulk of the data

Whether it was recorded incorrectly

How far, in IQR or standard deviation units

Whether the underlying process changed

Whether it is mild or extreme by NIST's bands

Whether it should be removed

The NIST e-Handbook treats outlier identification as labelling, and names Grubbs' test as the recommended route when testing for a single outlier. None of that decides what to do with the point.

A flagged value can be a keying error, a genuine rare event, or the most informative observation in the set. Deciding needs to know where the data came from, which no formula supplies.

Tripping Points to Avoid

Mistake 1: Deleting flagged values as a matter of routine

Where it slips in: The rule returns a clean verdict, so the verdict gets treated as an instruction.

Don't do this: Remove every value beyond a fence before analysing the data.

The correct way: Investigate first, and if a point is removed, say which rule flagged it and why removal was justified.

Students who ask what the flagged value would mean if it were real, before deciding anything, keep the genuinely interesting observations. The reflex to tidy data is where real findings get discarded.

Mistake 2: Using a Z-score threshold on a small sample

Where it slips in: The "Z above 3" rule is widely quoted without its sample-size condition.

Don't do this: Apply a Z-score cutoff of 3 to a sample of five or ten values.

The correct way: Check the ceiling n−1n\frac{n-1}{\sqrt{n}} first. Below about n=11n = 11 the threshold is unreachable, so use the quartile fences or the modified Z-score instead.

Mistake 3: Recomputing the fences after removing a point

Where it slips in: Removing one outlier changes the quartiles, which moves the fences, which flags another point, and so on.

Don't do this: Iterate the rule until nothing is flagged.

The correct way: Apply the fences once, to the original data. Repeated application will eventually flag almost anything, because each removal tightens the spread the next pass measures against.

What to Remember About the Outlier Formula

  • The outlier formula flags values beyond Q1−1.5×IQRQ_1 - 1.5 \times \text{IQR} or Q3+1.5×IQRQ_3 + 1.5 \times \text{IQR}.

  • NIST calls these inner fences and adds outer fences at three times the IQR, separating mild from extreme outliers.

  • The Z-score alternative is self-defeating on small samples, because the maximum attainable score is n−1n\frac{n-1}{\sqrt{n}}.

  • A flagged point is a candidate for investigation, never an automatic deletion.

  • To work through data handling with a teacher, explore a high school math tutor or math tutoring.

Quick Self-Check, Try These

Find the inner fences for 5, 7, 8, 9, 10, 12, 30 and say whether 30 is flagged. Then compute the maximum possible Z-score for this sample size and decide whether a Z-score rule could have caught it.

Want a live Bhanzu trainer to walk through more statistics problems? Book a free demo class.

Read More

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the outlier formula?
Values below Q1−1.5×IQRQ_1 - 1.5 \times \text{IQR} or above Q3+1.5×IQRQ_3 + 1.5 \times \text{IQR} are flagged as outliers.
Why does the outlier formula use 1.5 times the IQR?
It is a convention that balances flagging too much against flagging too little, and the NIST e-Handbook adopts it for inner fences while using three times the IQR for outer fences. The multiplier is not derived from a probability, which is why the rule labels candidates rather than proving anything.
What is the difference between a mild and an extreme outlier?
A mild outlier lies beyond an inner fence at 1.5 times the IQR, and an extreme outlier lies beyond an outer fence at three times the IQR.
Can the outlier formula be used on any data set?
The quartile version can, since it assumes nothing about shape. The Z-score version assumes roughly symmetric data and needs a sample large enough for the threshold to be reachable.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →