Descriptive statistics calculator

Calculate the mean, median, mode, range, variance and standard deviation of a list of values.

Modes are the most frequent values; no mode is reported when every value is unique. Variance and standard deviation are provided for both a population and a sample. Values stay in your browser.

Your inputs stay in your browser. Displayed results are rounded to a maximum of 12 significant digits.

Method and assumptions

Method version 1.0.0 · Updated

Calculate statistics

Formula: Mean = Σx / n; population variance = Σ(x − μ)² / n; sample variance = Σ(x − x̄)² / (n − 1)

Modes are the most frequent values; no mode is reported when every value is unique. Variance and standard deviation are provided for both a population and a sample. Values stay in your browser.

values
Values

From 1 to 1,000 finite numbers. Population variance divides by n; sample variance divides by n − 1 and is undefined for a single value. High-precision decimal intermediate calculations; out-of-range results are reported.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const xs = [2, 4, 6, 8];
const mean = xs.reduce((a, b) => a + b, 0) / xs.length;
console.log(mean); // 5
TypeScript
const xs: number[] = [2, 4, 6, 8];
const mean = xs.reduce((a, b) => a + b, 0) / xs.length;
console.log(mean); // 5
Python
xs = [2, 4, 6, 8]
print(sum(xs) / len(xs))  # 5.0 mean
Java
double[] xs = {2, 4, 6, 8};
System.out.println(java.util.Arrays.stream(xs).average().orElseThrow()); // 5
C#
double[] xs = [2, 4, 6, 8];
Console.WriteLine(xs.Average()); // 5 (using System.Linq)