Mean, Median, Mode Calculator
Calculate the mean, median, mode, and count of any dataset, with clear handling of ties and no-mode cases.
How It's Calculated
Formula
\bar{x} = \frac{\sum x_i}{n} \qquad \text{median} = \begin{cases} x_{\frac{n+1}{2}} & n \text{ odd} \\ \frac{x_{n/2} + x_{n/2+1}}{2} & n \text{ even} \end{cases} \qquad \text{mode} = \text{most frequent value(s)}Mean, median, and mode are the three most common ways to describe the "center" of a dataset, and each answers a different question. The mean (average) is the sum of all values divided by how many there are — it uses every value in the dataset, which makes it sensitive to outliers: one extremely large or small value can pull the mean away from where most of the data actually sits. The median is the middle value when the dataset is sorted from smallest to largest — with an odd count of values it's the single middle value, and with an even count it's the average of the two middle values. Because the median only cares about position, not magnitude, it's far less affected by outliers than the mean. The mode is the value (or values) that appear most often in the dataset — unlike mean and median, a dataset can have no mode (if every value appears exactly once), one mode, or several modes (if two or more values are tied for the highest frequency). This calculator computes all three, along with the count of values you entered.
Worked Examples
Dataset with one mode (even count)
- Dataset: 2, 4, 4, 4, 5, 5, 7, 9 (count = 8)
- Mean = (2+4+4+4+5+5+7+9) / 8 = 40 / 8 = 5
- Sorted: 2, 4, 4, 4, 5, 5, 7, 9 — count is even, so median = average of the 4th and 5th values
- Median = (4 + 5) / 2 = 4.5
- Frequencies: 2 appears 1x, 4 appears 3x, 5 appears 2x, 7 appears 1x, 9 appears 1x
- Highest frequency is 3, held only by 4, so mode = 4
Dataset with a tie for mode (odd count)
- Dataset: 1, 2, 2, 5, 5 (count = 5)
- Mean = (1+2+2+5+5) / 5 = 15 / 5 = 3
- Sorted: 1, 2, 2, 5, 5 — count is odd, so median is the middle (3rd) value
- Median = 2
- Frequencies: 1 appears 1x, 2 appears 2x, 5 appears 2x
- Highest frequency is 2, held by both 2 and 5, so this dataset is bimodal — mode = 2, 5
Frequently Asked Questions
What happens if no value repeats — is there always a mode?
No. If every value in the dataset appears exactly once, there is no most-common value, and this calculator reports "No mode" rather than guessing or picking one arbitrarily. A mode only exists when at least one value repeats more often than the others.
What if two or more values are tied for the mode?
The dataset is multimodal, and all tied values are reported together as the mode (for example, "2, 5"). This is mathematically correct — a dataset can have more than one mode — so the calculator lists every value that shares the highest frequency instead of arbitrarily choosing just one.
Why is the median sometimes very different from the mean?
The mean uses every value's magnitude, so a few very large or very small values (outliers) can pull it noticeably up or down. The median only depends on which value sits in the middle once the data is sorted, so it stays close to where most of the data actually clusters even when outliers are present. If mean and median differ a lot, that's a sign your dataset is skewed or has outliers.
How is the median calculated for an even number of values?
Sort the dataset from smallest to largest, then average the two values sitting in the middle. For example, with 4 values, the median is the average of the 2nd and 3rd values in sorted order.
What happens if I enter a non-numeric or blank value?
The calculation is not performed and a clear message identifies which row is the problem. This calculator deliberately does not silently drop invalid rows and calculate with what's left — doing so would quietly change your dataset without telling you, which could produce a misleading result for a statistics tool. Fix or remove the flagged row to get a result.