Home ↓
CalculatorsVerified

Math & Geometry

Quartile, Median and Percentile Calculator (IQR, Outliers)

Find the median, quartiles and any percentile of a set of numbers. Quartiles split ordered data into four equal parts: the first quartile (Q1) has a quarter of the values below it, the median (Q2) half, and the third quartile (Q3) three quarters. The difference Q3 − Q1, called the interquartile range (IQR), measures the spread of the middle half of the data and, unlike the range, is not affected by extreme values. John Tukey’s rule flags values more than 1.5 times the IQR below Q1 or above Q3 as potential outliers, and the minimum, Q1, median, Q3 and maximum form the five-number summary drawn in a box plot. There are several accepted ways to calculate quartiles from a sample, which is why different calculators and textbooks sometimes disagree. This calculator offers the two most widely used: the inclusive method used by Excel’s PERCENTILE.INC and QUARTILE.INC and by default in R (Hyndman and Fan type 7), and the exclusive method used by Excel’s PERCENTILE.EXC (type 6). Paste your data separated by spaces, commas or new lines, choose a method and a percentile.

How to use this calculator

  1. Enter or paste your numbers, separated by spaces, commas or new lines.
  2. Choose the inclusive or exclusive method.
  3. Enter a percentile to find, for example 90.
  4. Read the median, quartiles, IQR and the percentile.
  5. Check the outliers and the five-number summary.

Why use quartiles

The median and IQR describe the centre and spread of data without being distorted by a few extreme values, which makes them well suited to skewed data such as incomes, house prices or response times.

Percentiles are widely used to report results, for example the 90th percentile of delivery times or a child’s growth percentile, and to set thresholds for service levels.

Outliers

The 1.5 × IQR rule is a screening tool, not proof that a value is wrong. A flagged value may be a data-entry error, a measurement problem or a genuine but unusual observation.

Before removing outliers, investigate their cause; excluding valid data can bias the results.

Formula & method

Sort the values from smallest to largestInclusive (type 7): position h = (n − 1) × p, interpolate between the values around hExclusive (type 6): position h = (n + 1) × p, interpolate between the values around hIQR = Q3 − Q1; outliers are values below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR

Sort the n values x(1) ≤ … ≤ x(n). Inclusive method (Hyndman–Fan type 7, Excel PERCENTILE.INC): h = (n − 1)·p + 1, and the p-th quantile is x(⌊h⌋) + (h − ⌊h⌋) × (x(⌊h⌋+1) − x(⌊h⌋)). Exclusive method (type 6, Excel PERCENTILE.EXC): h = (n + 1)·p, interpolated the same way, with values outside the data range set to the minimum or maximum. Q1 uses p = 0.25, the median p = 0.5 and Q3 p = 0.75. IQR = Q3 − Q1. Lower fence = Q1 − 1.5 × IQR; upper fence = Q3 + 1.5 × IQR; values outside the fences are flagged as potential outliers. With an odd number of values, the median is the middle value; with an even number, the average of the two middle values, in both methods.

Worked example

Data 1, 2, 3, 4, 5, 6, 7, 8

  1. Inclusive Q1: h = 7 × 0.25 + 1 = 2.75, so Q1 = 2 + 0.75 × (3 − 2) = 2.75.
  2. Exclusive Q1: h = 9 × 0.25 = 2.25, so Q1 = 2 + 0.25 × (3 − 2) = 2.25.
  3. Median in both methods = (4 + 5) ÷ 2 = 4.5.

Answer: Q1 is 2.75 (inclusive) or 2.25 (exclusive); the median is 4.5.

Frequently asked questions

What is the interquartile range?

Q3 minus Q1, the spread of the middle 50% of the data.

How are outliers identified?

Values more than 1.5 × IQR below Q1 or above Q3.

Why do quartile methods differ?

Statisticians use several interpolation rules; Excel offers inclusive and exclusive versions.

Which method should I use?

Use the method your course, software or report specifies; inclusive is the most common default.

Is the median the 50th percentile?

Yes.

What is the five-number summary?

Minimum, Q1, median, Q3 and maximum.