The interquartile range (IQR) is the difference between the third quartile (Q3) and the first quartile (Q1) of a dataset, so it measures the spread of the middle 50 percent of the observations. In statistics, the IQR is the standard robust measure of dispersion: because it ignores the lowest and highest quarters of the data, a few extreme values cannot inflate it.
Analysts use the interquartile range to describe skewed data, to draw box plots and to flag potential outliers with Tukey’s fences. It is the natural companion of the median, in the same way that the standard deviation accompanies the mean.
How the interquartile range is calculated
Computing the IQR requires sorting the data and locating two cut points. Q1 is the value below which 25 percent of observations fall, and Q3 is the value below which 75 percent fall. The interquartile range is then simply IQR = Q3 − Q1, expressed in the same units as the original data.
Consider the sorted sample 3, 5, 7, 8, 12, 13, 14, 18, 21. The median is 12. Using the common method that splits the data into a lower and an upper half excluding the median, Q1 is the median of 3, 5, 7, 8, which is 6, and Q3 is the median of 13, 14, 18, 21, which is 16. The interquartile range is therefore 10.
The table below lists the quantities involved in the calculation and what each one represents.
| Quantity | Definition | Value in the example |
|---|---|---|
| Minimum | Smallest observation | 3 |
| First quartile (Q1) | 25th percentile | 6 |
| Median (Q2) | 50th percentile | 12 |
| Third quartile (Q3) | 75th percentile | 16 |
| Maximum | Largest observation | 21 |
| Interquartile range | Q3 minus Q1 | 10 |
Quartile methods and why IQR values can differ
There is no single universal definition of a sample quartile, so different software can report slightly different IQR values for the same small dataset. Hyndman and Fan described nine sample quantile definitions that differ in how they interpolate between neighboring observations. The differences shrink as the sample grows and are usually negligible above a few hundred observations.
| Method | Approach | Where it appears |
|---|---|---|
| Tukey hinges | Medians of lower and upper halves, including the median when n is odd | Classic box plots, five-number summary |
| Exclusive halves | Medians of halves, excluding the median | Many introductory textbooks |
| Linear interpolation (type 7) | Interpolates at position 1 + (n − 1)p | Default in R, NumPy and spreadsheet QUARTILE.INC |
| Type 6 interpolation | Interpolates at position (n + 1)p | Minitab, SPSS, spreadsheet QUARTILE.EXC |
When results must be reproducible, a report should state the quartile method used, especially for samples smaller than about 30 observations, where the choice can shift Q1 or Q3 by a noticeable fraction of the IQR.
Detecting outliers with the IQR rule
The most widespread application of the interquartile range is the 1.5 × IQR rule, introduced by John Tukey for exploratory data analysis. Observations below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR are labeled potential outliers, and points beyond 3 × IQR from the quartiles are often called extreme outliers.
In a box plot, the box spans Q1 to Q3, the line inside marks the median, and the whiskers extend to the most extreme data points still inside the fences. Points outside are plotted individually.
| Fence | Formula | Value | Interpretation |
|---|---|---|---|
| Lower inner fence | Q1 − 1.5 × IQR | −9 | Values below are mild outliers |
| Upper inner fence | Q3 + 1.5 × IQR | 31 | Values above are mild outliers |
| Lower outer fence | Q1 − 3 × IQR | −24 | Values below are extreme outliers |
| Upper outer fence | Q3 + 3 × IQR | 46 | Values above are extreme outliers |
For data from a normal distribution, the inner fences sit at roughly ±2.7 standard deviations, so about 0.7 percent of perfectly normal observations are flagged. A flag is therefore a reason to investigate, not proof of an error.
Interquartile range versus other measures of spread
The IQR is one of several dispersion statistics, and the right choice depends on the shape of the distribution and the presence of outliers. Its breakdown point is 25 percent, meaning up to a quarter of the data can be arbitrarily corrupted on each side before the IQR becomes meaningless, whereas the standard deviation breaks down with a single extreme value.
| Measure | Based on | Robust to outliers | Best suited for |
|---|---|---|---|
| Interquartile range | Q1 and Q3 | Yes | Skewed data, reporting with the median |
| Range | Minimum and maximum | No | Quick checks of data limits |
| Standard deviation | Squared deviations from the mean | No | Symmetric, roughly normal data |
| Median absolute deviation | Absolute deviations from the median | Yes, 50 percent breakdown | Heavily contaminated data |
For normally distributed data, the IQR is approximately 1.349 standard deviations, so dividing the IQR by 1.349 gives a robust estimate of sigma. This relationship is widely used in quality control and in bandwidth rules for histograms, such as the Freedman–Diaconis rule.
Limitations and common mistakes
The robustness of the interquartile range comes at a cost: it discards information about the tails, which can be the most important part of the data in risk analysis or reliability engineering.
- Ignoring the tails: two datasets can share the same IQR while one has far more extreme values.
- Treating every flagged point as an error: the 1.5 × IQR rule identifies candidates for review, not data to delete automatically.
- Applying symmetric fences to skewed data: in strongly right-skewed distributions, the rule flags many legitimate high values; adjusted box plots or log transforms work better.
- Comparing IQRs across different units: the IQR is not scale-free, so relative measures such as the quartile coefficient of dispersion are needed for comparisons.
- Overinterpreting tiny samples: with fewer than about 10 observations, quartiles are unstable and depend heavily on the chosen method.
In simple terms
Imagine lining up 100 people by height. Remove the 25 shortest and the 25 tallest. The interquartile range is the height difference between the shortest and the tallest person left in the middle group.
This tells you how spread out typical values are. A very tall basketball player at the end of the line does not change it. That is the main advantage: the IQR shows the normal spread without being fooled by extremes.
A practical example
A hospital quality team reviews emergency department waiting times for one month, covering about 6,000 patient visits. The mean wait is 74 minutes, but a small number of patients waited more than eight hours during a system outage, which pulls the mean upward. The team instead reports the median of 52 minutes and an interquartile range of 31 to 88 minutes, giving an IQR of 57 minutes.
Applying the 1.5 × IQR rule, the upper fence is 88 + 85.5, or about 174 minutes. Roughly 240 visits exceed it. When the analysts examine them, most cluster on two specific days, which leads to a targeted review of the outage procedure. The outcome is a clearer picture of typical patient experience together with a precise list of exceptional cases worth investigating.