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.
Formula
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
| Statistic | Symbol | Value (default data) | What it marks |
|---|---|---|---|
| Minimum | Min | 3 | Smallest value (or lower whisker tip) |
| First quartile | Q1 | 7 | 25th percentile, bottom of the box |
| Median | Q2 | 12 | 50th percentile, line inside the box |
| Third quartile | Q3 | 14 | 75th percentile, top of the box |
| Maximum | Max | 21 | Largest value (or upper whisker tip) |
| IQR | Q3 - Q1 | 7 | Box width, middle 50% of data |
| Lower fence | Q1 - 1.5 IQR | -3.5 | Below this = suspected outlier |
| Upper fence | Q3 + 1.5 IQR | 24.5 | Above 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).