Quartile Calculator
The first and third quartiles, median, interquartile range, five-number summary and 1.5 × IQR outlier fences of a data set, by linear interpolation, nearest rank or Tukey’s hinges.
Result
Quartiles: Q1 = 4, median = 4.5, Q3 = 5.5
Exact arithmetic on the values entered. Quartile methods differ, so compare only results found the same way.
- First quartile, Q1
- 4
- Median
- 4.5
- Third quartile, Q3
- 5.5
- Interquartile range, IQR
- 1.5
- Five-number summary: minimum, Q1, median, Q3, maximum
- 2, 4, 4.5, 5.5, 9
- Lower inner fence, Q1 − 1.5 × IQR
- 1.75
- Upper inner fence, Q3 + 1.5 × IQR
- 7.75
- Lower outer fence, Q1 − 3 × IQR
- -0.5
- Upper outer fence, Q3 + 3 × IQR
- 10
- Between the inner and outer fences (mild outliers)
- 9
- Beyond the outer fences (extreme outliers)
- None
- Count
- 8
https://calcgallery.com/statistics/quartile-calculator/
Results follow the mathematical operation and values shown. Check that you selected the intended operation, convention and dataset type before relying on the result. Read the full disclaimer
How to use the Quartile Calculator
- Choose the method your course, software or report uses. Spreadsheets use linear interpolation; many textbooks and box plots use Tukey's hinges.
- Enter the data, one value per row.
- Read Q1, the median and Q3, the interquartile range, the five-number summary and the fences that flag unusual values.
The three methods
linear Q at position p × (n − 1) in the sorted data, interpolating between neighboursnearest rank Q = the value at rank ⌈p × n⌉Tukey hinges Q1 = median of the lower half, Q3 = median of the upper half (the middle value counts in both halves when n is odd)IQR = Q3 − Q1fences Q1 − 1.5 × IQR and Q3 + 1.5 × IQR (inner), Q1 − 3 × IQR and Q3 + 3 × IQR (outer)
Here p is 0.25 for Q1 and 0.75 for Q3, and n is the number of values. The median in every method is the ordinary middle value, or the average of the two middle values.
Why the IQR
The interquartile range is the spread of the middle half of the data. Unlike the range or the standard deviation, one extreme value barely moves it, which is why it is used to set the fences.
What the diagram shows
A box from Q1 to Q3 with the median as a thick line, whiskers reaching the furthest values inside the inner fences, and the fences dashed. Each value is a dot beneath; a hollow dot lies beyond a fence.
With your numbers
- Sorted: 2, 4, 4, 4, 5, 5, 7, 9
- IQR = Q3 − Q1 = 5.5 − 4 = 1.5
- Inner fences = 4 − 1.5 × 1.5 and 5.5 + 1.5 × 1.5 = 1.75 and 7.75
Quick reference
Exact arithmetic on the values entered. Quartile methods differ, so compare only results found the same way.
| Example | Quartiles |
|---|---|
| 2 to 9, linear | Q1 = 4, median = 4.5, Q3 = 5.5 |
| 2 to 9, nearest rank | Q1 = 4, median = 4.5, Q3 = 5 |
| 2 to 9, Tukey’s hinges | Q1 = 4, median = 4.5, Q3 = 6 |
| Eleven values, 6 to 49, linear | Q1 = 25.5, median = 40, Q3 = 42.5 |
| 1 to 10, Tukey’s hinges | Q1 = 3, median = 5.5, Q3 = 8 |
| 1 to 9 and 50, linear | Q1 = 3.25, median = 5.5, Q3 = 7.75 |
Common questions about the Quartile Calculator
- Why do different calculators give different quartiles?
- There is no single agreed definition. Hyndman and Fan catalogued nine in use in statistical software. On 2, 4, 4, 4, 5, 5, 7, 9 the linear method gives Q3 = 5.5, nearest rank gives 5, and Tukey’s hinges give 6. All three are correct under their own rule, and the differences shrink as the data set grows. Use the method your course or software uses, and say which one you used.
- How are Tukey’s hinges found?
- Split the sorted data into a lower and an upper half, counting the median in both halves when there is an odd number of values, and take the median of each half. For an odd number of values the hinges equal the linear quartiles; for an even number they can differ. They are what a hand-drawn box plot uses.
- What are the fences?
- Lines 1.5 interquartile ranges below Q1 and above Q3 (the inner fences) and 3 IQRs out (the outer fences). The NIST/SEMATECH handbook calls a value between the inner and outer fence a mild outlier and one beyond the outer fence an extreme outlier. A value beyond a fence deserves a second look; it is not automatically a mistake, and this page never removes it.
- How does this relate to percentiles?
- Q1, the median and Q3 are the 25th, 50th and 75th percentiles. The percentile calculator finds the value at any percentile by the linear and nearest-rank methods used here, and the percentile rank of a value.