[Home](https://learningfolio.de5.net/) / [Math](https://learningfolio.de5.net/math/) / [Math glossary](https://learningfolio.de5.net/math/glossary/) / Interquartile Range: Formula, Box Plots, and Outliers

[Math glossary](https://learningfolio.de5.net/math/glossary/)

# Interquartile Range: Formula, Box Plots, and Outliers

Calculate interquartile range from quartiles, read a box plot, and apply the 1.5 IQR rule. Compare methods with six examples.

Written by **Learningfolio Team**

We’re subject-matter experts in math, science, parent support, and education, with 100 years of combined experience. We believe in learning, experimenting, and growing, and we review one another’s work.

## On this page

* [TL;DR](https://learningfolio.de5.net/math/interquartile-range/#tldr)
* [Key Points](https://learningfolio.de5.net/math/interquartile-range/#key-points)
* [What is the interquartile range?](https://learningfolio.de5.net/math/interquartile-range/#what-is-the-interquartile-range)
* [How do you calculate the IQR by hand?](https://learningfolio.de5.net/math/interquartile-range/#how-do-you-calculate-the-iqr-by-hand)
* [How does the IQR appear on a box plot?](https://learningfolio.de5.net/math/interquartile-range/#how-does-the-iqr-appear-on-a-box-plot)
* [How do you find outliers with the 1.5 IQR rule?](https://learningfolio.de5.net/math/interquartile-range/#how-do-you-find-outliers-with-the-15-iqr-rule)
* [Examples of Interquartile Range](https://learningfolio.de5.net/math/interquartile-range/#examples-of-interquartile-range)
* [What mistakes should you check before comparing IQRs?](https://learningfolio.de5.net/math/interquartile-range/#what-mistakes-should-you-check-before-comparing-iqrs)
* [Try It Yourself](https://learningfolio.de5.net/math/interquartile-range/#try-it-yourself)
* [Questions About Interquartile Range](https://learningfolio.de5.net/math/interquartile-range/#questions-about-interquartile-range)
* [Conclusion](https://learningfolio.de5.net/math/interquartile-range/#conclusion)
* [Read More](https://learningfolio.de5.net/math/interquartile-range/#read-more)
* [Research Behind This Article](https://learningfolio.de5.net/math/interquartile-range/#research-behind-this-article)

## TL;DR

**The interquartile range is $Q_3-Q_1$, the distance between the upper and lower quartiles.** It measures the spread of the middle of a dataset and helps flag unusually low or high values.

## Key Points

* The lower quartile is $Q_1$, the median is $Q_2$, and the upper quartile is $Q_3$.
* The interquartile range has the same units as the data.
* The usual outlier fences are $Q_1-1.5\,\mathrm{IQR}$ and $Q_3+1.5\,\mathrm{IQR}$.
* Quartile conventions can change the reported result on small datasets.
* A flagged outlier needs investigation before any decision to remove it.

## What is the interquartile range?

The **interquartile range**, or **IQR**, measures the width of the middle portion of ordered data. It runs from the first quartile $Q_1$, near the 25th percentile, to the third quartile $Q_3$, near the 75th percentile. The second quartile $Q_2$ is the median.

$$
\mathrm{IQR}=Q_3-Q_1.
$$

The IQR spans the middle 50% in the percentile sense. In a small dataset or one with many ties, the number of observations on or inside the quartile boundaries can differ from exactly half. OpenStax and CUNY explain quartiles as locations in ordered data.

The [median, range, and outliers lesson](https://learningfolio.de5.net/math/median-range-and-outliers/) compares an extreme-to-extreme range with a measure of the center. The IQR adds a third option. It describes the spread around that center and usually changes less than the full range when one extreme observation changes.

## How do you calculate the IQR by hand?

Use the **median-of-halves method** if your course specifies it. The version used for the examples here excludes the overall median from the two halves when the dataset has an odd number of observations.

1. Sort the values from smallest to largest.
2. Find the overall median. If the dataset size is even, split it evenly. If it is odd, set aside the single median value.
3. Find the median of the lower half for $Q_1$ and the median of the upper half for $Q_3$.
4. Subtract $Q_1$ from $Q_3$.

Keep the units. If the quartiles are 8 minutes and 15 minutes, the IQR is 7 minutes. A negative IQR means the subtraction order or placement of the quartiles needs checking.

### Why can a spreadsheet return a different IQR?

Software may compute the 25th and 75th percentiles using interpolation. Courses can also differ on whether the overall median joins both halves for an odd-length list. NIST’s quantile reference documents multiple percentile methods.

For $2,4,7,9,14$, excluding the middle 7 gives lower and upper quartiles of 3 and 11.5, so the IQR is 8.5. Including the 7 in both halves gives quartiles of 4 and 9, so the IQR is 5. Before comparing answers, check whether both calculations used the same rule.

## How does the IQR appear on a box plot?

In a box plot, the two ends of the box mark $Q_1$ and $Q_3$. The line inside marks the median. Read the box width along the number scale to get IQR. A wide box shows a larger middle spread when you compare plots drawn on the same scale.

![Box plot with quartiles at three and nine, median at six, upper whisker at ten, and an outlier at twenty](https://learningfolio.de5.net/assets/versioned/interquartile-range-box-plot.523345f38c3a.webp)


The box spans 3 to 9, so the IQR is 6. The upper fence is 18, and the value 20 is drawn as a separate point.

Many box plots use whiskers that extend to the most extreme observations still inside the fences. Some simpler box plots instead extend to the minimum and maximum. OpenStax’s box-plot lesson shows the five-number summary, and the NIST handbook describes the fence-based version. Read the chart’s convention before inferring which observations its whiskers cover.

## How do you find outliers with the 1.5 IQR rule?

Find the quartiles using the intended convention. Then compute two boundaries.

$$
\begin{aligned}
\text{Lower fence}&=Q_1-1.5\,\mathrm{IQR},\\
\text{Upper fence}&=Q_3+1.5\,\mathrm{IQR}.
\end{aligned}
$$

A value strictly below the lower fence or strictly above the upper fence is flagged. A value exactly on a fence is inside by this convention. The fences are calculated positions and do not need to be observed values. The NIST outliers guide distinguishes these positions from the end of a whisker.

A flag can point to a data-entry error, a different subgroup, or an unusual but valid observation. Inspect the measurement and surrounding context before making a decision. If the IQR is zero because many values tie, even a small departure can be flagged.

## Examples of Interquartile Range

### Example 1

Find the IQR of $2,3,5,6,7,8,10,12$.

1. The lower half is $2,3,5,6$, so $Q_1=(3+5)/2=4$.
2. The upper half is $7,8,10,12$, so $Q_3=(8+10)/2=9$.
3. The IQR is $9-4=5$.

### Example 2

Find the quartiles of $2,4,7,9,14$ using the method that excludes the overall median.

1. Set aside the middle value 7.
2. The lower half $2,4$ gives $Q_1=3$. The upper half $9,14$ gives $Q_3=11.5$.
3. The IQR is $11.5-3=8.5$. Leaving 7 in the halves would apply a different method.

### Example 3

Check $1,2,4,5,7,8,10,20$ for outliers.

1. The quartiles are $Q_1=3$ and $Q_3=9$. The IQR is 6.
2. Multiply by 1.5 to get 9. The fences are $3-9=-6$ and $9+9=18$.
3. The value 20 is above the upper fence. The greatest observed value within the upper fence is 10, so the upper whisker ends at 10.

### Example 4

Compare the IQR and full range before and after replacing 12 with 40 in $0,3,5,6,7,8,10,12$.

1. The original full range is $12-0=12$. After replacement it is $40-0=40$.
2. In both datasets the middle of the lower half is 4, and the middle of the upper half is 9.
3. Both IQRs equal 5. Changing that largest value affects the full range without affecting the middle-half spread in this example.

### Example 5

Find the semi-interquartile range for quartiles 3 and 11.5.

1. Subtract to get the IQR of 8.5.
2. The **semi-interquartile range**, sometimes called quartile deviation, equals half the IQR.
3. Its value is $8.5/2=4.25$.

### Example 6

Find the quartile-based outlier flags for $4,4,4,4,4,4,4,9$.

1. Both half-medians equal 4, giving IQR $4-4=0$.
2. Both fences equal 4.
3. The value 9 is flagged. The repeated 4s explain the tight fences, so investigate the 9 using the measurement context.

## What mistakes should you check before comparing IQRs?

### Mistake 1: Taking the difference between the endpoints of the dataset

For Example 3, $20-1=19$ is the full range. The IQR uses the box endpoints 3 and 9, yielding 6. Identify which two values the question asks you to subtract.

### Mistake 2: Using the median as the center of both fences

The lower fence starts at $Q_1$ and the upper fence starts at $Q_3$. Using the median as the starting point shifts both boundaries inward and can flag ordinary data.

### Mistake 3: Comparing values from different quartile conventions

On a short list, switching conventions can change $Q_1$, $Q_3$, and the flags. Record the quartile method beside the result, particularly if comparing a hand calculation with a spreadsheet.

## Try It Yourself

1. Find the IQR when $Q_1=12$ and $Q_3=18$.
2. For those quartiles, calculate both fences and decide if 27 is beyond the upper fence.
3. Find the median and IQR of $2,4,6,8$ using the median-of-halves method.

### Answers and Reasoning

1. The IQR is $18-12=6$.
2. The fences are $12-9=3$ and $18+9=27$. The value 27 is on the upper fence, so it is not beyond it.
3. The median is $(4+6)/2=5$. The two half-medians are 3 and 7, so the IQR is 4.

## Questions About Interquartile Range

### Is the IQR the same as the median?

The median describes a central value. The IQR describes a width. Two groups can have the same median and different IQRs.

### When is the IQR useful alongside standard deviation?

The IQR pairs naturally with the median to describe skewed data or data with unusual values. Standard deviation measures variation around the mean. Reporting both can reveal different aspects of spread. The [variance lesson](https://learningfolio.de5.net/math/variance/) shows where the squared deviations enter that calculation.

### Can the interquartile range be zero?

Yes, when $Q_1=Q_3$. This can happen in a dataset with many repeated values even though some values differ from them.

## Conclusion

* Sort the data and calculate quartiles using the intended method.
* Subtract the lower quartile from the upper quartile to measure the middle spread.
* Use the $1.5\,\mathrm{IQR}$ fences to flag values for a closer look.

## Read More

* [When to report the mean, median, or mode](https://learningfolio.de5.net/math/formula/mean-median-mode-formula/)

## Research Behind This Article

1. OpenStax, *Introductory Statistics 2e: Measures of the Location of the Data*. [OpenStax](https://openstax.org/books/introductory-statistics-2e/pages/2-3-measures-of-the-location-of-the-data)
2. City University of New York, *Concepts in Statistics: Interquartile Range and Boxplots*. [CUNY Pressbooks](https://pressbooks.cuny.edu/conceptsinstatistics/chapter/interquartile-range-and-boxplots-1-of-3-concepts-in-statistics/)
3. National Institute of Standards and Technology, *Dataplot Reference: Quantile*. [NIST](https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/quantile.htm)
4. OpenStax, *Statistics: Box Plots*. [OpenStax](https://openstax.org/books/statistics/pages/2-4-box-plots)
5. NIST/SEMATECH, *Engineering Statistics Handbook: What Are Outliers in the Data?* [NIST](https://itl.nist.gov/div898/handbook/prc/section1/prc16.htm)
