Quartile Calculator
Calculate Q1, Q2 (median), Q3, IQR, and outlier bounds from any dataset.
Includes a 5-number summary chart and Tukey fence outlier detection.
Quartiles divide a sorted dataset into four equal parts.
- Q1 (First Quartile) — 25th percentile: 25% of values fall below this point
- Q2 (Second Quartile / Median) — 50th percentile: the middle value
- Q3 (Third Quartile) — 75th percentile: 75% of values fall below this point
IQR (Interquartile Range):
IQR = Q3 − Q1
The IQR measures the spread of the middle 50% of your data. A large IQR means data is spread out; a small IQR means it is tightly clustered.
Outlier detection — Tukey Fences:
Lower fence = Q1 − 1.5 × IQR
Upper fence = Q3 + 1.5 × IQR
Any value outside these fences is considered an outlier. Values beyond Q1 − 3×IQR or Q3 + 3×IQR are called extreme outliers.
How quartiles are calculated (exclusive method):
- Sort the data in ascending order
- Q2 = median of the full dataset
- For even n: lower half = first n/2 values, upper half = last n/2 values
- For odd n: exclude the median value, then find medians of each half
- Q1 = median of the lower half; Q3 = median of the upper half
Box-and-whisker plot: A box plot visualises the 5-number summary: Min, Q1, Median, Q3, Max. The box spans Q1 to Q3 (the IQR). Whiskers extend to the min/max within the fences. Points outside the fences are plotted individually as outliers.
Why use quartiles instead of mean/standard deviation? Quartiles are robust to outliers. If a dataset includes extreme values (like income data, where a few billionaires skew the mean), the median and IQR give a more representative picture of the typical value.
Worked example: Data: 4, 7, 8, 9, 12, 15, 18, 22, 23, 30
- Q2 (median of 10 values): (12 + 15) / 2 = 13.5
- Lower half: 4, 7, 8, 9, 12 → Q1 = 8
- Upper half: 15, 18, 22, 23, 30 → Q3 = 22
- IQR = 22 − 8 = 14
- Fences: −13 to 43 — no outliers in this dataset
Real-world uses:
- Test scores: find what score puts someone in the top 25%
- Income data: median income is more informative than mean income
- Stock returns: IQR shows typical variation without outlier distortion
- Medical data: reference ranges in blood tests are often expressed as percentiles