Calculateus

Confidence Interval for the Median Calculator

Calculate a nonparametric confidence interval for a dataset's median, based on order statistics.

Result

Median
17.5
Confidence Interval
11 to 25

This uses the normal approximation to the binomial distribution of order statistics (ranks) to select which sorted values bound the interval - a distribution-free method that doesn't assume normality.

About the CI for Median

The Confidence Interval for the Median Calculator builds a distribution-free range around a dataset's median using the ranks of the sorted values, rather than assuming the data follows a normal distribution. It's suited to skewed data, small irregular datasets, or any situation where outliers make the mean, and a standard mean-based confidence interval, unreliable summaries of the data.

How It Works

Enter your list of numbers and a confidence level. The calculator sorts the values, computes the median directly from the sorted list, and then uses a normal approximation to the binomial distribution of ranks to pick two specific sorted values, one on each side of the median, that bound the confidence interval. The rank positions for those two bounding values are computed from the sample size and the chosen z-score, then clamped so they never point outside the actual dataset.

Lower rank = floor(n/2 - z×sqrt(n)/2), upper rank = ceil(1 + n/2 + z×sqrt(n)/2), each clamped to between 1 and n; the interval runs from the sorted value at the lower rank to the sorted value at the upper rank.

Formula & Methodology

Because this method works on rank positions rather than the actual magnitudes of the numbers, the width of the interval depends only on the sample size n and the chosen confidence level, not on how spread out the values themselves are. Increasing n pulls the lower and upper ranks closer to the middle relative to the dataset's size, since sqrt(n) grows slower than n, narrowing the interval, while raising the confidence level from 90% to 99% pushes the ranks further apart, widening it.

Examples

Twelve Measurements

For the values 9, 11, 12, 14, 15, 17, 18, 19, 21, 22, 25, 27 (12 numbers), the median is 17.5. At 95% confidence, the calculator selects the 2nd and 11th ranked values, giving an interval of 11 to 25.

Delivery Times

For 10 delivery times of 5, 7, 7, 8, 9, 10, 11, 13, 14, and 20 days, the median is 9.5. At 90% confidence, the calculator selects the 2nd and 9th ranked values, giving an interval of 7 to 14 days.

Advantages

  • Doesn't assume the data is normally distributed, unlike a standard confidence interval built around a mean and standard deviation.
  • Stays resistant to outliers, since it works entirely from sorted rank positions rather than the raw magnitude of any single value.
  • Suited to small or irregular datasets where checking a normality assumption isn't practical.

Common Mistakes

  • Applying a standard mean-based confidence interval formula to skewed or outlier-heavy data, when a rank-based median interval would be more appropriate.
  • Trying to run this calculation on fewer than 6 data points, where the rank-based bounds aren't meaningful.
  • Reading the interval as centered symmetrically around the median in value; it's built from ranks, not linear distance, so the two bounds aren't generally equidistant from the median.

Edge Cases to Watch For

  • Requires at least 6 data points; with fewer, the calculator returns an error since the rank-based bounds become unreliable at that scale.
  • The computed lower and upper ranks are clamped to stay between 1 and n, so at small sample sizes or high confidence levels the interval can simply extend out to the dataset's minimum and/or maximum value.
  • The rank positions rely on a large-sample normal approximation to a binomial distribution, so results are most trustworthy with a reasonably sized dataset rather than one just barely meeting the 6-value minimum.

Common Use Cases

  • Analysts summarizing skewed data, like income, wait times, or response times, where the median is a more representative center than the mean.
  • Researchers working with small or irregular samples where assuming a normal distribution isn't well justified.
  • Anyone who needs a distribution-free way to express uncertainty around a median without relying on standard deviation.
Written & fact-checked by the Calculateus TeamLast updated August 5, 2026How we verify our formulas

Frequently asked questions

Why use a nonparametric confidence interval for the median?

The standard confidence interval formula for a mean assumes (or relies on the central limit theorem for) roughly normal data. A nonparametric confidence interval for the median makes no assumption about the underlying distribution's shape, working directly from the ranks of the sorted data instead - useful for skewed data or when outliers make the mean an unreliable summary.

Conclusion

By working from the ranks of sorted data instead of assumptions about the distribution's shape, this calculator gives a defensible confidence interval for the median even when the data is skewed or outlier-prone. It trades some of the added precision a parametric method might offer for wider applicability.