Quartiles divide sorted data into four groups of equal size. A quarter of the values lie below Q1, half lie below the median Q2 and three quarters lie below Q3. Together they describe both the centre and the spread of the data without being disturbed by a few extreme values, which is why test results, salaries and waiting times are often reported with quartiles.
The distance between the outer quartiles, the interquartile range, measures how widely the middle half of the data is spread. Half of it, the quartile deviation (semi-interquartile range), is a robust counterpart of the standard deviation. Fences 1.5 × IQR beyond the quartiles are the standard rule for spotting outliers.
Textbooks, calculators and spreadsheets do not all compute quartiles the same way, so this calculator lets you choose: the median-of-halves rule taught in most courses, Excel’s inclusive and exclusive formulas, or Tukey’s hinges. The working box lists the halves or positions used.
How to use the Quartile and IQR Calculator
- Data set
- Quartile method
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The data are sorted and the median is found. With the halves methods, Q1 and Q3 are the medians of the lower and upper halves; with the interpolation methods they are read at fractional positions in the sorted list. The IQR, quartile deviation and fences follow from Q1 and Q3.
Worked example
Data: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 (n = 11). The median is the 6th value, 40. The lower half 6, 7, 15, 36, 39 has median 15 = Q1, and the upper half 41, 42, 43, 47, 49 has median 43 = Q3. IQR = 43 − 15 = 28 and the quartile deviation is 14. The fences are 15 − 42 = −27 and 43 + 42 = 85, so no value is an outlier even though 6 and 7 sit far below the rest. The long lower whisker shows the left skew.
Quartile methods compared
Statistics packages do not agree on one definition of a quartile. For the 10 values 68, 72, 75, 79, 81, 84, 86, 90, 93, 97 the four methods offered here give:
| Method | Used by | Q1 | Q3 | IQR |
|---|---|---|---|---|
| Median of halves (median excluded) | TI-84, most school textbooks | 75 | 90 | 15 |
| Linear interpolation, position 1 + (n − 1)p | Excel QUARTILE.INC, R type 7, Google Sheets | 76 | 89 | 13 |
| (n + 1)p positions | Excel QUARTILE.EXC, Minitab | 74.25 | 90.75 | 16.5 |
| Median of halves (median included) | Tukey’s hinges | 75 | 90 | 15 |
With an even number of values the two “halves” methods coincide; they differ only when n is odd. The differences shrink as the data set grows, so with a few hundred values the choice rarely matters.
Formula
Q1 = median of lower half · Q2 = median · Q3 = median of upper half · IQR = Q3 − Q1 · fences = Q1 − 1.5·IQR and Q3 + 1.5·IQR
Worked example
Inputs: Data set: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49; Quartile method: Median of halves, median excluded (TI-84, most textbooks).
Results: First quartile (Q1) = 15; Median (Q2) = 40; Third quartile (Q3) = 43; Interquartile range (IQR = Q3 − Q1) = 28; Quartile deviation (IQR ÷ 2) = 14; Lower fence (Q1 − k × IQR) = -27.
Key terms
- First quartile (Q1)
- The 25th percentile; a quarter of the data lie below it.
- Third quartile (Q3)
- The 75th percentile; three quarters of the data lie below it.
- Quartile deviation
- (Q3 − Q1) ÷ 2, also called the semi-interquartile range.
- Hinges
- Tukey's quartiles: medians of the halves including the median.
Frequently asked questions
How do you find quartiles?
Sort the data, find the median, then find the median of the lower half (Q1) and of the upper half (Q3).
What are the quartiles of 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49?
Q1 = 15, median = 40 and Q3 = 43, so IQR = 28.
Why do other tools give slightly different quartiles?
There are several definitions. Excel's QUARTILE.INC interpolates at position 1 + (n − 1)p and gives Q1 = 25.5 and Q3 = 42.5 for the example. Choose the method that matches your course or software.
Is the second quartile the median?
Yes. Q2 is always the median.
What is the quartile deviation?
Half the interquartile range, (Q3 − Q1)/2. For the example it is 14.
Do I include the median in the halves?
In the default method no (when n is odd). Tukey's hinges include it; pick that option if your textbook does.
What are quartiles used for?
Box plots, outlier detection, grading on a curve, income brackets and any summary of skewed data.
How many values do I need?
At least three, though quartiles become meaningful with about eight or more values.