Quartiles are the values that divide a list of numbers into quarters or into four.
Quartiles are used to calculate the interquartile range, which is a measure of variability around the median.
Formula to calculate quartiles.

Q1 is the lower quartile or 25%.
Q2 is the median or 50%.
Q3 is the upper quartile or 75%.
n is the number of the observations.
Example:
Calculate the upper quartile of the following data set.
2, 3, 4, 6, 8.
There are 5 observations.

This means that Q3 is average of 4th and 5th position of the observations which is 6 and 8 here and the average of same is 7.