Skip to content
ENExplore Calculators

Median Calculator

Calculate the median value of a dataset used in model feature analysis.

About Median Calculator

The median is the middle value of a sorted dataset. For an odd number of values, it's the exact middle element; for an even number, it's the average of the two middle elements. Unlike the mean, the median is robust to outliers — it depends only on the rank order of values, not their magnitude, making it a preferred central-tendency metric for skewed data or datasets contaminated with extreme values.

Formula

median = sorted[n/2] (odd n) or (sorted[n/2 - 1] + sorted[n/2]) / 2 (even n)

sorted
Dataset sorted in ascending order
n
Number of values

Worked example

With the default values below, Median Calculator returns Median of 15.5000. Change any input above and every figure here is recalculated in your browser.

Inputs used

Dataset
4, 8, 15, 16, 23, 42

Results

Median
15.5000
Count (n)
6

Step by step

  1. 1Sorted dataset= [4, 8, 15, 16, 23, 42]
  2. 2Even n: average the two middle values= 15.5000

Assumptions and limits

  • The result is derived only from the single input listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 4 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why use median instead of mean for ML feature analysis?

When a feature's distribution is skewed or contains outliers (e.g. income, latency, file size), the median gives a more representative 'typical value' than the mean, which outliers can pull heavily in one direction.

Does the median require sorting?

Yes — computing the median requires the data to be sorted (or an equivalent selection algorithm) to identify the middle value(s), unlike the mean which can be computed in a single pass without sorting.

What happens with duplicate values?

Duplicates are treated like any other value — they're included in the sort and counted normally; the median calculation doesn't change based on how many duplicates exist.

Is median resistant to all types of outliers?

It's resistant to outlier magnitude (an outlier of 1000 vs. 10000 has the same effect on the median) but not to outlier proportion — if more than half the data is contaminated, the median itself becomes unreliable.

Median Calculator – Calculate Median & Count (n) | Calcrivo