Quartile Calculator
Calculate Q1, Q2, Q3, IQR, and the five-number summary from a data set.
Identify outliers and prepare data for box plot visualization.
What Are Quartiles?
Quartiles divide a sorted dataset into four equal parts. Each part contains 25% of the data. They are a fundamental tool in descriptive statistics for understanding how data is distributed.
- Q1 (First Quartile / 25th percentile): 25% of data falls below this value
- Q2 (Second Quartile / Median / 50th percentile): The middle value; 50% falls below
- Q3 (Third Quartile / 75th percentile): 75% of data falls below this value
How to Calculate Quartiles
Step 1: Sort the data from smallest to largest. Step 2: Find Q2 (the median of the full dataset). Step 3: Find Q1 (the median of the lower half, not including Q2 if N is odd). Step 4: Find Q3 (the median of the upper half, not including Q2 if N is odd).
Interquartile Range (IQR)
IQR = Q3 − Q1
The IQR is the range of the middle 50% of the data. It is a robust measure of spread — unlike range or standard deviation, it is not affected by extreme outliers.
The Five-Number Summary
The five-number summary provides a complete picture of a distribution:
- Minimum — smallest value (excluding outliers)
- Q1 — 25th percentile
- Median (Q2) — 50th percentile
- Q3 — 75th percentile
- Maximum — largest value (excluding outliers)
These five values define a box plot (box-and-whisker plot).
Identifying Outliers: Tukey’s Method
Any value outside the following fences is considered an outlier:
Lower Fence = Q1 − 1.5 × IQR
Upper Fence = Q3 + 1.5 × IQR
Values beyond 3.0 × IQR are called extreme outliers. John Tukey introduced this method in 1977.
Why Use Quartiles Instead of Mean/Standard Deviation?
Quartiles are robust to outliers. If your dataset includes a few extreme values (like income data, where billionaires skew the mean), the median and IQR give a more representative picture of the typical value than the mean and standard deviation.
Real-World Uses
- Test scores: Find what score is in the top 25% (above Q3)
- Income data: Median income is far more informative than mean income
- Stock returns: IQR shows the typical range of variation without outlier distortion
- Quality control: Track whether manufacturing measurements stay within quartile boundaries
- Medical data: Reference ranges in blood tests are often expressed as percentiles
Worked Example
Data: 4, 7, 8, 9, 12, 15, 18, 22, 23, 30
- Sorted: 4, 7, 8, 9, 12, 15, 18, 22, 23, 30
- Q2 (median): (12 + 15) / 2 = 13.5
- Q1 (median of lower half: 4,7,8,9,12): 8
- Q3 (median of upper half: 15,18,22,23,30): 22
- IQR = 22 − 8 = 14
- Fences: Lower = 8 − 21 = −13 | Upper = 22 + 21 = 43 — no outliers