How to Calculate Mean, Median, and Mode
Mean, median, and mode are the three measures of central tendency. They each answer the question “what is the typical value in this data set?” but they do it differently and produce different numbers when the data is uneven.
How to calculate the mean
The mean (also called the arithmetic average) is the sum of all values divided by the count of values.
\[\text{Mean} = \frac{x_1 + x_2 + \cdots + x_n}{n}\]Add every number in the data set, then divide by how many numbers there are. For a data set of 12, 15, 20, 25, and 28, the sum is 100 and there are 5 values. The mean is 100 / 5 = 20.
The mean uses every value in the calculation, which makes it sensitive to outliers. If you add the number 200 to that same data set, the sum becomes 300, the count becomes 6, and the mean jumps to 300 / 6 = 50. One extreme value pulled the average far above the other five numbers. This sensitivity is the main reason the mean is sometimes a poor choice for describing a “typical” value.
Despite that limitation, the mean is the most widely used average. It works well when data is roughly symmetric and free of extreme values. It is also the foundation for many other statistical measures, including standard deviation, which measures how far values spread from the mean.
How to calculate the median
The median is the middle value when the data is sorted from smallest to largest.
For an odd number of values:
\[\text{Median position} = \frac{n + 1}{2}\]Sort the data and pick the value at that position. For an even number of values, there is no single middle value, so the median is the average of the two values closest to the center (the values at positions n/2 and n/2 + 1).
Take the data set 3, 7, 9, 15, 22. There are 5 values (odd), so the median position is (5 + 1) / 2 = 3. The third value in the sorted list is 9.
Now consider the data set 3, 7, 9, 15, 22, 30. There are 6 values (even), so the two middle values are at positions 3 and 4: those are 9 and 15. The median is (9 + 15) / 2 = 12.
The median ignores extreme values entirely. Going back to the earlier example of 12, 15, 20, 25, 28, 200, the sorted list has 6 values, so the median is the average of the 3rd and 4th values: (20 + 25) / 2 = 22.5. Compare that to the mean of 50. The median stays near the cluster of typical values while the mean gets pulled toward the outlier.
How to calculate the mode
The mode is the value that appears most often in the data set.
There is no formula to compute. Count how many times each value occurs and identify whichever value has the highest frequency. In the data set 4, 7, 7, 9, 12, the value 7 appears twice while every other value appears once. The mode is 7.
A data set can have more than one mode. In the set 2, 2, 5, 5, 8, both 2 and 5 appear twice, making this a bimodal data set with two modes. If three or more values tie for the highest frequency, the data is multimodal. And if every value appears exactly once, there is no mode at all.
The mode is the only measure of central tendency that works with non-numeric data. If a survey asks people to name their favorite color and the responses are red, blue, blue, green, red, red, the mode is red. You cannot compute a mean or median for colors, but you can count frequencies.
All three measures on one data set
Here is a complete worked example. Nine students scored the following on a quiz (out of 50): 32, 45, 38, 38, 41, 29, 38, 44, 35.
The mean is the sum divided by the count: 32 + 45 + 38 + 38 + 41 + 29 + 38 + 44 + 35 = 340, and 340 / 9 = 37.78.
For the median, sort the data: 29, 32, 35, 38, 38, 38, 41, 44, 45. There are 9 values (odd), so the median is the 5th value: 38.
The value 38 appears three times, more than any other value, so the mode is 38.
In this example, the mean, median, and mode are all close to each other, which tells you the data is fairly symmetric. The mean, median, and mode calculator can compute all three at once if you want to verify your work or handle larger data sets.
When to use each measure
The three measures answer the same question differently, and the right choice depends on the shape of the data.
| Measure | Best used when | Watch out for |
|---|---|---|
| Mean | Data is symmetric, no extreme outliers | Pulled toward outliers in skewed data |
| Median | Data is skewed or has outliers | Ignores the actual magnitude of extreme values |
| Mode | Data is categorical or you need the most common value | May not exist, or multiple modes may exist |
Household income is the classic example. A small number of very high earners pull the mean income well above what most people actually earn. The median income is more representative because it sits at the 50th percentile, with half the population above and half below.
Test scores in a class tend to cluster in a symmetric bell shape. The mean works well here because there are rarely extreme outliers and the data distributes evenly around the center.
Shoe sizes in a store are best described by the mode. The store does not care about the average shoe size of its customers. It cares about which size sells most often, so it can stock the right inventory.
Relationship between the three measures
In a perfectly symmetric distribution, the mean, median, and mode are all equal. As data becomes skewed, they separate. In a right-skewed distribution (a long tail extending to the right), the mean is typically larger than the median, which is larger than the mode. In a left-skewed distribution, the reverse is true. This pattern is useful as a quick diagnostic: if the mean is noticeably higher than the median, the data probably has a right skew caused by a few large values.
This also explains why reporting both the mean and median together gives more information than reporting either alone. The gap between them tells you something about the shape of the data. If you are also interested in measuring spread rather than center, standard deviation quantifies how far individual values fall from the mean. And for a broader look at how ratios and percentages relate to these concepts, see the percentages, fractions, and ratios guide.
CalculateY