IQR Calculator — Interquartile Range

Paste your numbers and get the interquartile range (IQR = Q3 − Q1), the quartiles Q1, median, and Q3, and the 1.5×IQR outlier fences.

Quick Facts

Formula
IQR = Q3 − Q1
Quartiles use linear interpolation (Excel QUARTILE.INC / NumPy default). Outlier fences: Q1 − 1.5×IQR and Q3 + 1.5×IQR.

Your Results

Calculated
IQR (Q3 − Q1)
-
Spread of the middle 50%
Q1 (25th percentile)
-
Lower quartile
Median (Q2)
-
50th percentile
Q3 (75th percentile)
-
Upper quartile
Outlier fences (1.5×IQR)
-
Lower / upper bounds

Ready

Enter a dataset and press Calculate.

What the interquartile range measures

The interquartile range (IQR) is a measure of statistical dispersion: it tells you how spread out the middle half of your data is. Formally, IQR = Q3 − Q1, where Q1 is the first quartile (the 25th percentile) and Q3 is the third quartile (the 75th percentile). Between those two cut points sit exactly the middle 50% of the observations, so the IQR is the width of that central block. In a box-and-whisker plot, the IQR is literally the length of the box.

Its defining virtue is robustness. Unlike the range (max − min) or the standard deviation, the IQR discards the bottom 25% and top 25% of the data, so a single wild value cannot inflate it. That is why the IQR is the preferred spread measure for skewed data such as incomes, house prices, or reaction times, where a few extreme observations would distort mean-based statistics.

How the quartiles are calculated

This calculator uses the linear-interpolation method, the same one Excel's QUARTILE.INC function and NumPy's default percentile use. The steps are:

  1. Sort the data from smallest to largest.
  2. For a percentile p (0.25 for Q1, 0.75 for Q3), compute the fractional position pos = p × (n − 1), where n is the number of values and positions are 0-indexed.
  3. If pos lands between two data points, interpolate: value = data[floor(pos)] + frac × (data[floor(pos)+1] − data[floor(pos)]).

Worked example. For the sorted set 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 (n = 10): Q1 position = 0.25 × 9 = 2.25, giving 36 + 0.25 × (39 − 36) = 36.75. Q3 position = 0.75 × 9 = 6.75, giving 42 + 0.75 × (43 − 42) = 42.75. So IQR = 42.75 − 36.75 = 6, and the median is the average of the 5th and 6th values, (40 + 41)/2 = 40.5.

Note that different software sometimes reports slightly different quartiles because there are several accepted definitions (Tukey's hinges, the "exclusive" method used by Excel's QUARTILE.EXC, and others). They agree for large datasets and differ only in how they handle the endpoints of small samples.

Using the IQR to detect outliers

The most common outlier rule, introduced by John Tukey, uses "fences" built from the IQR:

  • Lower fence: Q1 − 1.5 × IQR
  • Upper fence: Q3 + 1.5 × IQR

Any value below the lower fence or above the upper fence is flagged as a (mild) outlier and drawn as an individual point beyond the whiskers of a box plot. Points beyond Q1 − 3×IQR or Q3 + 3×IQR are sometimes called extreme outliers. For the example above, the fences are 36.75 − 9 = 27.75 and 42.75 + 9 = 51.75, so the value 7 (and 15) fall below the lower fence and are flagged.

Frequently Asked Questions

What is the interquartile range in one sentence?
The IQR is the distance between the third quartile and the first quartile (IQR = Q3 − Q1), which equals the spread of the middle 50% of your sorted data and is the box length in a box-and-whisker plot.
Why use the IQR instead of the standard deviation?
Both measure spread, but the IQR is resistant to outliers because it ignores the smallest and largest 25% of values, while the standard deviation is pulled by every extreme point. For skewed data (incomes, prices, wait times) the IQR paired with the median describes the distribution more faithfully than the mean and standard deviation.
Why might my Q1 and Q3 differ from another tool?
There are several legitimate quartile definitions. This calculator uses linear interpolation (Excel QUARTILE.INC / NumPy default). Excel's QUARTILE.EXC, Tukey's hinges, and some textbooks split the data differently at the median, so small samples can produce quartiles that differ by a fraction. All methods converge as the sample grows.
Can the IQR be zero?
Yes. If at least the middle half of your values are identical, Q1 equals Q3 and the IQR is 0. That signals a highly concentrated distribution — for example the dataset 5, 5, 5, 5, 5, 9 has an IQR of 0 even though it contains a larger value.