Calculate Median

Online calculator to compute the statistical middle value (median) of a data series

Median Calculator

The Median

The median (also called central value) is the middle value of a sorted data series. It is a robust measure of location that is insensitive to outliers.

Enter Data
Data values (separated by space or semicolon, do not need to be sorted)
Result
Median:
Properties of the Median

Interpretation: 50% of values lie below the median, 50% above. Robust against outliers.

Central Value Robust Q(0.5)

Median Concept

The median is the middle value of a sorted data series.
It divides the data into two equal halves.

1 2 3 7 9 12 Median = 7 50% ← → 50% Sorted Data Series: 1, 2, 3, 7, 9, 12

Data Points Median (middle value)

What is the Median?

The median (central value) is a fundamental measure of location in statistics:

  • Definition: Middle value of a sorted data series
  • Position: For odd count: middle value, for even count: average of the two middle values
  • Quantile: The median corresponds to the 0.5-quantile (50th percentile)
  • Robustness: Insensitive to outliers and extreme values
  • Interpretation: Divides the data into two equal halves
  • Application: Particularly suitable for skewed distributions

Calculating the Median

The calculation depends on the number of data values:

Odd Count
  • 1. Sort the data in ascending order
  • 2. Determine position: k = (n+1)/2
  • 3. The k-th value is the median
  • Example: With 7 values, position (7+1)/2 = 4
Even Count
  • 1. Sort the data in ascending order
  • 2. Find the two middle values (position n/2 and n/2+1)
  • 3. Calculate the average of the two values
  • Example: With 8 values: (Value₄ + Value₅)/2

Applications of the Median

The median is used in many fields:

Statistical Analysis
  • Robust measure of location with outliers
  • Descriptive statistics (with quartiles)
  • Box plot representations
  • Comparison with arithmetic mean to detect skewness
Practical Applications
  • Real Estate: Median home price
  • Income: Median income (more robust than average)
  • Education: Median grades or test scores
  • Medicine: Median survival time in studies

Formulas for the Median

Median (Odd Count)
\[\tilde{x} = x_{\left(\frac{n+1}{2}\right)}\]

For odd n: the middle value of the sorted list

Median (Even Count)
\[\tilde{x} = \frac{x_{\left(\frac{n}{2}\right)} + x_{\left(\frac{n}{2}+1\right)}}{2}\]

For even n: average of the two middle values

Median as Quantile
\[\tilde{x} = Q(0.5) = F^{-1}(0.5)\]

The median is the 0.5-quantile (50th percentile) of the distribution

General Form
\[\tilde{x} = \begin{cases} x_{(\frac{n+1}{2})} & \text{if } n \text{ is odd} \\ \frac{1}{2}(x_{(\frac{n}{2})} + x_{(\frac{n}{2}+1)}) & \text{if } n \text{ is even} \end{cases}\]

Case distinction based on parity of n

Symbol Explanations
\(\tilde{x}\) Median (also Me or x̃)
\(x_{(k)}\) k-th value of sorted list
\(n\) Number of data points
\(Q(p)\) Quantile function
\(F^{-1}\) Inverse distribution function
0.5 50th percentile (50%)

Example Calculations for the Median

Example 1: Odd Count
Data: 7, 9, 12, 1, 3, 2, 14

Calculate: Median of 7 values

1. Sort Data
\[\text{Original: } 7, 9, 12, 1, 3, 2, 14\] \[\text{Sorted: } 1, 2, 3, \color{blue}{\underline{7}}, 9, 12, 14\]

Sort data in ascending order

2. Determine Position
\[n = 7 \text{ (odd)}\] \[k = \frac{7+1}{2} = 4\] \[\tilde{x} = x_{(4)} = \color{blue}{7}\]

The 4th value of the sorted list is the median

Example 2: Even Count
Data: 7, 9, 12, 1, 3, 2, 14, 8

Calculate: Median of 8 values

1. Sort Data
\[\text{Original: } 7, 9, 12, 1, 3, 2, 14, 8\] \[\text{Sorted: } 1, 2, 3, \color{blue}{\underline{7, 8}}, 9, 12, 14\]

The two middle values are 7 and 8

2. Calculate Average
\[n = 8 \text{ (even)}\] \[k_1 = \frac{8}{2} = 4, \quad k_2 = 5\] \[\tilde{x} = \frac{7 + 8}{2} = \color{blue}{7.5}\]

Average of values at position 4 and 5

Example 3: Even Count with Gap
Data: 1, 2, 6, 9

Calculate: Median with larger gap between middle values

1. Already Sorted
\[\text{Sorted: } 1, \color{blue}{\underline{2, 6}}, 9\]

The middle values are 2 and 6

2. Calculate Median
\[\tilde{x} = \frac{2 + 6}{2} = \color{blue}{4}\]

The median 4 lies between the data values

Interpretation

The median does not have to occur in the data. For even counts, it often lies between two values. In this case, median = 4 means: 50% of values are ≤ 4, 50% are ≥ 4.

Mathematical Foundations of the Median

The median is a robust measure of location with important properties that is preferable to the arithmetic mean, especially for skewed distributions.

Properties of the Median

The median has important mathematical properties:

  • Robustness: Insensitive to outliers – extreme values have little impact on the median
  • Existence: Always exists for any finite data set
  • Uniqueness: The median is always uniquely determined (even for even counts by convention)
  • Position Invariance: Invariant under monotone transformations
  • Minimization: The median minimizes the sum of absolute deviations: ∑|xᵢ - Med| is minimal

Median vs. Arithmetic Mean

The choice between median and mean depends on the data:

When to Use Median?
  • Skewed Distributions: For asymmetric data (e.g., income, real estate prices)
  • Outliers: When extreme values are present
  • Ordinal Data: For ranked data without metric distances
  • Robustness: When resistance to extreme values is important
When to Use Mean?
  • Symmetric Distributions: For normally distributed or approximately symmetric data
  • No Outliers: When extreme values are meaningful
  • Metric Data: For ratio or interval scales
  • Mathematical Properties: When algebraic operations are important

Relationship to Quantiles

The median is closely related to the quantile concept:

The Median as Quantile

The median is the 0.5-quantile (50th percentile or second quartile Q₂). It divides the data so that 50% of values lie below and 50% above it.

Quartiles and Median

The median is one of three quartiles: Q₁ (25%), Q₂ = Median (50%), Q₃ (75%). Together they form the basis for box plots.

Applications in Different Fields

Economics and Social Sciences
  • Income Statistics: Median income better than average for skewed data
  • Real Estate: Median price more meaningful than average price
  • Education: Median grades as robust measure
  • Demography: Median age of population
Natural Sciences and Medicine
  • Clinical Studies: Median survival time (robust to censoring)
  • Lab Values: Reference values often given as median
  • Environmental Data: Median pollutant concentrations
  • Astronomy: Median brightness of stars

Skewness and Median

The relationship between median and mean reveals information about skewness:

Symmetric

Mean ≈ Median
Normal Distribution

Right Skewed

Mean > Median
e.g., Income

Left Skewed

Mean < Median
e.g., Exam Grades

Summary

The median is a robust and intuitively understandable measure of location that indicates the "typical" middle value of a distribution. Its insensitivity to outliers makes it particularly valuable in practical data analysis, especially for skewed distributions. As the 50th percentile, it is a special case of the quantile function and, together with the quartiles, forms the basis for important exploratory data analysis methods such as the box plot.