Skip to content
Statistics

Quartile Calculator

Find every quartile statistic for any dataset in one step. Enter comma-separated numbers to get Q1, the median (Q2), Q3, the interquartile range, quartile deviation, Tukey outlier fences, and a full five-number summary. Choose your preferred calculation method and see step-by-step working.

Your details

Enter values separated by commas or spaces. Spaces and non-numeric entries are ignored. You can enter negative numbers and decimals.
Inclusive uses linear interpolation and matches Excel and NumPy. Exclusive uses the (n+1)p formula favored by many textbooks and TI graphing calculators. Results differ on small datasets.
Show the lower and upper fences (Q1 - 1.5 IQR and Q3 + 1.5 IQR) and flag any values in your dataset that fall outside them.
Interquartile range (IQR)
7
First quartile (Q1)7
Median (Q2)12
Third quartile (Q3)14
Quartile deviation (QD)3.5
Coefficient of quartile deviation0.3333
Tukey lower fence-3.5
Tukey upper fence24.5
Mean (average)11.2222
Range18
Minimum3
Maximum21
Count of values9
Suspected outliers0
Q1 (25th pct)7
Q2 / Median12
Q3 (75th pct)14
IQR (spread)7

Q1 = 7, median = 12, Q3 = 14, IQR = 7.

  • The quartiles divide your 9 values into four equal groups: 25% fall below Q1 (7), 50% below the median (12), and 75% below Q3 (14).
  • The middle 50% of your data spans 7 to 14, a width of 7 (the IQR). The quartile deviation is 3.5.
  • The mean (11.2222) is below the median, suggesting the data may be skewed left (negative).
  • No values fall outside the Tukey fences (-3.5 to 24.5), so there are no suspected outliers.

Next stepUse Q1, Q2, Q3, the minimum, and the maximum to draw a box-and-whisker plot. Points beyond the Tukey fences are conventionally plotted as individual dots.

Formula

Inclusive: Qp=sorted[p(n1)]Exclusive: Qp=sorted[(n+1)p1]IQR=Q3Q1QD=IQR2\text{Inclusive: } Q_p = \text{sorted}[p(n-1)] \qquad \text{Exclusive: } Q_p = \text{sorted}[(n+1)p - 1] \qquad \text{IQR} = Q_3 - Q_1 \qquad \text{QD} = \tfrac{\text{IQR}}{2}

Worked example

For 3, 5, 7, 8, 12, 13, 14, 18, 21 (n = 9, sorted): using the inclusive method, Q2 is at rank 0.5 × 8 = 4 (0-based), the 5th value, so Q2 = 12. Q1 is at rank 0.25 × 8 = 2, the 3rd value, so Q1 = 7. Q3 is at rank 0.75 × 8 = 6, the 7th value, so Q3 = 14. IQR = 14 - 7 = 7. Quartile deviation = 3.5. Lower fence = 7 - 10.5 = -3.5; upper fence = 14 + 10.5 = 24.5, so no outliers.

What quartiles are and why they matter

Quartiles are three cut points that divide a sorted dataset into four parts, each containing roughly a quarter of the values. The first quartile (Q1) marks the 25th percentile: a quarter of the data falls below it. The second quartile (Q2) is the median, splitting the data in half. The third quartile (Q3) marks the 75th percentile, with three-quarters of the data below it. Together they describe the center, spread, and shape of your data far better than a single average can, because they reveal where the data clusters and how symmetrically it is distributed.

IQR, quartile deviation, and the five-number summary

The interquartile range (IQR = Q3 - Q1) is the width covered by the middle 50% of your data. Because it ignores the extreme quarter at each end, it is resistant to outliers: one very large or very small value barely changes the IQR, even though it can drastically change the ordinary range. The quartile deviation (QD = IQR / 2) is a compact measure of spread used in many textbook formulas. The coefficient of quartile deviation (CQD = (Q3 - Q1) / (Q3 + Q1)) normalizes the spread relative to the scale, letting you compare variability across datasets measured in different units. Together with the minimum and maximum, Q1, Q2, and Q3 form the five-number summary that underpins the box-and-whisker plot.

Tukey outlier fences

John Tukey introduced a simple rule for flagging unusual values: compute the lower fence as Q1 - 1.5 × IQR and the upper fence as Q3 + 1.5 × IQR. Any data point outside these fences is a suspected outlier and is plotted as an individual dot on a box plot rather than as part of the whisker. A stricter version uses 3 × IQR for extreme outliers. The fences are not a definitive test: they flag values for closer inspection, but subject-matter knowledge should always guide whether a value is truly erroneous or simply unusual.

Inclusive versus exclusive quartile methods

There is no single universally agreed-upon way to compute quartiles, and different software tools use different conventions, which is why two calculators can give different answers on the same data. The inclusive method (used here by default) applies linear interpolation at position p × (n - 1) in the zero-indexed sorted list. It matches Excel QUARTILE.INC, NumPy, and Pandas. The exclusive method uses position (n + 1) × p and is used by TI-83/84 graphing calculators and some statistics textbooks (Mendenhall and Sincich). Both methods give identical Q1 and Q3 when n is a multiple of 4; for other sample sizes they can differ by a small fraction. They always agree on the median. This calculator lets you switch between both to match your course or software.

Five-number summary reference

StatisticSymbolValue (default data)What it marks
MinimumMin3Smallest value (or lower whisker tip)
First quartileQ1725th percentile, bottom of the box
MedianQ21250th percentile, line inside the box
Third quartileQ31475th percentile, top of the box
MaximumMax21Largest value (or upper whisker tip)
IQRQ3 - Q17Box width, middle 50% of data
Lower fenceQ1 - 1.5 IQR-3.5Below this = suspected outlier
Upper fenceQ3 + 1.5 IQR24.5Above this = suspected outlier

The five statistics needed to draw a box-and-whisker plot for the default dataset.

Frequently asked questions

Why does my quartile answer differ from another calculator?

There are several accepted methods for computing quartiles. This calculator offers two: the inclusive method (linear interpolation matching Excel QUARTILE.INC and NumPy) and the exclusive method used by TI-83/84 calculators and some textbooks. On small datasets these give noticeably different Q1 and Q3 values. All methods agree on the median (Q2). To match your textbook, check which method it uses and select it in the dropdown.

What is the interquartile range (IQR) used for?

The IQR measures the spread of the middle half of your data and is resistant to outliers. It is used to draw the box in a box-and-whisker plot and to detect outliers with the Tukey fence rule: values below Q1 - 1.5 × IQR or above Q3 + 1.5 × IQR are flagged as unusual. The IQR is also the basis of the quartile deviation (IQR / 2) and the coefficient of quartile deviation.

What is quartile deviation and when is it useful?

Quartile deviation (QD = IQR / 2) is half the interquartile range. It represents the average distance from the median to Q1 and Q3, giving a single-number summary of how spread out the middle of the data is. The coefficient of quartile deviation (QD / average of Q1 and Q3) is a dimensionless version useful for comparing spread across datasets measured in different units, similar to how the coefficient of variation relates to the mean.

How do I use quartiles to find outliers?

Use the Tukey fence method: compute the lower fence as Q1 minus 1.5 times the IQR and the upper fence as Q3 plus 1.5 times the IQR. Any data point below the lower fence or above the upper fence is a suspected outlier. For stricter detection, use 3 times the IQR instead of 1.5. This calculator shows both fences and counts how many of your values fall outside them when the outlier toggle is on.

Can I use this calculator for decimals, negatives, or large datasets?

Yes. Quartiles work with any real numbers: enter decimals, negative numbers, or any mix. Values do not need to be pre-sorted; the calculator sorts them automatically. Separate values with commas or spaces. There is no hard limit on dataset size.

What is the five-number summary?

The five-number summary is the set of statistics: minimum, Q1, median (Q2), Q3, and maximum. These five values contain all the information needed to draw a box-and-whisker plot. They describe the full range, the center, and the spread of the middle half of the data, and they give a quick visual impression of skewness (if the median is not centered inside the box, the data is skewed).

Sources

Written by Dr. Hannah Brandt, PhD Statistician · Munich, Germany

Applied statistician translating rigorous probability theory into clear, accurate tools for researchers and practitioners.

Search 3,500+ calculators

Loading search…