Skip to content
Statistics

Median Calculator

Enter your numbers separated by commas to get a complete descriptive-statistics summary: median, mean, mode, quartiles, interquartile range, standard deviation, and outlier detection. The show-your-work panel walks through every calculation step.

Your details

Separate values with commas, spaces or new lines. Order does not matter.
Sample uses n-1 (Bessel correction) for standard deviation and variance; population uses n. Use "sample" unless you have every member of the group.
Median
5
Mean5
Modenone (all values unique)
Count (n)9
Sum45
Minimum1
Maximum9
Range8
Q1 (25th pct)3
Q3 (75th pct)7
IQR4
Std Dev2.7386
Outliersnone
Min1
Q13
Median5
Q37
Max9

The median of your 9 values is 5.

  • With an odd count, the median is the single middle value after sorting.
  • The mean and median are very close, suggesting a roughly symmetric distribution.
  • No outliers were detected using Tukey fences (Q1 - 1.5 x IQR, Q3 + 1.5 x IQR).
  • Unlike the mean, the median is resistant to outliers and better represents the typical value in skewed data like incomes or home prices.

Next stepThe IQR (Q3 - Q1) is the middle 50% spread. Compare it to the full range to judge whether extreme values dominate.

Frequency Table

ValueFrequencyRelative FreqCumulativeCumulative %
1111.1%111.1%
2111.1%222.2%
3111.1%333.3%
4111.1%444.4%
5111.1%555.6%
6111.1%666.7%
7111.1%777.8%
8111.1%888.9%
9111.1%9100.0%

Values are sorted ascending. Relative frequency = count / n. Cumulative frequency counts all values at or below that row.

Formula

x~={x(n+1)/2n oddxn/2+xn/2+12n even\tilde{x} = \begin{cases} x_{(n+1)/2} & n \text{ odd} \\[4pt] \dfrac{x_{n/2} + x_{n/2+1}}{2} & n \text{ even} \end{cases}

Worked example

For 7, 2, 9, 4, 5, 1, 8, 3, 6 (n = 9), sort to 1, 2, 3, 4, 5, 6, 7, 8, 9. The 5th value is the middle, so the median is 5. The mean is 45 / 9 = 5. Q1 = 2.5, Q3 = 7.5, IQR = 5. No outliers (fences: -5 and 15).

How the Median Is Calculated

To find the median, sort the values from smallest to largest. If the data set has an odd number of values, the median is the single value at the exact middle position. If it has an even number of values, there is no single middle entry, so the median is the average of the two central values. This calculator sorts your input automatically, so you can enter numbers in any order. The result is the same whether you type 3, 1, 2 or 1, 2, 3.

Median vs. Mean: When to Use Each

The mean (average) adds every value and divides by the count, so a single extreme number can drag it far from the bulk of the data. The median ignores how far away the outer values are and only cares about position, which makes it far more stable. For symmetric data the mean and median are close, but for skewed data, such as household income, house prices, or response times, the median gives a more honest picture of the typical case. This is why economic reports almost always quote the median household income rather than the mean.

Quartiles and Interquartile Range (IQR)

The first quartile (Q1) is the median of the lower half of the data, roughly the 25th percentile. The third quartile (Q3) is the median of the upper half, roughly the 75th percentile. The interquartile range (IQR = Q3 - Q1) covers the middle 50% of the data and is a robust measure of spread because it ignores the extreme values on either end. A narrow IQR means the central values cluster tightly together; a wide IQR means they are spread out. Quartiles are calculated here using the inclusive (linear interpolation) method, the same method Excel uses for QUARTILE.INC.

Outlier Detection with Tukey Fences

An outlier is a value that sits unusually far from the rest of the data. This calculator flags outliers using Tukey fences: the lower fence is Q1 - 1.5 x IQR and the upper fence is Q3 + 1.5 x IQR. Any value below the lower fence or above the upper fence is considered a potential outlier. Outliers are not automatically removed because they may be real data points, but they are worth investigating. A data entry error, a legitimate extreme event, or a subpopulation can all produce outlier-level values.

Sample vs. Population Standard Deviation

Standard deviation measures how spread out the values are around the mean. When your data set is a sample from a larger group, the formula divides by n - 1 instead of n (Bessel correction) to correct for the fact that a sample tends to underestimate the true spread. Use the "sample" setting unless you have measured every single member of the group, such as all employees in a company or all students in a class. The population setting divides by n and gives the exact standard deviation of the values you entered.

Mode and the Frequency Table

The mode is the value that appears most often. A data set can have one mode (unimodal), more than one mode (multimodal), or no mode when all values appear exactly once. The frequency table below the results shows how often each unique value occurs, its relative frequency as a percentage, and the cumulative count and percentage. Scanning the table quickly reveals clusters, gaps, and which values dominate the distribution.

Five-Number Summary Reference

StatisticWhat it representsFormula
MinimumSmallest value in the setx_sorted[0]
Q125th percentile, lower quartileLinear interpolation at 0.25 x (n-1)
Median (Q2)50th percentile, middle valueMiddle value(s) after sorting
Q375th percentile, upper quartileLinear interpolation at 0.75 x (n-1)
MaximumLargest value in the setx_sorted[n-1]
IQRMiddle 50% spreadQ3 - Q1
RangeTotal spreadMax - Min

The five-number summary describes the full spread of a data set.

Frequently asked questions

How do you find the median of an even set of numbers?

Sort the numbers from lowest to highest, then identify the two values in the middle. The median is their average: add them together and divide by two. For example, in the set 2, 4, 6, 8 the two middle values are 4 and 6, so the median is (4 + 6) / 2 = 5. The median does not have to be one of the original numbers.

What is the difference between the median and the mean?

The mean is the arithmetic average: the sum of all values divided by how many there are. The median is the middle value of the sorted data. The key difference is sensitivity to outliers. One unusually large or small number shifts the mean significantly but barely moves the median. When data is heavily skewed, the median is usually the more representative measure of a typical value.

Can the median be a decimal if all my numbers are whole?

Yes. When a data set has an even number of whole values, the median is the average of the two middle ones, which can land on a half. For instance, the median of 1, 2, 3, 4 is (2 + 3) / 2 = 2.5 even though every input was an integer. This is normal and expected for even-sized data sets.

What does the interquartile range (IQR) tell you?

The IQR is Q3 minus Q1, the spread of the middle 50% of the data. It ignores the top and bottom 25%, so it is not affected by extreme values at either end. A small IQR means the central values cluster tightly; a large IQR means they are spread out. The IQR is also used to define Tukey fences for outlier detection: values more than 1.5 x IQR below Q1 or above Q3 are flagged as potential outliers.

When should I use the population standard deviation instead of the sample one?

Use the population standard deviation (sigma) only when your data set contains every member of the group you care about, for example all 30 students in a single class or all 12 months of data for a specific year. Use the sample standard deviation (s) when your data is a subset of a larger group and you want to estimate how spread out the full population is. The sample formula divides by n - 1 (Bessel correction) to correct for the tendency of a sample to underestimate true variance.

How does this calculator detect outliers?

Outliers are identified using Tukey fences. The lower fence is Q1 minus 1.5 times the IQR, and the upper fence is Q3 plus 1.5 times the IQR. Any value below the lower fence or above the upper fence is listed as a potential outlier. This method is widely used because it is based on the actual spread of the central data rather than arbitrary distance from the mean.

Sources

Written by Dr. Hannah Brandt, PhD Statistician · Munich, Germany

Applied statistician translating rigorous probability theory into clear, accurate tools for researchers and practitioners.

Search 3,500+ calculators

Loading search…