Formula & Calculator

Median

The median is the middle value when you sort the data from smallest to largest. If there is an even number of values, it is the average of the two middle ones. Unlike the mean, the median is not affected by extreme outliers. For example, the median house price in a city is often more representative than the average because a few very expensive mansions can skew the mean. It is a robust measure of central tendency.

Statistics Descriptive Statistics Central Tendency
VORZEP · STATISTICS & DATA TOOLS

Median Calculator — Middle Value

Sort your data, find the middle. For an odd number of values the median is the single middle value; for an even number it is the average of the two middle values. Get step-by-step math, a live number-line diagram, a sorted bar chart, a box plot and companion statistics.

Median = middle value of sorted data · even n: (xn/2 + xn/2+1) / 2 · odd n: x(n+1)/2
Data entry mode
Dataset Enter numbers separated by commas, spaces, semicolons or new lines. Negative values and decimals are accepted. In “value : frequency” mode write one pair per line, for example 12 : 3 meaning the value 12 appears 3 times. n = 10
Enter at least one valid number.
10 values detected · 0 tokens skipped
The median splits an ordered dataset into two equal halves — half the values lie below it, half above it.
MEDIAN (MIDDLE VALUE)
15
n = 10 · range 5 – 30 · IQR 13
ROUGHLY SYMMETRIC
median = (x₅ + x₆) / 2 = (14 + 16) / 2 = 15
Step-by-step solution
Sorted data with the median
Data values (sorted) Middle value(s) Median level
Box plot & five-number summary
Interquartile box (Q1–Q3) Median Outliers (1.5 × IQR)
Robustness & sensitivity
Companion statistics
Where the median sits on the number line — live schematic
One dot per data value Middle value(s) used for the median Median position
What the median really measures
x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎sort the data
→
n oddsingle middle value
/
n evenaverage of two middles
=
Median50th percentile

The median resists outliers

Because the median only depends on position, not magnitude, extreme values barely move it. Replace the largest salary in a company with ten times that number and the mean jumps, but the median barely budges. That is why income, house prices and waiting times are almost always reported as medians rather than means.

Median vs mean tells you the shape

When the mean sits above the median the distribution is right-skewed — a tail of large values is pulling the average up. When the mean sits below the median the distribution is left-skewed. When they are close, the data is roughly symmetric. This single comparison is the fastest skew check available.

The median is the 50th percentile

Median, second quartile and 50th percentile are three names for the same number. Half the observations are at or below it, half at or above. That is exactly why it is used to split data into halves before computing Q1 and Q3 — the quartiles are just the medians of the two halves.

When the median misleads

For small datasets the median is coarse — adding a single value can shift it by a whole position. It also throws away magnitude information, so two very different datasets can share a median. Always report the median alongside the count, the range and the quartiles, which is what this calculator does.

How to Use This Median Calculator

The median is the middle value of sorted data. This tool sorts for you, finds the middle, and shows every step along the way.

1. Paste your dataset

Type or paste numbers into the box, separated by commas, spaces, semicolons or new lines. Negative values and decimals are fine. The counter under the box confirms how many values were detected.

2. Pick a preset if you are exploring

Presets cover the cases that matter: an odd count, an even count, a dataset with an extreme outlier, negative values and decimals. Each one shows a different facet of how the median behaves.

3. Use value : frequency mode for repeated data

If your data is a frequency table — for example 12 appears 3 times, 15 appears 5 times — switch the entry mode and write one pair per line. The calculator expands the table and computes the median exactly as if every value had been typed out.

4. Read the result and verdict

The result card shows the median plus the count, range and interquartile range. A colour-coded verdict compares the mean with the median to tell you whether the data is symmetric, right-skewed or left-skewed.

5. Check the diagram and chart

The number line plots every value as a dot and marks the middle one in amber. The bar chart shows the sorted data with the median drawn as a horizontal level, so you can see at a glance how the middle splits the dataset.

6. Switch to Advanced for depth

Advanced mode adds a box plot with outlier detection, a robustness panel showing how little the median moves when extreme values change, and a full companion statistics table including mean, mode, variance and standard deviation.

What This Tool Offers

Built around the classic definition — the median is the middle value of sorted data, or the average of the two middle values when the count is even.

Automatic sorting

Values are ordered ascending for you and the middle position is computed from the count, so odd and even cases are handled without any manual work.

Live number-line diagram

Every value becomes a dot on a scaled number line, with the middle value highlighted and a dashed median marker drawn through the axis.

Sorted bar chart

A bar per value in ascending order, with the median drawn as a horizontal level and the middle bar(s) highlighted in amber.

Box plot & outliers

Five-number summary with an IQR box, whiskers and automatic 1.5 × IQR outlier detection in advanced mode.

Robustness panel

See how little the median changes when you remove the largest value or double it — and how much the mean moves in comparison.

Reference tables

Median formulas at a glance, mean vs median vs mode guidance, a grouped-frequency median calculator and a full variable reference.

Reference Tables & Extra Tools

A grouped-frequency median calculator plus lookup tables for formulas and typical behaviour.

Grouped frequency median calculator

class
Σf
cf
f
w
median = 20 + ((50/2 − 18) / 12) × 10 = 25.833

Median Formulas at a Glance

After sorting the data ascending as x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎.

CaseConditionFormulaExample
Odd countn is oddmedian = x₍₍ₙ₊₁₎/₂₎3, 7, 9, 12, 15 → 9
Even countn is evenmedian = (x₍ₙ/₂₎ + x₍ₙ/₂₊₁₎) / 24, 8, 15, 16, 23, 42 → 15.5
Single valuen = 1median = x₍₁₎7 → 7
All equalall xᵢ = cmedian = c5, 5, 5 → 5
Grouped datafrequency tableL + ((n/2 − cf) / f) × wsee calculator above

Median vs Mean vs Mode

Choose the right average for the shape of your data.

MeasureDefinitionOutlier sensitivityBest used when
MedianMiddle value of sorted dataVery lowSkewed data, outliers present, ordinal data
MeanSum divided by countHighSymmetric data, further statistical analysis
ModeMost frequent valueNoneCategorical data, finding the most common item
Midrange(min + max) / 2ExtremeQuick rough estimate only
Trimmed meanMean after dropping extremesLowCompromise between mean and median

Variable Reference

SymbolMeaningTypical rangeNotes
nNumber of data values1 – 1,000Count of observations
x₍ᵢ₎i-th value in sorted orderany real number1-based index after sorting
Q1First quartile≤ medianMedian of the lower half
Q3Third quartile≥ medianMedian of the upper half
IQRInterquartile range≥ 0Q3 − Q1
ΣfTotal frequency≥ nUsed in grouped-data formula

What Is the Median?

The median is the middle value of a dataset once the values have been arranged in order. It is the point that splits the data into two equal halves: half the observations lie at or below the median, half at or above it. Because it depends only on position and not on magnitude, the median is described as a robust measure of central tendency — extreme values cannot drag it around the way they drag the mean.

When the number of values is odd there is exactly one middle value and the median is that value. When the number of values is even there are two middle values, and the median is defined as their average. That single definition covers every case, and it is the reason the median of 4, 8, 15, 16, 23, 42 is 15.5 rather than 15 or 16.

Median Formula

Sort the data ascending so that x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎. Then:

n odd  →  median = x₍₍ₙ₊₁₎/₂₎
n even →  median = ( x₍ₙ/₂₎ + x₍ₙ/₂₊₁₎ ) / 2

For grouped data presented in a frequency table, the median of the median class is estimated with interpolation:

median = L + ( (n/2 − cf) / f ) × w

where L is the lower boundary of the median class, n is the total frequency, cf is the cumulative frequency of all classes before the median class, f is the frequency of the median class, and w is the class width.

Median Variables

SymbolMeaningNotes
nNumber of valuesDetermines whether one or two middle values are used
x₍ᵢ₎i-th sorted valueSorting is the essential first step
Q1, Q3QuartilesMedians of the lower and upper halves
IQRInterquartile rangeQ3 − Q1; the middle 50% of the data
L, cf, f, wGrouped-data termsUsed only for frequency-table interpolation

Median Calculation Examples

Odd count
Data: 12, 15, 18, 21, 24, 27, 30 (n = 7, already sorted)
Middle position = (7 + 1) / 2 = 4 → x₍₄₎ = 21
median = 21
Even count
Data: 4, 8, 15, 16, 23, 42 (n = 6)
Middle positions = 3 and 4 → x₍₃₎ = 15, x₍₄₎ = 16
median = (15 + 16) / 2 = 15.5
Outlier does not move the median
Data: 12, 14, 15, 16, 18, 19, 250 (n = 7)
median = x₍₄₎ = 16  ·  mean = 49.14
The mean sits far above the median because one value is extreme.
Grouped frequency data
L = 20, n = 50, cf = 18, f = 12, w = 10
median = 20 + ((25 − 18) / 12) × 10 = 20 + 5.833 = 25.833

Frequently Asked Questions

The median is the middle value of a dataset after the values have been sorted from smallest to largest. If the count is odd, it is literally the single value in the middle. If the count is even, there are two middle values and the median is their arithmetic average. It is also the 50th percentile and the second quartile — all three names describe the same number.

Because the median is defined by position, not by value. In the unsorted list 18, 5, 9, 22, 14 the middle entry is 9, but that is meaningless — 9 is not the median. Once sorted to 5, 9, 14, 18, 22 the middle entry is 14, and 14 is the median. Sorting is not an optional convenience; it is part of the definition. This calculator sorts automatically and shows the sorted list in the steps.

With an even number of values there is no single value that has exactly as many observations below it as above it. The convention is to take the midpoint between the two central values, which produces a number that may not appear in the dataset at all. For 4, 8, 15, 16, 23, 42 the two middles are 15 and 16 and the median is 15.5 — a value that never occurs in the data. This is correct and expected.

Use the median whenever the data is skewed or contains outliers, or whenever the data is ordinal rather than truly numeric. House prices, incomes, waiting times and hospital stays are all classic median cases because a small number of extreme values would make the mean unrepresentative. Use the mean when the data is roughly symmetric and you need to do further statistical work — variance, regression and most hypothesis tests are built on the mean.

Switch the entry mode to “value : frequency” and write one pair per line, for example 12 : 3 to mean that 12 appears three times. The calculator expands the table into the full list, sorts it and finds the median normally. If instead your data is already grouped into classes with a range rather than a single value — like “20 to 30” — use the grouped-frequency median calculator above, which applies the interpolation formula.

The quartiles split the sorted data into four equal parts. Q1 is the median of the lower half, Q3 is the median of the upper half, and the interquartile range IQR = Q3 − Q1 covers the middle 50% of the data. The IQR is used to flag outliers: any value below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR is conventionally treated as an outlier, which is exactly what the box plot in advanced mode draws.

Yes to both. The median is just a position in the sorted order, so it can be any real number the data contains. For the dataset −8, −3, 0, 4, 9, 11 the two middle values are 0 and 4 and the median is 2. For −20, −15, −9, −4, −1 the median is −9. Decimals appear naturally whenever the count is even and the two middle values differ by an odd amount.

Calculating...

Variables

Symbol Quantity Unit
Median Median value
n Number of data points

What it means

The median is the value that separates the lower half of a sorted dataset from the upper half. It is a measure of central tendency that is robust to extreme values, unlike the mean. For an odd number of observations, it is the middle value; for an even number, it is the average of the two middle values. The median is commonly used in reporting income, house prices, and other distributions that are often skewed. It is also used in non‑parametric statistics. Understanding the median is important for interpreting data where outliers could distort the average. It provides a more "typical" value in skewed distributions.

Worked example

Median – Two Examples

Real‑World
Scenario: The sorted salaries (in $k): 1, 3, 5, 7, 9. Find the median.
ParameterValue
Sorted Data1,3,5,7,9
n5
1Odd n, median is middle value: 5
Result 5 ✓ Middle salary
Scenario: Data: 2, 4, 6, 8 (even n). Find the median.
ParameterValue
Sorted Data2,4,6,8
n4
1Even n, median = average of middle two: (4+6)/2 = 5
Result 5.0 ✓ Average of middle two
Insight: Median is the 50th percentile. It is robust to outliers, unlike the mean.

Common mistakes

  • Sorting: Always sort the data in ascending order before finding the median.
  • Even n: If the number of values is even, take the average of the two middle numbers.
  • Odd n: The median is the exact middle value.
  • Robustness: The median is robust to outliers, unlike the mean.
  • Data type: Applicable to ordinal and continuous data – not nominal.

Applications

The median is the middle value of a sorted dataset, separating the higher half from the lower half. It is a robust measure of central tendency, less affected by outliers than the mean. Engineers use it when data are skewed, such as in material strength tests or reliability data. In economics, median income better represents typical earnings than the mean. In healthcare, it describes patient waiting times. By using the median, professionals can provide a more accurate summary of non‑normal distributions. It is also used in descriptive statistics and in constructing box plots. Understanding the median is crucial for interpreting data with extreme values, ensuring that conclusions are not distorted by a few unusual observations.

  • Income and salary reporting (less influenced by extremes)
  • Reliability and lifetime data analysis (skewed distributions)
  • Healthcare – patient waiting times and treatment durations
  • Real estate – property price summaries
  • Quality control – when data are not normally distributed