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.
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
Median Formulas at a Glance
After sorting the data ascending as x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎.
| Case | Condition | Formula | Example |
|---|---|---|---|
| Odd count | n is odd | median = x₍₍ₙ₊₁₎/₂₎ | 3, 7, 9, 12, 15 → 9 |
| Even count | n is even | median = (x₍ₙ/₂₎ + x₍ₙ/₂₊₁₎) / 2 | 4, 8, 15, 16, 23, 42 → 15.5 |
| Single value | n = 1 | median = x₍₁₎ | 7 → 7 |
| All equal | all xᵢ = c | median = c | 5, 5, 5 → 5 |
| Grouped data | frequency table | L + ((n/2 − cf) / f) × w | see calculator above |
Median vs Mean vs Mode
Choose the right average for the shape of your data.
| Measure | Definition | Outlier sensitivity | Best used when |
|---|---|---|---|
| Median | Middle value of sorted data | Very low | Skewed data, outliers present, ordinal data |
| Mean | Sum divided by count | High | Symmetric data, further statistical analysis |
| Mode | Most frequent value | None | Categorical data, finding the most common item |
| Midrange | (min + max) / 2 | Extreme | Quick rough estimate only |
| Trimmed mean | Mean after dropping extremes | Low | Compromise between mean and median |
Variable Reference
| Symbol | Meaning | Typical range | Notes |
|---|---|---|---|
| n | Number of data values | 1 – 1,000 | Count of observations |
| x₍ᵢ₎ | i-th value in sorted order | any real number | 1-based index after sorting |
| Q1 | First quartile | ≤ median | Median of the lower half |
| Q3 | Third quartile | ≥ median | Median of the upper half |
| IQR | Interquartile range | ≥ 0 | Q3 − Q1 |
| Σf | Total frequency | ≥ n | Used 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 even → median = ( x₍ₙ/₂₎ + x₍ₙ/₂₊₁₎ ) / 2
For grouped data presented in a frequency table, the median of the median class is estimated with interpolation:
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
| Symbol | Meaning | Notes |
|---|---|---|
| n | Number of values | Determines whether one or two middle values are used |
| x₍ᵢ₎ | i-th sorted value | Sorting is the essential first step |
| Q1, Q3 | Quartiles | Medians of the lower and upper halves |
| IQR | Interquartile range | Q3 − Q1; the middle 50% of the data |
| L, cf, f, w | Grouped-data terms | Used only for frequency-table interpolation |
Median Calculation Examples
Data: 12, 15, 18, 21, 24, 27, 30 (n = 7, already sorted)
Middle position = (7 + 1) / 2 = 4 → x₍₄₎ = 21
median = 21
Data: 4, 8, 15, 16, 23, 42 (n = 6)
Middle positions = 3 and 4 → x₍₃₎ = 15, x₍₄₎ = 16
median = (15 + 16) / 2 = 15.5
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.
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.
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| Parameter | Value |
|---|---|
| Sorted Data | 1,3,5,7,9 |
| n | 5 |
| Parameter | Value |
|---|---|
| Sorted Data | 2,4,6,8 |
| n | 4 |
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
Related calculators · Descriptive Statistics
Recently updated formulas
Suggest an improvement
Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.