IQR Calculator

The interquartile range (IQR) equals Q3 minus Q1, where Q1 is the median of the lower half and Q3 is the median of the upper half of a sorted data set. IQR measures the spread of the middle 50% of values and is commonly used to identify outliers. Enter your data below to calculate all quartiles, fences, and outliers instantly.

Quick Answer

For the data set {1, 2, 3, 4, 5, 6, 7, 8}, Q1 = 2.5, Q3 = 6.5, and the IQR is 4.

Separate values with commas, spaces, or newlines

Common Examples

Input Result
1, 2, 3, 4, 5, 6, 7, 8 Q1: 2.5, Q3: 6.5, IQR: 4
3, 7, 8, 5, 12, 14, 21, 13, 18 Q1: 6, Q3: 16, IQR: 10
1, 2, 5, 6, 7, 9, 12, 15, 18, 19, 27 Q1: 5, Q3: 18, IQR: 13
10, 12, 14, 16, 18, 20, 100 Q1: 12, Q3: 20, IQR: 8, Outlier: 100

How It Works

The interquartile range (IQR) is a measure of statistical dispersion that describes the spread of the middle 50% of a data set. It is more robust than range because it is not affected by extreme values.

Step 1: Sort the Data

Arrange all values in ascending order.

Step 2: Find the Median (Q2)

The median divides the sorted data into two equal halves. For an odd number of values, Q2 is the middle value. For an even number, Q2 is the average of the two middle values.

Step 3: Find Q1 and Q3

Q1 (the first quartile) is the median of the lower half of the data (all values below Q2). Q3 (the third quartile) is the median of the upper half of the data (all values above Q2). For an odd-sized data set, the middle value (Q2 itself) is excluded from both halves when computing Q1 and Q3.

Step 4: Calculate IQR

IQR = Q3 - Q1

Step 5: Determine Fences and Outliers

The lower fence is Q1 - 1.5 x IQR. The upper fence is Q3 + 1.5 x IQR. Any data point below the lower fence or above the upper fence is classified as an outlier. This is the standard method used in box-and-whisker plots.

Worked Example

For the data set {3, 7, 8, 5, 12, 14, 21, 13, 18}: Sorted: {3, 5, 7, 8, 12, 13, 14, 18, 21}. There are 9 values, so Q2 (median) = 12 (the 5th value). Lower half: {3, 5, 7, 8}. Q1 = (5 + 7) / 2 = 6. Upper half: {13, 14, 18, 21}. Q3 = (14 + 18) / 2 = 16. IQR = 16 - 6 = 10. Lower fence = 6 - 1.5(10) = -9. Upper fence = 16 + 1.5(10) = 31. All values fall within the fences, so there are no outliers.

Related Calculators

Frequently Asked Questions

What is the interquartile range used for?
The IQR measures the spread of the middle 50% of a data set. It is commonly used to identify outliers, construct box-and-whisker plots, and compare the variability of different data sets. Because IQR only considers the middle half of the data, it is resistant to extreme values, making it a more robust measure of spread than the full range.
How does IQR identify outliers?
A value is considered an outlier if it falls below Q1 minus 1.5 times the IQR (the lower fence) or above Q3 plus 1.5 times the IQR (the upper fence). This is called the 1.5 IQR rule and is the standard method used in box plots. Values beyond 3 times the IQR from the quartiles are sometimes called extreme outliers.
What is the difference between IQR and standard deviation?
Both measure data spread, but they differ in approach. Standard deviation accounts for every value in the data set and is sensitive to outliers. IQR only measures the range of the middle 50% and ignores extreme values entirely. For skewed distributions or data with outliers, IQR is generally a more reliable measure of spread.
How many data points do I need to calculate IQR?
You need at least 4 data points to calculate meaningful quartiles. With fewer than 4 values, there are not enough data points to divide into lower and upper halves. Larger data sets produce more stable and meaningful quartile values.
Does the method for calculating quartiles vary?
Yes, there are several methods for computing quartiles, and different textbooks and software may produce slightly different results for small data sets. This calculator uses the exclusive median method: for odd-sized data, the median value is excluded from both halves before computing Q1 and Q3. This is the method most commonly taught in introductory statistics courses.