Interquartile Range (IQR) Calculator
Calculate the interquartile range (IQR) from your data to measure the spread of the middle 50% of values. The IQR is a robust measure of variability that is resistant to outliers, making it more reliable than the range for skewed distributions. See also our Five Number Summary Calculator, Box Plot Calculator, Outlier Calculator, and Percentile Calculator.
How to Use the IQR Calculator
The interquartile range (IQR) is the difference between the third quartile (Q3, 75th percentile) and the first quartile (Q1, 25th percentile). It represents the spread of the middle 50% of your data, effectively ignoring the extreme values in the upper and lower 25%. This makes the IQR a robust measure of spread that is not affected by outliers or extreme values, unlike the range or standard deviation.
To use this calculator, enter your data values separated by commas. The calculator will sort the data, compute Q1, Q2 (median), Q3, and the IQR. It also calculates the outlier fences using the 1.5×IQR rule: any value below Q1 - 1.5×IQR or above Q3 + 1.5×IQR is considered a mild outlier, while values beyond Q1 - 3×IQR or Q3 + 3×IQR are extreme outliers. This is the same method used to identify outliers in box plots.
The IQR is particularly useful when your data is skewed or contains outliers, as it provides a more representative measure of typical spread than the standard deviation. It is the foundation of box plot construction and is used in many non-parametric statistical methods. In data analysis, the IQR helps identify the "typical" range of values and flag unusual observations that may warrant further investigation.
IQR Formulas
Interquartile Range:
IQR = Q3 - Q1
Quartile Positions (for n data points):
Q1 position = 0.25 × (n - 1) + 1
Q2 position = 0.50 × (n - 1) + 1
Q3 position = 0.75 × (n - 1) + 1
Outlier Detection (1.5×IQR Rule):
Lower Fence = Q1 - 1.5 × IQR
Upper Fence = Q3 + 1.5 × IQR
Mild outlier: value < Lower Fence or value > Upper Fence
Extreme Outlier Detection (3×IQR Rule):
Extreme Lower = Q1 - 3 × IQR
Extreme Upper = Q3 + 3 × IQR
Example Calculation
Calculate the IQR for the dataset: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
Sorted data: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
n = 10
Q1 position = 0.25 × 9 = 2.25 → Q1 = 4 + 0.25×(6-4) = 4.5
Q2 position = 0.50 × 9 = 4.5 → Q2 = 10 + 0.5×(12-10) = 11
Q3 position = 0.75 × 9 = 6.75 → Q3 = 14 + 0.75×(16-14) = 15.5
IQR = Q3 - Q1 = 15.5 - 4.5 = 11
Lower Fence = 4.5 - 1.5×11 = 4.5 - 16.5 = -12
Upper Fence = 15.5 + 1.5×11 = 15.5 + 16.5 = 32
No outliers (all values between -12 and 32)
Quartile Measures Reference
| Measure | Symbol/Formula | Description |
|---|---|---|
| Minimum | Min | Smallest value in the dataset |
| First Quartile | Q1 | 25th percentile — 25% of data falls below |
| Median | Q2 | 50th percentile — middle value |
| Third Quartile | Q3 | 75th percentile — 75% of data falls below |
| Maximum | Max | Largest value in the dataset |
| IQR | Q3 - Q1 | Spread of the middle 50% of data |
| Lower Fence | Q1 - 1.5×IQR | Below this = mild outlier |
| Upper Fence | Q3 + 1.5×IQR | Above this = mild outlier |
Frequently Asked Questions
Why is IQR better than range for measuring spread?
The range (max - min) uses only the two most extreme values, making it highly sensitive to outliers. A single extreme value can dramatically inflate the range. The IQR uses Q1 and Q3, which are based on the middle portion of the data and are resistant to outliers. For skewed distributions or data with outliers, the IQR provides a much more stable and representative measure of typical spread.
How does the 1.5×IQR rule work for outlier detection?
The 1.5×IQR rule defines outliers as values that fall more than 1.5 times the IQR below Q1 or above Q3. This rule was proposed by John Tukey and is used in box plots. For normally distributed data, approximately 0.7% of observations would be flagged as outliers by this rule. Values beyond 3×IQR from the quartiles are considered extreme outliers. This method is non-parametric and works well regardless of the data distribution.
What is the relationship between IQR and standard deviation?
For normally distributed data, IQR ≈ 1.35 × σ (standard deviation). This relationship allows you to estimate one from the other: σ ≈ IQR / 1.35. However, this relationship only holds for normal distributions. For skewed or heavy-tailed distributions, the IQR and standard deviation can give very different pictures of spread. The IQR is preferred for non-normal data because it doesn't assume any particular distribution shape.
Can IQR be zero?
Yes, IQR can be zero if Q1 equals Q3, which means at least 50% of the data values are identical. This can happen with discrete data that has many repeated values, or with very small datasets. An IQR of zero indicates that the middle half of the data has no spread, though there may still be variability in the tails. In such cases, other measures of spread may be more informative.
Are there different methods for calculating quartiles?
Yes, there are several methods for calculating quartiles, and they can give slightly different results for small datasets. Common methods include: (1) Inclusive method (used by some textbooks), (2) Exclusive method (used by Excel QUARTILE.EXC), (3) Linear interpolation method (used here and by most statistical software). For large datasets, all methods give essentially the same results. The differences are most noticeable with small sample sizes.
How is IQR used in box plots?
In a box plot, the box spans from Q1 to Q3, so its height (or width) equals the IQR. The line inside the box marks the median (Q2). The whiskers extend to the most extreme data points within 1.5×IQR of the box edges. Points beyond the whiskers are plotted individually as outliers. The box plot provides a visual summary of the five-number summary and makes it easy to identify skewness, spread, and outliers at a glance.