Example 1
- List: 12 7 9 3 18
9
What is the median of 12, 7, 9, 3 and 18? 9.
Enter a list of numbers in one field. The median is the middle value after sorting. 12 7 9 3 18 sorts to 3, 7, 9, 12, 18, so the middle is 9. For the even list 4 10 2 8 the middle pair is 4 and 8, and their average is 6.
Enter a list of numbers to see the median.
One list field of any length. For even n the calculator averages the two middle values. Five separate fields live on the five-number median page.
The median of a finite list of real numbers is the middle value after ascending order. For odd n take one central observation; for even n average the two central ones. The list 12 7 9 3 18 sorts to 3, 7, 9, 12, 18, so the median is 9. The list 4 10 2 8 sorts to 2, 4, 8, 10; the middle pair is 4 and 8, and the median is 6.
In descriptive statistics the median is the 50% quantile (second quartile). It is more resistant to outliers than the arithmetic mean: for 10 12 11 1000 the median is 11.5 and the mean is 258.25. Mathematical model: sample median as an order statistic x₍k₎ — NIST/SEMATECH e-Handbook; Wikipedia — Median.
The calculator uses the numbers you enter in the Numbers field (mediana-liczb-list). Separate them with spaces, semicolons, or commas. Write decimal 3.5 with one period or comma. Input order does not matter — the list is sorted. The neighboring five-field median page has fixed n = 5; here list length is free.
The result panel shows the median, n, parity, the sorted list, the middle value(s), the arithmetic mean of the same list, and min/max. The number line marks the points and the median location. An empty list produces no result.
Worked examples: 12 7 9 3 18 → 9; 4 10 2 8 → 6; 10 12 11 1000 → 11.5; 2 5 9 11 20 → 9; 1 1 2 3 100 → 2; 10 10 10 10 50 → 10; 3 6 9 12 → 7.5; −2 0 4 8 10 → 4.
Odd n = 2k+1: Me = x₍k+1₎ (middle order statistic). Even n = 2k: Me = (x₍k₎ + x₍k+1₎) / 2.
x₍1₎ ≤ … ≤ x₍n₎ are the list values after ascending sort. Index (zero-based): for odd n the middle index is (n−1)/2; for even n the pair is (n/2−1) and n/2.
Mathematical model: sample median as the 50% quantile / order statistic (descriptive statistics; NIST/SEMATECH e-Handbook; Wikipedia — Median).
Let x₁, …, xₙ be a finite sample of real numbers, and let x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎ be their ordered values (order statistics). The sample median Me is defined in two branches: when n = 2k+1 is odd, Me = x₍k+1₎; when n = 2k is even, Me = (x₍k₎ + x₍k+1₎)/2. That is the average-of-two-middles convention used in descriptive-statistics textbooks and in the NIST/SEMATECH e-Handbook of Statistical Methods. The median is the empirical ½-quantile (second quartile Q₂).
This page’s calculator accepts a list of any length in one text field, parses numbers (space, semicolon, comma as separator or decimal), sorts ascending, and applies the definition above. Computation: numeric sort, then either the middle element or the average of the central pair. It is not a density estimator or a weighted median — every successfully parsed value has weight 1.
In teaching practice it helps to separate the mathematical formula from floating-point limits: this calculator shows the browser’s floating-point computation (about 15–16 significant digits), not a paper proof of symbolic identities. When inputs are extreme, check the domain first, then the floating-point range.
The median as a “middle value” appears in nineteenth-century descriptive statistics beside the mean and the mode (measures of location). Francis Galton and later authors stressed resistance to extremes when describing incomes, heights, or test scores. In estimation theory the sample median estimates the population median; under a Laplace distribution it is more efficient than the mean. In robust statistics the median is an M-estimator with a high breakdown point (50%).
Conceptually the median is not the arithmetic, geometric, or harmonic mean. It is also not the midrange (average of min and max). It does not sort “by eye” — it needs a full ordering or an equivalent selection algorithm. This calculator does not compute confidence intervals or sign tests; it shows the point median of the entered list.
The sibling “median of five numbers” page has fixed n = 5 and five fields. Here n is free: a school list, grades, measurements. For the mean of the same list use the arithmetic-mean page.
Input: n ≥ 1 finite real numbers. Output: Me ∈ ℝ. Monotonicity: if every xᵢ rises (or does not fall), the median does not fall. Translation: Me(xᵢ + c) = Me(xᵢ) + c. Positive scaling λ > 0: Me(λx) = λ Me(x). For λ < 0 the order reverses and the median scales by λ (after sorting the scaled values).
Robustness: changing fewer than half the observations cannot move the median outside the range of the remaining values (breakdown point 50% for odd n in the classical sense). The mean has breakdown 0% — one infinite observation destroys the result. For 1 1 2 3 100 the median is 2 and the mean is 21.4.
Link to quantiles: Me = Q₀.₅. For odd n the median coincides with the middle element. For even n averaging the two middles is one of several software conventions; this calculator uses that classical average.
Step 1. Collect tokens from the list field and parse finite numbers into L = [y₁, …, yₙ], n ≥ 1.
Step 2. Order them: x₍₁₎ ≤ … ≤ x₍ₙ₎ (comparison sort on the number).
Step 3. If n is odd, let k = (n−1)/2 (zero-based). Then Me = x₍k+1₎ = L_sorted[k]. Example: n = 5, list 12 7 9 3 18 → 3, 7, 9, 12, 18 → Me = 9.
Step 4. If n is even, let i = n/2 − 1 and j = n/2. Then Me = (x₍i+1₎ + x₍j+1₎)/2. Example: n = 4, list 4 10 2 8 → 2, 4, 8, 10 → Me = (4+8)/2 = 6.
Step 5. Existence of the ordering follows from the total order on ℝ. The average of two middles is well-defined in ℝ. The browser result is a floating-point number.
Examples: 12 7 9 3 18 → 9; 4 10 2 8 → 6; 10 12 11 1000 → 11.5; 2 5 9 11 20 → 9; 1 1 2 3 100 → 2; 10 10 10 10 50 → 10; 3 6 9 12 → 7.5; −2 0 4 8 10 → 4. Singleton: one number is its own median. All equal: Me equals that value.
Empty list: no result. Non-numeric tokens are skipped. Decimals with a period or a comma are equivalent. Zeros and negatives enter the sort like any other value.
When n = 2, the median is the average of both elements — the same as the midrange for a two-point sample. For larger n midrange and median diverge.
The calculator sorts the values as numbers, not as text. The sum of two middles divided by 2 is exact for typical school data; at extreme values remember the limited floating-point precision. Display formatting (en-US / pl-PL) does not change the internal value.
Parser: spaces and semicolons always separate; several commas without spaces treat the comma as a separator; a single comma inside a token is the decimal mark. The axis diagram marks the points and the median.
The calculator does not weight observations, does not auto-drop outliers, and does not compute an interquartile range — those belong to other tools.
Related: arithmetic mean, five-field median, min/max and range, quartiles, percentiles, mode. In estimation theory — efficiency of the median versus the mean under different distributions.
Sources: NIST/SEMATECH e-Handbook — Percentiles / measures of location; Wikipedia — Median; MathWorld — Statistical Median; intro-stats textbooks (order statistics). Educational tool — not a textbook substitute or a full research-sample analysis.
For 12 7 9 3 18 the median is 9. For 4 10 2 8 the median is 6.
9
What is the median of 12, 7, 9, 3 and 18? 9.
6
What is the median of 4, 10, 2 and 8? 6.
11.5
What is the median of 10, 12, 11 and 1000? 11.5 (mean 258.25).
9
What is the median of scores 2, 5, 9, 11 and 20? 9.
2
What is the median of 1, 1, 2, 3 and 100? 2 (mean 21.4).
10
What is the median of 10, 10, 10, 10 and 50? 10.
7.5
What is the median of 3, 6, 9 and 12? 7.5.
4
What is the median of −2, 0, 4, 8 and 10? 4.
It computes the median (middle value) of a list of numbers in one field. After ascending sort, an odd count takes the single middle value; an even count averages the two middle values. Example: 12 7 9 3 18 gives 9; 4 10 2 8 gives 6.
The list is sorted ascending. The middle index is (n−1)/2 in zero-based indexing (or position (n+1)/2 from one). Three numbers 2, 3 and 7 give median 3 — with no averaging.
After sorting, take the two central values and average them. For 1, 4, 6, 10 the middle pair is 4 and 6, so the median is (4+6)/2 = 5. For 4 10 2 8 the middle pair is 4 and 8, result 6.
The mean divides the sum by n and feels every outlier. The median looks at order and the center. For 1 1 2 3 100 the median is 2 and the mean is 21.4. For 10 12 11 1000 the median is 11.5 and the mean is 258.25.
No. The calculator sorts the list before choosing the middle. 18 3 9 7 12 gives the same median 9 as 12 7 9 3 18.
Use spaces, semicolons, or commas between values. 3.5 (or 3,5) is one decimal, not two entries 3 and 5. With several commas and no spaces (e.g. 12,7,9) commas act as separators.
The neighboring five-number median page always has five separate fields and one middle (n = 5). Here one list field accepts any length — including even n and the average of two middles.
The median equals that common value. Four tens and a fifty (10 10 10 10 50) give median 10, because after sorting the middle still sits on ten.
No. Without a valid number the panel returns to the placeholder. Tokens that are not numbers are skipped; if nothing parses, an error message appears.
No. The median depends only on the parsed numbers. The currency and unit settings in the page header do not affect this result.
Sort the numbers ascending. For odd n take the middle value; for even n average the two middle values. For 12 7 9 3 18: sort 3, 7, 9, 12, 18 → median 9. For 4 10 2 8: sort 2, 4, 8, 10 → (4+8)/2 = 6.
After sorting the list is already ordered (n = 6). The middle pair is 12 and 20, so the median is (12+20)/2 = 16. Enter 3 7 12 20 60 100 in the list field.
9. After sorting: 3, 7, 9, 12, 18 — the middle is 9. That is the first example on the page; the same result after “Fill this example”.
Yes, more than the arithmetic mean. For 1 1 2 3 100 the median is 2 and the mean is 21.4. For 10 12 11 1000 the median is 11.5 and the mean is 258.25. One extreme value does not move the ordered middle.
That is the everyday name for the median: after ordering the list, half the values lie below and half above the center. For odd n it is one element; for even n it is the average of the two middle values.
The median definition and examples below come from established sources.
Page Updated November 2, 2026.