Quartile and Interquartile Range (IQR) Calculator

Type or paste a list of numbers to find its quartiles (Q1, the median and Q3) and the interquartile range (IQR), the spread of the middle half of your numbers. A box plot shows the shape of the data and marks any outliers.

Separate numbers with commas, spaces or new lines. A comma always separates, so type 1200, not 1,200.

CDC / NIST is the same as Excel’s QUARTILE.EXC. Methods differ slightly; your class or software may use another. NIST says there is no single agreed way.

Interquartile range (IQR)
7.75

The middle half of the numbers lies between 6.75 and 14.5, a spread of 7.75.

Q1 (25th percentile) 6.75
Median 10
Q3 (75th percentile) 14.5
049

Possible outlier: 27. Far outlier: 49.

What is a quartile?

Quartiles split a list of numbers, in order, into four parts with about a quarter of the numbers in each. The first quartile (Q1) is the 25th percentile, the median is the middle, and the third quartile (Q3) is the 75th percentile. Together with the smallest and largest numbers they make the five-number summary.

Source CDC · Principles of Epidemiology, Lesson 2, Section 7: Measures of spread (quartiles and interquartile range) ↗

What is the interquartile range (IQR)?

The interquartile range is Q3 minus Q1: the spread of the middle half of the numbers. It leaves out the lowest and highest quarters, so one very large or very small number hardly changes it. That makes it a good measure of spread to use with the median.

Source NIST/SEMATECH e-Handbook · 1.3.5.6 Measures of scale ↗

How to calculate quartiles

IQR = Q3 − Q1, with Q1 at position (n + 1) ÷ 4 and Q3 at position 3(n + 1) ÷ 4 in the sorted list

Here it is with your numbers:

  1. Put the 30 numbers in order, from 0 to 49.
  2. Q1 is at position (30 + 1) ÷ 4, which is 7.75: 0.75 of the way from the 7th number (6) to the 8th (7).
  3. Q1 = 6 + 0.75 × (7 − 6)
  4. Q1 = 6.75
  5. Q3 is at position 3 × (30 + 1) ÷ 4, which is 23.25: 0.25 of the way from the 23rd number (14) to the 24th (16).
  6. Q3 = 14 + 0.25 × (16 − 14)
  7. Q3 = 14.5
  8. IQR = 14.5 − 6.75
  9. IQR = 7.75

It means about a quarter of the numbers are below 6.75, about a quarter are above 14.5, and the middle half spans 7.75.

NIST notes that there is no single agreed way to find quartiles, so different methods can give slightly different answers. This page uses the CDC and NIST method, which is the same as Excel’s QUARTILE.EXC; QUARTILE.INC uses positions (n − 1) ÷ 4 + 1 instead. Many classes use another method again, taking the median of each half, which can also give a slightly different Q1 and Q3.

In Excel, =QUARTILE.EXC(A1:A30,1) gives Q1 and =QUARTILE.EXC(A1:A30,3) gives Q3 by this method.

Source NIST/SEMATECH e-Handbook · 7.2.6.2 Percentiles ↗Microsoft Support · QUARTILE.EXC function ↗Microsoft Support · QUARTILE.INC function ↗Microsoft Support · PERCENTILE.EXC function (when it shows #NUM!) ↗

Five-number summary and fences

MeasureValueHow it’s found
Minimum0The smallest number
Q16.75Position 7.75
Median10Position 15.5
Q314.5Position 23.25
Maximum49The largest number
Interquartile range7.75Q3 − Q1
Inner fences−4.875 – 26.125Q1 − 1.5 × IQR to Q3 + 1.5 × IQR
Outer fences−16.5 – 37.75Q1 − 3 × IQR to Q3 + 3 × IQR

How to find outliers with the IQR

NIST’s box plot rule sets fences beyond the quartiles. A number more than 1.5 × IQR below Q1 or above Q3 is a possible outlier; more than 3 × IQR is a far outlier. In the box plot, the lines (whiskers) reach the furthest numbers inside the inner fences, possible outliers are small circles and far outliers are large circles. An outlier is worth checking, not deleting: it may be a typing mistake or a real, unusual value.

Source NIST/SEMATECH e-Handbook · 1.3.3.7 Box plot (box plots with fences) ↗

Quartile examples

NumbersQ1, Q3 and IQR
Hospital stays of 30 patients (CDC)6.75, 14.5 · IQR 7.75
6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 (QUARTILE.EXC)15, 43 · IQR 28
1, 2, 4, 7, 8, 9, 10, 12 (QUARTILE.INC)3.5, 9.25 · IQR 5.75
27, 31, 15, 30, 22 (days)18.5, 30.5 · IQR 12

FAQs

What is a quartile?

Quartiles are the three values that split numbers in order into four parts, each holding about a quarter of them. The first quartile (Q1) is the 25th percentile, the second is the median, and the third quartile (Q3) is the 75th percentile.

Source CDC · Principles of Epidemiology, Lesson 2, Section 7: Measures of spread (quartiles and interquartile range) ↗

How do you find quartiles?

Put the numbers in order. Q1 is at position (n + 1) ÷ 4 and Q3 at 3(n + 1) ÷ 4, where n is how many numbers there are. If a position falls between two numbers, go that fraction of the way from the lower one to the higher one.

What are the lower and upper quartiles?

The lower quartile is Q1 and the upper quartile is Q3. The box in a box plot runs from the lower quartile to the upper quartile, with a line at the median.

Source NIST/SEMATECH e-Handbook · 1.3.3.7 Box plot (box plots with fences) ↗

How do you find the interquartile range (IQR)?

Subtract Q1 from Q3. For the CDC’s hospital stay data, Q3 is 14.5 days and Q1 is 6.75 days, so the interquartile range is 7.75 days.

Source CDC · Principles of Epidemiology, Lesson 2, Section 7: Measures of spread (quartiles and interquartile range) ↗

Sources

Related calculators