# Calculate the lower and upper quartiles

Enter the values, separated by spaces or line breaks, to calculate the quartiles.

The quartiles are three values that divide an ordered set of numbers into four equally sized parts. These values are usually called the upper quartile, median, and lower quartile, and are abbreviated as Q1, Q2 and Q3. The difference between the upper and lower quartile is called the interquartile range.

The median (Q2) is calculated as usual by first ordering the values, from smallest to largest, and then looking at the middle values. If the number of values is odd there is only one middle number, which is the median. If the number of values is even there are two middle numbers, in which case the median is the mean (average) of these two values.

The lower and upper quartiles (Q1 and Q3) can be calculated by using the median to divide the values into two equally sized groups. The first group contains values that are smaller than or equal to the median. The second group contains values that are larger than or equal to the median. Note that for an odd number of values the middle value, representing the median, should not be part of any of these groups. The lower quartile is the median of the first group. Similarly, the upper quartile is the median of the second group.

Example:
Calculate the quartiles for the values 8, 1, 18, 3, 8, 12 and 10.

First the values need to be sorted.

1 3 8 8 10 12 18

The middle value is the median. This means that the median (Q2) is equal to 8.

The lower and upper quartiles are found by calculating the median of the values on each side of the median.

1 3 8 8 10 12 18

This means that the lower quartile (Q1) is equal to 3 and the upper quartile (Q3) is equal to 12.