Interquartile range

Also known as: IQR

On this page 7

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.

QuantityDefinitionValue in the example
MinimumSmallest observation3
First quartile (Q1)25th percentile6
Median (Q2)50th percentile12
Third quartile (Q3)75th percentile16
MaximumLargest observation21
Interquartile rangeQ3 minus Q110
Quantities used to compute the IQR

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.

MethodApproachWhere it appears
Tukey hingesMedians of lower and upper halves, including the median when n is oddClassic box plots, five-number summary
Exclusive halvesMedians of halves, excluding the medianMany introductory textbooks
Linear interpolation (type 7)Interpolates at position 1 + (n − 1)pDefault in R, NumPy and spreadsheet QUARTILE.INC
Type 6 interpolationInterpolates at position (n + 1)pMinitab, SPSS, spreadsheet QUARTILE.EXC
Common quartile conventions

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.

FenceFormulaValueInterpretation
Lower inner fenceQ1 − 1.5 × IQR−9Values below are mild outliers
Upper inner fenceQ3 + 1.5 × IQR31Values above are mild outliers
Lower outer fenceQ1 − 3 × IQR−24Values below are extreme outliers
Upper outer fenceQ3 + 3 × IQR46Values above are extreme outliers
Tukey fences applied to the example data

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.

MeasureBased onRobust to outliersBest suited for
Interquartile rangeQ1 and Q3YesSkewed data, reporting with the median
RangeMinimum and maximumNoQuick checks of data limits
Standard deviationSquared deviations from the meanNoSymmetric, roughly normal data
Median absolute deviationAbsolute deviations from the medianYes, 50 percent breakdownHeavily contaminated data
Comparison of dispersion measures

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.