Skip to content
MasterMath

Interquartile Range Calculator

The interquartile range and the outliers under the 1.5 × IQR rule, which is the one that draws the whiskers on a box plot.

Interquartile range

—

Interquartile range—
First quartile—
Third quartile—
Lower fence—
Upper fence—
Outliers—
ValueStatus

How this was worked out

    The formula

    IQR = Q3 − Q1 · an outlier falls outside Q1 − 1.5·IQR and Q3 + 1.5·IQR

    What it means

    The interquartile range is the distance between the third quartile and the first, that is, the width of the middle half of the data. It is a measure of spread that, unlike standard deviation, is unmoved by one absurd value: whether the maximum is a hundred or a million, the quartiles do not shift. That insensitivity is exactly what makes it useful for spotting those absurd values in the first place.

    How to work it out by hand

    1. Sort the values and work out the first and third quartiles
    2. Subtract: IQR = Q3 − Q1
    3. Work out the fences: Q1 − 1.5 × IQR and Q3 + 1.5 × IQR
    4. Anything outside those two fences is an outlier

    What is worth knowing

    The 1.5 in the rule follows from nothing: John Tukey picked it because in a normal distribution it leaves out roughly 0.7 % of the data, which struck him as a reasonable threshold. It is a useful convention, not a test: an outlier may be a measurement error, a rare but real case, or a sign that the data are not normal. Flagging one means you have to look at it, not delete it, and deleting data on this rule alone is one of the commonest ways to fake an analysis.

    Frequently asked questions

    Why 1.5 and not some other number?

    It is Tukey's convention: in a normal distribution it leaves out about 0.7 % of the data. There is nothing mathematically compulsory about it.

    Should I delete outliers?

    Not as a rule. An outlier may be an error or a real and important case. The rule exists to flag them for inspection, not to remove them.

    What is the advantage over standard deviation?

    It is not shifted by one extreme value. Standard deviation very much is, because it squares the differences.

    What are the whiskers on a box plot?

    The lines running from the box to the most extreme value still inside the fences. Anything beyond is drawn as a separate point.

    What if there are no outliers?

    That is normal in small, well-behaved sets. Having none does not mean the data vary little.