How it’s calculated
Quartiles split sorted data into four parts holding about a quarter of the values each. Q1 is the 25th percentile, the median (Q2) is the 50th, and Q3 is the 75th. The five-number summary (minimum, Q1, median, Q3, maximum) is what a box plot draws. The interquartile range, IQR = Q3 − Q1, is the spread of the middle half of the data.
Two methods. Quartile definitions are not universal:
- Median of halves (OpenStax and most textbooks): Q1 is the median of the lower half and Q3 the median of the upper half. With an odd count, the middle value is left out of both halves.
- Inclusive interpolation (Excel QUARTILE.INC, R type 7): the quartile sits at position (n − 1) × 0.25 (or 0.75) in the sorted list, counting from 0, and is interpolated between the two neighbors.
With very small data sets the halves method is blunt: for n = 2 or 3, Q1 is the minimum and Q3 is the maximum (n = 3: the halves are single values). Leaving the middle value out of both halves for an odd count is the convention used here; some books (Tukey's hinges) keep it in both halves, which can change Q1 and Q3.
The two usually agree on large data sets but can differ on small ones. Example: 1, 2, 3, 4, 5, 6, 7 (n = 7). Median of halves: the halves are 1, 2, 3 and 5, 6, 7, so Q1 = 2 and Q3 = 6. Inclusive: position 1.5 gives Q1 = 2.5 and position 4.5 gives Q3 = 5.5.
Example with the default data (OpenStax daytime class test scores, n = 20): five-number summary 32, 56, 74.5, 82.5, 99; IQR = 26.5; fences 16.25 and 122.25, so there are no outliers.
Frequently asked questions
Why does my answer differ from Excel or another calculator?
Different programs define quartiles differently. This calculator offers the textbook median-of-halves method and Excel’s QUARTILE.INC method. Pick the one your course or software uses. Tukey’s hinges, another variant, include the median in both halves when n is odd.
What counts as an outlier?
The common rule flags any value below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. It is a screening rule, not proof that a value is an error.
Do the numbers need to be sorted?
No. Enter them in any order and the calculator sorts them.
What is the difference between the IQR and the range?
The range is max − min and is thrown off by extreme values. The IQR covers only the middle 50% of the data, so it is much more resistant to outliers.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Introductory Statistics 2e, §2.3 Measures of the Location of the Data (quartiles, IQR, outliers) — OpenStax
- Introductory Statistics 2e, §2.4 Box Plots (five-number summary) — OpenStax
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.3.7 Box Plot — NIST
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator