Skip to content

Glossary

Interquartile range

Q3 − Q1: the middle 50%

By Published Updated

The interquartile range (IQR) is the difference between the 75th percentile (Q3) and the 25th percentile (Q1). It captures the middle 50% of a dataset — the range that contains the “typical” values.

For dataset [1, 3, 4, 5, 6, 7, 8, 9, 10, 20]: Q1 = 4, Q3 = 9, IQR = 5. The middle half of the data lies between 4 and 9. The outlier 20 doesn’t affect the IQR at all.

Why IQR matters: it’s robust against outliers in a way standard deviation isn’t. For skewed distributions (income, response times, file sizes), IQR describes spread far better than SD. The common 1.5 × IQR rule defines outliers as values below Q1 − 1.5×IQR or above Q3 + 1.5×IQR — Tukey’s convention, and the basis of box plots.

Use IQR when: data is skewed, outliers are common, or you want a one-number summary that won’t mislead. Use standard deviation when: data is approximately normal and you want to feed it into downstream statistics (confidence intervals, regression).

Worked example

Sample HTTP request latencies (ms): [12, 14, 18, 22, 25, 28, 31, 33, 38, 42, 45, 48, 52, 58, 64, 71, 89, 110, 180, 4200]. Mean: 264 ms — dragged way up by the 4200 ms outlier (probably a network blip or a cold-start). Median (Q2): 43.5 ms. Q1: 25.75 ms. Q3: 67.25 ms. IQR = Q3 − Q1 = 41.5 ms. Tukey’s 1.5 × IQR upper fence = Q3 + 62.25 = 129.5 ms. So the 180 ms request is borderline outlier; the 4200 ms request is far past — a clear anomaly worth investigating. Standard deviation of this same dataset is roughly 920 ms, dominated entirely by the 4200 ms point, and would suggest typical latency is 264 ± 920 ms — which is meaningless (latency can’t be negative). IQR-based summary (“median 43.5 ms, IQR 25.75 to 67.25 ms”) is the truthful description of typical performance.

Quartile arithmetic also generalises: deciles split data into ten parts, quintiles into five, percentiles into one hundred. Income statistics typically use deciles (“the top decile of US earners”), credit scoring uses percentiles (“your FICO is in the 78th percentile”), and clinical growth charts plot child height/weight against age-and-sex percentiles. The mental model is the same: rank-based summary that ignores the scale of the values.

When and why it matters

IQR matters whenever data is skewed — which in practice is most real-world data outside of physics experiments. Response times, income distributions, file sizes, attention spans, sales-per-store, and almost everything in tech-product analytics has a right-tailed distribution where a few large values dominate the mean. Reporting “average response time” for an API misleads readers; reporting p50, p90, p99 — three percentiles — communicates the distribution shape. Site reliability engineers learned this lesson the hard way in the 2000s; modern observability platforms (Datadog, Honeycomb, Prometheus histograms) all default to percentile-based metrics for latency. The mistake to avoid is computing “average” alone and acting on it: optimising mean latency when the user pain is at p99 wastes engineering effort. Reference: NIST/SEMATECH e-Handbook — Quartiles.

Why there are nine ways to compute a quartile: the position of Q1 in a dataset of N values is ambiguous when N is not a multiple of 4 + 1, and statisticians have proposed nine conventions for interpolating between adjacent values. R’s quantile() function defaults to Type 7 (linear interpolation between order statistics), Excel’s QUARTILE.INC matches Type 7, NumPy’s np.percentile() defaults to linear too, but SAS, Minitab, and Tukey’s original hinge method all use different formulas. The IQRs differ by a few percent across methods on small samples and converge as N grows. Convertitive’s statistics calculator uses Type 7 because it matches the most-deployed analysis tools.

Box plots, IQR, and outlier detection in production systems: Tukey’s 1.5 × IQR fence is the basis for box-plot whiskers and is widely used in observability dashboards (Datadog, Grafana, Prometheus quantile aggregators) to flag latency outliers without assuming a normal distribution. For very heavy-tailed data (web request latency, financial returns), even 1.5 × IQR is too aggressive — request latencies routinely sit in the “outlier” tail by design, and flagging them as anomalies generates noise. The pragmatic fix is to widen to 3 × IQR for extreme outlier definitions or switch to percentile-based service-level objectives (p95, p99) entirely. Related: percentile, median, variance.

Frequently asked questions

What is the interquartile range (IQR)?
The IQR is the difference between the 75th percentile (Q3) and the 25th percentile (Q1) of a dataset. It measures the spread of the middle 50% of values, ignoring the extremes.
How is the IQR used to detect outliers?
The standard rule marks any value below Q1 − 1.5×IQR or above Q3 + 1.5×IQR as a potential outlier. Box plots use exactly this rule to determine the whisker endpoints and flag extreme points.
What is the difference between IQR and standard deviation?
Standard deviation measures spread relative to the mean and is sensitive to outliers; IQR measures spread relative to the median and is robust to them. For skewed distributions or data with outliers, IQR is a more informative spread measure.
When should I report IQR instead of standard deviation?
Report IQR when data are skewed or contain outliers — clinical trial results, income distributions, and response-time metrics are typical cases. It pairs naturally with the median, just as standard deviation pairs with the mean.

Related

Published May 16, 2026 · Last reviewed May 31, 2026