Interquartile Range Calculator
Find Q1, Q2 (median), Q3, IQR = Q3 − Q1, and outliers using Tukey's 1.5×IQR rule.
Results
Interquartile Range (IQR)
The IQR = Q3 − Q1 measures the spread of the middle 50% of a dataset. Unlike range (max−min), IQR is not affected by extreme values on either end. It is the foundation of box plots and Tukey's outlier detection method.
Finding Quartiles
Sort the data. Q2 (median) splits the data in half. Q1 is the median of the lower half (values below Q2). Q3 is the median of the upper half (values above Q2). For datasets with an odd count, the middle value is usually excluded from both halves when computing Q1 and Q3 (exclusive method).
Outlier Detection
Tukey's fences: lower fence = Q1 − 1.5×IQR, upper fence = Q3 + 1.5×IQR. Values outside these fences are mild outliers. Values beyond Q1 − 3×IQR and Q3 + 3×IQR are extreme outliers. This method is robust because IQR itself is not influenced by the outliers being detected.
Worked Example
Test scores: 45, 62, 67, 70, 74, 78, 82, 85, 91, 98. Sorted with n=10. Median (Q2) = (74+78)/2 = 76. Lower half: [45, 62, 67, 70, 74] → Q1 = 67. Upper half: [78, 82, 85, 91, 98] → Q3 = 85. IQR = 85−67 = 18.
Outlier fences: Lower = 67 − 1.5×18 = 67−27 = 40. Upper = 85 + 1.5×18 = 85+27 = 112. Since 45 > 40 and all scores ≤ 112, there are no outliers in this dataset. The middle 50% of students scored between 67 and 85.
IQR vs. Standard Deviation for Spread
| Feature | IQR | Standard Deviation |
|---|---|---|
| What it measures | Spread of middle 50% | Average spread from mean |
| Affected by outliers? | No | Yes (significantly) |
| Best paired with | Median | Mean |
| Used in | Box plots, outlier detection | Normal distribution, t-tests |
Frequently Asked Questions
IQR = Q3 − Q1. Q1 is the 25th percentile (one quarter of data below), Q3 is the 75th percentile (three quarters below). IQR = the range of the middle 50% of the data.
Sort data, find median (Q2). Q1 = median of the lower half; Q3 = median of the upper half. For [2,4,7,8,9,10,15]: Q2=8, lower half=[2,4,7], Q1=4, upper half=[9,10,15], Q3=10. IQR=10−4=6.
Any value more than 1.5×IQR below Q1 or above Q3 is flagged as an outlier. This rule (Tukey's fences) is the standard criterion used in box plots and exploratory data analysis.
IQR is better when data is skewed or has outliers. Standard deviation squares deviations, giving extreme values disproportionate influence. IQR only looks at the middle 50%, making it resistant to outliers by design.
A box plot (box-and-whisker plot) visually represents the five-number summary: minimum, Q1, median, Q3, and maximum. The box spans from Q1 to Q3 (the IQR), and the line inside is the median. Whiskers extend to the Tukey fences (1.5×IQR beyond Q1 and Q3), and individual points beyond the whiskers are marked as outliers.
Yes — several methods exist and can give slightly different results. The most common are the exclusive method (excludes the median from both halves), the inclusive method (includes the median in both halves), and software-specific interpolation methods. Excel's QUARTILE.INC and QUARTILE.EXC functions differ, as do R, Python, and most statistics textbooks. For this calculator, the exclusive method is used.