# IQR Calculator - Interquartile Range

Created by Steven Wooding
Reviewed by Bogna Szyk and Jack Bowater
Last updated: Jun 05, 2023

This IQR calculator finds the interquartile range of a set of up to 50 values, helping you understand the spread and distribution of your dataset. The article below explains the interquartile range definition, how to find the interquartile range using the IQR formula, and shows a fully worked example of calculating the interquartile range.

## What is interquartile range? - What is IQR?

You may have heard the term interquartile range and asked yourself, "What is interquartile range anyway?". The interquartile range (IQR) of a dataset tells us how bunched up or spread out its values are (it's a measure of variability). Other names you may come across for IQR include midspread, middle 50%, and H-spread.
An important use for IQR is in calculating the dataset's upper and lower fence, which indicates which of the dataset's values are outliers. You can read more about them in the upper and lower fence calculator and the outlier calculator, respectively.

IQR is the difference between the 75th percentile (upper quartile - $Q_3$) and the 25th percentile (lower quartile - $Q_1$). Therefore the IQR formula is:

$\mathrm{IQR} = Q_3 - Q_1$

This equation is how to calculate IQR and is the interquartile range definition. On a box plot, the IQR is shown as the main body of the plot (the box's height). Here is an example of a box plot to demonstrate:

Here's another way to explain the upper and lower quartile values. The data is first divided in half at the median point. Take the lower part of the dataset and find its median value. That's the lower quartile value, $Q_1$. To find the upper quartile, $Q_3$, take the upper part of the data and find its median.

Don't confuse the interquartile range with the similarly named range of a dataset. The range is the difference between the maximum and minimum values - as explained in the range calculator.

So, now that we've answered the question "What is interquartile range?", let's find out how to calculate it from a set of raw numbers.

## How to find the interquartile range? - How to calculate IQR?

To find the interquartile range, we first have to find the upper and lower quartile values. This task isn't as straightforward as you would think, as Wikipedia lists and the R programming language implements .

🙋 The 5 number summary calculator explains the upper and lower quartiles using a practical example, which may make it easier to grasp.

In this IQR calculator, we use method 4 listed on Wikipedia, which interpolates between data values. This interpolation is required if the quartile points fall between values in the dataset.

The first step in finding a quartile is to sort the data into numerical order. This sorting is required for all the different methods.

The second step is to calculate the rank of the upper and lower quartiles, using the following equations:

$\small \mathrm{LQR} = \frac{1}{4}(N+1)$
$\small \mathrm{UQR} = \frac{3}{4}(N+1)$

where:

• $N$ - The number of values in the dataset;
• $\mathrm{LQR}$ - Lower quartile rank; and
• $\mathrm{UQR}$ - Upper quartile rank.

If the rank is a whole number, then the quartile is simply the corresponding value. For example, if the LQR result is 3, then the lower quartile is the 3rd value in the ranked list of values.

However, it is likely that the rank result will be a decimal number and therefore will not match up to a value from the dataset. The interpolation method takes the fractional component of the rank and multiplies it by the difference between the value corresponding to the whole number of the rank and the next ranking value. In equation form, finding the lower quartile looks like this:

\small \begin{aligned} Q_1 &= x_{\mathrm{LQR_{int}}} \\ &+ \mathrm{LQR_{frac}}(x_{\mathrm{LQR_{int+1}}} - x_{\mathrm{LQR_{int}}}) \end{aligned}

where:

• $x$ is a value from the ranked list with the subscript indicating the rank;
• $\mathrm{LQR_{int}}$ is the whole number part of the LQR; and
• $\mathrm{LQR_{frac}}$ is the decimal fraction (the part after the decimal point) of the LQR.

The formula for $Q_3$ is similarly:

\small \begin{aligned} Q_3 &= x_{\mathrm{UQR_{int}}} \\ &+ \mathrm{UQR_{frac}}(x_{\mathrm{UQR_{int+1}}} - x_{\mathrm{UQR_{int}}}) \end{aligned}

It's probably best to illustrate these equations with a simple interquartile range example calculation. Let's say a ranked dataset consists of the values $5, 7, 8, 9$, and we would like to find the lower quartile. The lower quartile rank is first calculated by:

\small \begin{aligned} \mathrm{LQR} &= \frac{1}{4}(N+1) \\ &= \frac{4+1}{4} = 1.25 \end{aligned}

Therefore, $\mathrm{LQR_{int}}$ is $1$ and $\mathrm{LQR_{frac}}$ is $0.25$. We can now plug these numbers into the equation for $Q_1$:

\small \begin{aligned} Q_1 &= x_1 + 0.25(x_2 - x_1) \\ &= 5+ 0.25(7 - 5) = 5.5 \end{aligned}

So, we now have a value for the lower quartile range - $5.5$. Now we use the same method to find the upper quartile:

\small \begin{aligned} \mathrm{UQR} &= \frac{3}{4}(N+1) \\ &= \frac{3}{4} (4 + 1) = 3.75 \end{aligned}
\small \begin{aligned} Q_3 &= x_3 + 0.75(x_4 - x_3) \\ &= 8+ 0.75(9 - 8) = 8.75 \end{aligned}

Having found values for $Q_1$ and $Q_3$, we can calculate the interquartile range using the IQR formula:

\small \begin{aligned} \mathrm{IQR} &= Q_3 - Q_1 \\ &=8.75 - 5.5 = 3.25 \end{aligned}

## How to use this calculator to find the IQR

Using this calculator to find the interquartile range of a dataset of up to 50 values is super easy.

1. Enter the values from the dataset, one value per row. The calculator requires a minimum of four values before a result is displayed.
2. As you enter the values, rows will magically appear for you to add another value.
3. Once you have entered a minimum of four values, the results for interquartile range (IQR), Q1, and Q3 are instantly displayed. They will update as you enter more data values.
Steven Wooding
Data (enter 4 to 50 values)
Value 1
Value 2
Value 3
Value 4
Show step-by-step solution?
No
People also viewed…

### Central limit theorem

The central limit theorem calculator allows you to calculate the sample mean and the sample standard deviation for the given population distribution and sample size.

### Flat vs. round Earth

Omni's not-flat Earth calculator helps you perform three experiments that prove the world is round.

### Helium balloons

Wondering how many helium balloons it would take to lift you up in the air? Try this helium balloons calculator! 🎈

### Permutation without repetition

Count exactly what the name says with our permutation without repetition calculator!