Quartile and Interquartile Range (IQR) Calculator

Quartile and Interquartile Range (IQR) Calculator

Growing AI Skill PRO

Enter Calculation

Separate values with commas, spaces, tabs, or new lines. Negatives and decimals are allowed.

Formula

IQR=Q3−Q1where{x(1)≤⋯≤x(n)=sorted values of Data SetQ2=med(x(1),…,x(n))Q1=med(lower half of x)Q3=med(upper half of x)\begin{gathered} \text{IQR} = Q_3 - Q_1 \\[1.5em] \text{where}\quad \left\{ \begin{aligned} x_{(1)} \le \cdots \le x_{(n)} &= \text{sorted values of } \text{Data Set} \\ Q_2 &= \operatorname{med}\left(x_{(1)},\dots,x_{(n)}\right) \\ Q_1 &= \operatorname{med}\left(\text{lower half of } x\right) \\ Q_3 &= \operatorname{med}\left(\text{upper half of } x\right) \end{aligned} \right. \end{gathered}
Show calculation steps (2)
  1. Median of a Sorted List

    med(x(1),…,x(m))={x(m+12)m oddx(m2)+x(m2+1)2m even\operatorname{med}\left(x_{(1)},\dots,x_{(m)}\right) = \begin{cases} x_{\left(\frac{m+1}{2}\right)} & m \text{ odd} \\[0.6em] \dfrac{x_{\left(\frac{m}{2}\right)} + x_{\left(\frac{m}{2}+1\right)}}{2} & m \text{ even} \end{cases}

    Middle value when the count is odd, average of the two middle values when it is even

  2. Range, Minimum and Maximum

    Range=max⁡(Data Set)−min⁡(Data Set)\text{Range} = \max\left(\text{Data Set}\right) - \min\left(\text{Data Set}\right)

    Range is the largest value minus the smallest value of the sorted data set

Usage stats

Advertisement

Results

Interquartile Range (IQR)
5
First Quartile (Q1) 3
Second Quartile (Q2) 5.5
Third Quartile (Q3) 8
Median (x-tilde) 5.5
Minimum (Min) 1
Maximum (Max) 10
Range (R) 9
Count (n) 10

Report an error on this page

What This Calculator Does

This tool takes any list of numbers and returns the three quartiles (Q1, Q2, Q3), the interquartile range (IQR), the median, the minimum, the maximum, and the range. Quartiles split a sorted data set into four equal parts, and the IQR measures how spread out the middle half of your data is - a robust measure of variability that is not distorted by outliers.

How to Use It

Paste or type your values into the box. You can separate them with commas, spaces, tabs, or new lines, so copying a column straight from a spreadsheet works fine. Negative numbers and decimals are supported, and any non-numeric tokens are ignored. Then read off the results: the IQR is highlighted, with all the other statistics in the table below.

Box-and-whisker plot showing min, Q1, median, Q3, max and the IQR span
The IQR is the width of the box, the distance from Q1 to Q3.

The Method (Median-Exclusive)

This page uses the Moore & McCabe "exclusive" method. First the data is sorted. The median (Q2) is the middle value, or the average of the two middle values for an even count. The data is then split into a lower and an upper half. Key rule: when the count is odd, the median value itself is excluded from both halves. Q1 is the median of the lower half and Q3 is the median of the upper half. Finally $$\text{IQR} = Q_3 - Q_1.$$ Other tools (Excel's QUARTILE.INC, Tukey hinges) may give slightly different quartiles because they use different conventions.

Advertisement

Worked Example

Data: 2, 4, 4, 5, 6, 7, 8 (\(n = 7\), odd). Sorted already. Min = 2, Max = 8, Range = 6. Median (Q2) = 5. Lower half excluding the median = [2, 4, 4], whose median is 4, so \(Q_1 = 4\). Upper half = [6, 7, 8], whose median is 7, so \(Q_3 = 7\). Therefore $$\text{IQR} = 7 - 4 = 3.$$

A sorted number line split into four equal quarters at Q1, Q2 and Q3
The three quartiles divide an ordered data set into four equal parts.

FAQ

Why exclude the median for odd counts? It is the convention used by Moore & McCabe and many introductory statistics courses, producing quartiles that fall on actual data points more often.

Can the IQR be used to find outliers? Yes. A common rule flags values below \(Q_1 - 1.5 \times \text{IQR}\) or above \(Q_3 + 1.5 \times \text{IQR}\) as potential outliers.

Why does my answer differ from Excel? Excel's QUARTILE.INC uses linear interpolation (the inclusive method), which can give fractional quartiles between data points. This calculator uses the exclusive method instead.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators