Descriptive statistics calculator

Descriptive statistics calculator: mean, median, mode, standard deviation, variance, quartiles, IQR, outliers, skewness and kurtosis, with a histogram.

Drafted with AI writing toolsUpdated Checked examples: 7

Numbers separated by commas, spaces or new lines (the default is 18 commute times in minutes).
More options
Blank uses Sturges' rule, ⌈log₂ n⌉ + 1 bins. Edges snap to steps of 1, 2, 2.5 or 5 times a power of 10, so the bin count can differ a little from this.
Try
Mean
Mean: 26.666667
Maximum decimal places: 6; Nearest, ties away from zero
Median
24.5
Mode
22 (occurs 2 times)
Count n
18
Sum
480
Minimum
12
Maximum
64
Range
52
Sample variance s²
136.588235
Sample standard deviation s
11.687097
Population variance σ²
129
Population standard deviation σ
11.357817
Standard error of the mean
2.754675
First quartile Q1
19.5
Third quartile Q3
30.5
Interquartile range
11
Outliers
64: outside the 1.5·IQR fences 3 and 47
Skewness (G1)
1.959304
Excess kurtosis (G2)
5.600893
Coefficient of variation
43.83%

The mean is 26.6667 and the median is 24.5. The sample standard deviation is 11.6871, and the middle half spans 19.5 to 30.5. The data are right-skewed (a longer tail of high values). Values outside the 1.5·IQR fences: 64. Review their context before deciding how to use them.

Histogram (6 bins of width 10)

10 to 20: 5510 to 2020 to 30: 8820 to 3030 to 40: 4430 to 4040 to 50: 0040 to 5050 to 60: 0050 to 6060 to 70: 1160 to 70

Box plot (whiskers at the most extreme values inside the fences)

2030405060Median 24.5
Frequency table (a value on a bin edge counts in the higher bin) Rows: 6
BinCountRelative frequencyCumulative
10 to 20527.78 %27.78 %
20 to 30844.44 %72.22 %
30 to 40422.22 %94.44 %
40 to 5000 %94.44 %
50 to 6000 %94.44 %
60 to 7015.56 %100 %
How it's calculated S
  1. Sum and mean

    xˉ=∑xin=48018=26.666667\bar x = \frac{\sum x_i}{n} = \frac{480}{18} = 26.666667
  2. Median

    x~=24.5\tilde x = 24.5

    The average of the sorted values at positions 9 and 10.

  3. Variance and standard deviation

    s2=∑(xi−xˉ)2n−1=2,32217=136.588235,s=11.687097;σ2=2,32218=129s^2 = \frac{\sum (x_i - \bar x)^2}{n - 1} = \frac{2{,}322}{17} = 136.588235,\quad s = 11.687097;\qquad \sigma^2 = \frac{2{,}322}{18} = 129

    Two-pass computation in 50-digit decimals: the mean first, then squared deviations from it.

  4. Standard error of the mean

    SE=sn=11.68709718=2.754675SE = \frac{s}{\sqrt n} = \frac{11.687097}{\sqrt{18}} = 2.754675
  5. Quartiles (R-7)

    h1=(18−1)×0.25+1=5.25, Q1=19.5;h3=(18−1)×0.75+1=13.75, Q3=30.5h_1 = (18-1)\times0.25+1 = 5.25,\ Q_1 = 19.5;\quad h_3 = (18-1)\times0.75+1 = 13.75,\ Q_3 = 30.5

    Linear interpolation (R-7, Excel QUARTILE.INC): Q_p sits at position (n − 1)p + 1 of the sorted data, interpolating between neighbours.

  6. Histogram bins

    Sturges' rule: ⌈log₂ 18⌉ + 1 = 6 bins. The raw width is 8.667; using a round step of 10 from 10 gives 6 bins.

  7. Outlier fences

    Q1−1.5 IQR=3,Q3+1.5 IQR=47Q_1 - 1.5\,IQR = 3,\quad Q_3 + 1.5\,IQR = 47

    Values outside the fences: 1.

  8. Skewness and excess kurtosis

    G1=n(n−1)n−2⋅m3m23/2=1.959304,G2=(n−1)[(n+1)(m4m22−3)+6](n−2)(n−3)=5.600893G_1 = \frac{\sqrt{n(n-1)}}{n-2}\cdot\frac{m_3}{m_2^{3/2}} = 1.959304,\quad G_2 = \frac{(n-1)\left[(n+1)\left(\frac{m_4}{m_2^2}-3\right)+6\right]}{(n-2)(n-3)} = 5.600893

    m_k = Σ(x − x̄)^k / n are the central moments. These match Excel SKEW and KURT.

About the descriptive statistics calculator

Descriptive statistics summarise a data set by its centre, spread and shape. The mean is the sum divided by n; the sample variance divides the squared deviations from the mean by n − 1 and the population variance by n. Quartiles come from the sorted data by linear interpolation (R-7, as Excel QUARTILE.INC), the exclusive method (R-6) or Tukey's hinges, and skewness and excess kurtosis use the adjusted formulas of Excel SKEW and KURT.

Values more than 1.5 × IQR beyond the quartiles are flagged as outliers, following Tukey's box-plot rule. The default data, 18 commute times in minutes, have a mean of 26.67 and a median of 24.5; the 64-minute trip lies beyond the upper fence of 47 and pulls the mean above the median.

Use the sample standard deviation when the data are a sample from a larger group, and the population value when they are the whole group.

How to calculate standard deviation by hand

Standard deviation is the square root of the average squared distance from the mean: σ = √(Σ(x − μ)² ÷ n) for a population, s = √(Σ(x − x̄)² ÷ (n − 1)) for a sample. For the quiz marks 2, 4, 4, 4, 5, 5, 7 and 9, σ = 2 and s = 2.138.

  1. Find the mean: the marks add up to 40, and 40 ÷ 8 = 5.
  2. Subtract the mean from each value and square the result.
Mark xDeviation x − 5Squared deviation
2−39
4−11
4−11
4−11
500
500
724
9416
Sum032
  1. Add the squared deviations: 32. The deviations themselves always sum to 0, which checks step 2.
  2. Divide to get the variance: 32 ÷ 8 = 4 for the population variance σ², or 32 ÷ 7 = 4.571429 for the sample variance s².
  3. Take the square root: σ = √4 = 2 and s = √4.571429 = 2.138090.

Step 4 is the variance formula, σ² = Σ(x − μ)² ÷ n or s² = Σ(x − x̄)² ÷ (n − 1), as given in the NIST/SEMATECH e-Handbook, §1.3.5.6.

Variance is in squared units, marks² here, which is why the square root is taken: the standard deviation, 2.14 marks, is back on the scale of the data and can be compared with the mean.

Sample or population: which to use

Divide by n when the data are the whole group you want to describe, such as every student in one class. Divide by n − 1 when they are a sample standing in for a larger group, such as eight students surveyed about a whole year group.

Deviations from a sample's own mean run slightly small, and n − 1 corrects for that. The sample result is larger by a factor of √(n ÷ (n − 1)), which matters for small data sets and fades as n grows:

Values nSample SD ÷ population SD
21.4142
31.2247
51.1180
101.0541
301.0171
1001.0050
1,0001.0005

Software defaults differ:

ToolSample (n − 1)Population (n)
ExcelSTDEV.SSTDEV.P
Python statistics modulestdev()pstdev()
NumPynp.std(x, ddof=1)np.std(x), the default
pandasDataFrame.std(), the defaultDataFrame.std(ddof=0)
This calculatorSample standard deviation sPopulation standard deviation σ

NumPy's std divides by n unless told otherwise, while pandas divides by n − 1, so the same column gives two answers. Excel's STDEV.S skips text and empty cells in a range, so a number stored as text silently drops out.

Mean, median, mode and range

The mean is the sum divided by the count, 40 ÷ 8 = 5. The mode, the most frequent value, is 4, and it is the only one of these measures that also works for categories. The range, 9 − 2 = 7, depends on just two values.

The median is the middle of the sorted data, at position (n + 1) ÷ 2. Eight marks put it halfway between the 4th and 5th values, 4 and 5, so the median is 4.5. An odd count gives a single value: 9, 1, 5, 3, 7 sorts to 1, 3, 5, 7, 9, median 5.

The median ignores how far the extremes reach, so a mean above the median points to a longer tail of high values. Here the 9 pulls the mean half a mark above the median, and the sample skewness is 0.818.

Quartile methods compared

Q1 and Q3 cut off the lowest and highest quarters of the sorted data, and the interquartile range, Q3 − Q1, is the spread of the middle half. Hyndman and Fan (1996) list nine ways to place them. Three common ones disagree on the quiz marks:

MethodQ1Q3IQR1.5 × IQR fencesIs the 9 an outlier?
Linear interpolation (R-7)45.51.51.75 and 7.75Yes
Exclusive (R-6)46.52.50.25 and 10.25No
Tukey's hinges4621 and 9No, it sits on the fence
  • R-7 places Q3 at position (n − 1) × 0.75 + 1 = 6.25 in the sorted list, a quarter of the way from the sixth value (5) to the seventh (7). It is Excel's QUARTILE.INC, the default of R's quantile() and of NumPy's percentile().
  • R-6 uses position (n + 1) × 0.75 = 6.75 instead. It is Excel's QUARTILE.EXC and the method R's documentation attributes to Minitab and SPSS. Python's statistics.quantiles() uses it by default.
  • Tukey's hinges are the medians of the lower half (2, 4, 4, 4) and the upper half (5, 5, 7, 9). R's fivenum() reports these.

With only eight values, the method alone decides whether the 9 counts as an outlier. Before comparing quartiles or outlier counts with a textbook or another program, find out which method it uses.

Common mistakes

  • Reporting the standard error as the spread. The standard error of the mean, s ÷ √n, measures how precisely the sample mean estimates the population mean. For the quiz marks it is 2.138 ÷ √8 = 0.756, almost three times smaller than s. It is what a confidence interval for the mean is built from.
  • Using the coefficient of variation without a true zero. The CV, s ÷ |mean| × 100, is 42.76% for the marks and compares spread across data on different scales. It is meaningless for temperatures in °C or any measure that can be negative, because a mean near zero inflates it without limit.
  • Trusting the one-pass formula. The shortcut (Σx² − (Σx)² ÷ n) ÷ (n − 1) loses precision when values are large and close together. On NIST's NumAcc3 data set, 1,001 values near 1,000,000.2 with a certified standard deviation of 0.1, the shortcut in Python floats returns 0.1072. Subtracting the mean first, as in step 2, gives 0.1 to ten digits even in floats.
  • Measuring spread with one value. A single value has nothing to vary from, and the sample formula would divide by zero, so at least two values are needed.

Once the mean and standard deviation are known, the normal distribution calculator turns any value into a z-score and percentile, provided the data look roughly bell-shaped.

Worked examples

Commute times (default data)

Data
12, 15, 17, 18, 19, 21, 22, 22, 24, 25, 27, 28, 29, 31, 33, 35, 38, 64
Quartile method
Linear interpolation (R-7, Excel QUARTILE.INC)
Count n
18
Sum
480
Mean
26.666667
Median
24.5
Mode
22 (occurs 2 times)
Sample variance s²
136.588235
Sample standard deviation s
11.687097
Population variance σ²
129
Standard error of the mean
2.754675
First quartile Q1
19.5
Third quartile Q3
30.5
Interquartile range
11
Outliers
64: outside the 1.5·IQR fences 3 and 47
Skewness (G1)
1.959304
Excess kurtosis (G2)
5.600893
Coefficient of variation
43.83%

Checked against: Statistics (mean, median, multimode, variance, pvariance, quantiles method='inclusive') and fractions for G1/G2 (Excel SKEW/KURT formulas) with decimal square roots

NIST StRD NumAcc1

Data
10000001, 10000003, 10000002
Quartile method
Linear interpolation (R-7, Excel QUARTILE.INC)
Mean
10,000,002
Sample standard deviation s
1
Median
10,000,002
Skewness (G1)
0

Checked against: NIST StRD NumAcc1 certified values: mean 10000002, standard deviation 1

NIST StRD NumAcc3 (1001 values near 10⁶)

Data
1000000.2 1000000.1 1000000.3 1000000.1 1000000.3 1000000.1 1000000.3 1000000…
Quartile method
Linear interpolation (R-7, Excel QUARTILE.INC)
Count n
1,001
Mean
1,000,000.2
Sample standard deviation s
0.1
Median
1,000,000.2
Excess kurtosis (G2)
-2.003003

Checked against: NIST StRD NumAcc3 certified values: mean 1000000.2, standard deviation 0.1; confirmed exactly with exact fractions (G2 = −667/333)

Exclusive quartiles (R-6)

Data
7, 15, 36, 39, 40, 41
Quartile method
Exclusive (R-6, Excel QUARTILE.EXC, Minitab)
First quartile Q1
13
Third quartile Q3
40.25
Median
37.5
Interquartile range
27.25

Checked against: Independent calculation

Questions

What is the difference between sample and population standard deviation?

The sample standard deviation divides the sum of squared deviations by n − 1 (Bessel's correction), the population one by n. Deviations measured from the sample mean run slightly small, and n − 1 compensates when estimating a larger population's spread. For the 18 default values s = 11.687 and σ = 11.358, and the gap shrinks as n grows. Excel's STDEV.S and STDEV.P follow the same split.

How are outliers identified?

By Tukey's rule: a value is an outlier if it lies below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. For the default data Q1 = 19.5 and Q3 = 30.5, so the IQR is 11, the fences are 3 and 47, and the 64 is flagged. Values beyond 3 × IQR are often called extreme outliers. A flagged value is a prompt to check the data, not a reason to delete it.

Why do quartiles differ between Excel, calculators and textbooks?

Hyndman and Fan (1996) list nine published definitions. Excel QUARTILE.INC and R's default interpolate at position (n − 1)p + 1, QUARTILE.EXC and Minitab use (n + 1)p, and many textbooks use Tukey's hinges, the medians of each half. For 7, 15, 36, 39, 40, 41 these give Q1 and Q3 of 20.25 and 39.75, 13 and 40.25, and 15 and 40.

What do skewness and kurtosis values mean?

Skewness measures asymmetry: 0 for symmetric data, positive when the long tail is on the high side. Bulmer's (1979) rule of thumb reads |G1| below 0.5 as roughly symmetric, 0.5 to 1 as moderately skewed and above 1 as highly skewed. Excess kurtosis compares tail weight with a normal distribution, which scores 0. The default data give G1 = 1.96 and G2 = 5.60, both driven by the 64-minute trip.

When should I use the median instead of the mean?

When the data are skewed or contain outliers, because one extreme value moves the mean but not the median. In the default data the 64-minute trip lifts the mean to 26.67 while the median is 24.5; without that trip the mean would be 24.47 and the median 24. Incomes and house prices are usually reported as medians for the same reason.

About this calculator

xˉ=1n∑xi,s2=∑(xi−xˉ)2n−1,G1=n(n−1)(n−2)∑(xi−xˉs)3\bar x = \frac{1}{n}\sum x_i,\qquad s^2 = \frac{\sum (x_i - \bar x)^2}{n-1},\qquad G_1 = \frac{n}{(n-1)(n-2)}\sum\left(\frac{x_i-\bar x}{s}\right)^3

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5 Quantitative techniques (location, scale, skewness and kurtosis)
  2. NIST Statistical Reference Datasets — univariate summary statistics (NumAcc1–4)
  3. Hyndman & Fan (1996), Sample quantiles in statistical packages, The American Statistician 50(4)
  4. Microsoft Excel SKEW and KURT functions

Checked against references

This calculator includes 7 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.

Put this calculator on your site

Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.

Height
Preview the embed

Keep the credit line. It is the only condition, and it is what keeps these calculators free.