The interquartile range, or IQR, is the third quartile minus the first quartile: \(\operatorname{IQR}=Q_3-Q_1\). It measures the distance between the lower and upper quartiles in the data’s original units.
Quartiles describe the central part of an ordered distribution. For a finite sample, their numerical values depend on the method used to locate the 25th and 75th percentiles. Declare that method whenever exact reproducibility matters.

Calculate IQR in four steps
- Sort the numerical observations.
- Calculate Q1 using a stated quartile rule.
- Calculate Q3 using the same rule.
- Subtract Q1 from Q3.
Use 1 2 3 4 5 9. Under linear interpolation with R’s type 7 convention, the one-based rank is \(h=1+(n-1)p\). At \(p=0.25\), \(h=2.25\), giving \(Q_1=2.25\). At \(p=0.75\), \(h=4.75\), giving \(Q_3=4.75\).
Therefore \(\operatorname{IQR}=4.75-2.25=2.5\). If the observations are in minutes, IQR is 2.5 minutes. It is a distance, not a percentage of observations.
A second valid convention
The median-of-halves method takes the median of 1, 2, 3 and the median of 4, 5, 9. That gives \(Q_1=2\), \(Q_3=5\), and \(\operatorname{IQR}=3\). For an odd observation count, specify whether the overall median is included in each half; the version used here excludes it.
These methods agree on many simple datasets and disagree on others. Neither result should be compared with software output before checking the algorithm. IQR also differs from the full range, which is maximum minus minimum: here, \(9-1=8\).
The 1.5 × IQR fences
A common screening rule defines a lower fence \(Q_1-1.5\times\operatorname{IQR}\) and an upper fence \(Q_3+1.5\times\operatorname{IQR}\). Flag observations strictly below the lower fence or strictly above the upper fence.
Using type 7 in this example, the fences are −1.5 and 8.5. The value 9 is flagged. Using median-of-halves, the fences are −2.5 and 9.5, and 9 is not flagged. An observation exactly on a fence is not outside it.
A fence identifies a value to examine. It does not prove a recording error and does not automatically justify exclusion. Look at units, data provenance, the distribution, and the purpose of the analysis.
Interpretation and limits
IQR focuses on the central spread and is less sensitive than the full range to moving an extreme endpoint. It can still change when observations move across quartile positions. An IQR of zero means the two computed quartiles coincide, not necessarily that every observation is identical.
Missing observations, repeated values, very small samples, and different interpolation settings can affect results. Record the dataset and the quartile rule alongside the IQR. For categorical labels without a numerical ordering, this subtraction has no meaningful interpretation.