Math Runs locally Ready to use Built-in examples No tracking

Mean Calculator

Paste a list of numbers to get mean, median, sum, min, max, sample variance and standard deviation at once.

An average can hide more than it reveals: one very large salary lifts the mean while every ordinary earner is left behind, and the median stays where it was. Paste a column of numbers and this page gives the mean, median, minimum, maximum, total and count together with the sample variance and standard deviation, so it is obvious whether a few extreme values are bending the summary.

Each statistic answers a different question. Variance and standard deviation measure spread — this tool uses the sample convention (dividing by n−1), matching Excel’s STDEV.S; the mode answers "which value appears most often", which is often more useful than the mean for grade distributions and sales figures. For a credit- or weight-based average use the weighted average tool; this page is for a plain column of data.

How to use

  1. Paste a column of numbers (commas, spaces or newlines).
  2. Read the mean, median, minimum, maximum, total and count.
  3. Check the sample variance and standard deviation for spread.
  4. Use the weighted average tool when the values carry different weights.

How it works

How to enter the data

Enter your data: separate numbers with commas (either width), spaces or newlines — for example 85, 90, 78, 92, 88.

How the mean is computed

Mean = sum ÷ count. In the example the sum is 433 over 5 values, giving a mean of 86.6.

Mean or median — which to use

The median is the middle value after sorting (for an even count, the average of the two middle values). It resists outliers far better than the mean, which is why housing statistics usually quote the median.

Code example

JavaScript Mean and median

function meanMedian(xs) {
  const n = xs.length;
  const mean = xs.reduce((a, b) => a + b, 0) / n;
  const sorted = [...xs].sort((a, b) => a - b);
  const mid = n >> 1;
  const median = n % 2 ? sorted[mid]
    : (sorted[mid - 1] + sorted[mid]) / 2;
  return { mean, median };
}

meanMedian([1, 2, 3, 100]);   // mean 26.5, median 2.5 (an outlier)

Python One line with statistics

import statistics as st

xs = [1, 2, 3, 100]

st.mean(xs)      # 26.5
st.median(xs)    # 2.5
st.stdev(xs)     # sample standard deviation

# Parsing from a string:
xs2 = [float(x) for x in "1, 2, 3".replace(",", " ").split()]

FAQ

How are variance and standard deviation related?

Standard deviation is the square root of variance. Variance measures how far data sits from the mean; standard deviation shares the original unit and is more intuitive. This tool uses the sample basis (dividing by n−1), matching Excel's STDEV.

Why n−1 instead of n?

Sample variance divides by n−1 (Bessel's correction) to estimate the population variance without bias — the default in Excel's STDEV and scientific computing. If your data is the entire population, convert by multiplying by (n−1)/n.

Can it compute a weighted mean?

This tool computes the simple arithmetic mean. For a weighted average (credits, weights), multiply each value by its weight, sum, and divide by the total weight — or use a dedicated weighted-average tool.

Mean vs. median vs. mode — what's the difference?

The mean is the sum divided by the count and is easily dragged by extremes; the median is the middle value after sorting and resists outliers; the mode is the most frequent value. For income or housing data with a long tail, the median reflects the typical case far better.

What does the size of the standard deviation tell me?

It measures how dispersed the data is around the mean: smaller means tighter and more stable; larger means more volatile. When two datasets differ in mean or unit, compare them with the coefficient of variation (standard deviation ÷ mean) instead.

Will stray spaces or full-width punctuation break the calculation?

No. The tool recognizes English commas, Chinese commas, spaces, newlines and tabs as separators and skips empty entries. But remove units and words like "kg" or "points" — any such token is treated as invalid data and skipped, which can throw off the count.

Sample vs. population — which formula applies?

If the data is everything you care about, use the population formula (divide by n). If it is a sample drawn from a larger population, use the sample formula (divide by n−1) for an unbiased estimate. Experiments and surveys are almost always samples.