Omni Calculator logo

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 - Q3Q_3) and the 25th percentile (lower quartile - Q1Q_1). Therefore the IQR formula is:

IQR=Q3Q1\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:

Box plot example showing upper quartile, lower quartile and the interquartile range
Ever.chae / CC BY-SA

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, Q1Q_1. To find the upper quartile, Q3Q_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 four methods and the R programming language implements nine different ways.

🙋 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:

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

where:

  • NN - The number of values in the dataset;
  • LQR\mathrm{LQR} - Lower quartile rank; and
  • UQR\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:

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

where:

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

The formula for Q3Q_3 is similarly:

Q3=xUQRint+UQRfrac(xUQRint+1xUQRint)\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,95, 7, 8, 9, and we would like to find the lower quartile. The lower quartile rank is first calculated by:

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

Therefore, LQRint\mathrm{LQR_{int}} is 11 and LQRfrac\mathrm{LQR_{frac}} is 0.250.25. We can now plug these numbers into the equation for Q1Q_1:

Q1=x1+0.25(x2x1)=5+0.25(75)=5.5\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.55.5. Now we use the same method to find the upper quartile:

UQR=34(N+1)=34(4+1)=3.75\small \begin{aligned} \mathrm{UQR} &= \frac{3}{4}(N+1) \\ &= \frac{3}{4} (4 + 1) = 3.75 \end{aligned}
Q3=x3+0.75(x4x3)=8+0.75(98)=8.75\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 Q1Q_1 and Q3Q_3, we can calculate the interquartile range using the IQR formula:

IQR=Q3Q1=8.755.5=3.25\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
Check out 44 similar descriptive statistics calculators 📊
5 number summary5★ rating averageCoefficient of variation… 41 more
People also viewed…

Alien civilization

The alien civilization calculator explores the existence of extraterrestrial civilizations by comparing two models: the Drake equation and the Astrobiological Copernican Limits👽

Books vs e-books

Discover the ultimate paper books vs. e-books calculator. Make an informed choice with our handy tool. Find out which is best for the environment!

Constant of proportionality

Our constant of proportionality calculator can help you to calculate the ratio that relates two dependable given values.

Exponential distribution

The exponential distribution calculator finds out the probability of a certain amount of time elapsing between two events.
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service