Statistics Calculator

—

—

Separate values with spaces, line breaks, commas or semicolons. Use . as the decimal point. No thousands separators.

Results
Countn—
SumΣx—
Meanx̄—
Medianx̃—
ModeMo—
Minimummin—
Maximummax—
RangeR—
Standard deviation (sample)s—
Variance (sample)s²—
Standard deviation (population)σ—
Variance (population)σ²—
Standard error of the meanSE—
Coefficient of variationCV—
First quartileQ₁—
Third quartileQ₃—
Interquartile rangeIQR—
Sum of squaresΣx²—
Sorted data and frequencies

This statistics calculator turns a list of numbers into the summary you need for a report, a lab sheet or homework: the average and the middle value, how spread out the numbers are, and where the quartiles fall. Type values on the keypad or paste a column straight from a spreadsheet; every statistic updates as you go and your data stays in this browser.

  • Mean, median, mode, minimum, maximum and range
  • Sample and population standard deviation and variance
  • Quartiles Q1 and Q3 and the interquartile range, as in spreadsheets
  • Standard error of the mean and coefficient of variation
  • Paste up to 1,000 values, with optional frequencies
  • Exact decimal arithmetic, checked against NIST reference data

How to use the statistics calculator

  1. Type a number on the keypad and press DATA, or paste or type your numbers into the Data box. Spaces, line breaks, commas and semicolons all separate values.
  2. If your data is a frequency table, tick “Each line is a value and its frequency” and write one line per value, for example “20 3” for three twenties. On the keypad, press FRQ between the value and its frequency.
  3. Read the results table: count, sum, mean, median, mode, minimum, maximum, range, both standard deviations and variances, standard error, coefficient of variation and quartiles.
  4. Press DEL to remove the last value or CLR to start again. “Copy all results” copies the table as text you can paste into a document or spreadsheet.
  5. Open “Sorted data and frequencies” to check what the calculator read: every value in order, with how often it occurs.

What each statistic means

The table lists the definitions the calculator uses. They are the same as the spreadsheet functions AVERAGE, MEDIAN, VAR.S, VAR.P, STDEV.S, STDEV.P and QUARTILE.INC, so you can check any result against a spreadsheet.

Formulas used by the calculator
StatisticFormulaWhat it tells you
Meanxˉ=1n∑i=1nxiThe balance point of the data: the sum divided by the count.
Medianx~=Q(0.5)The middle value of the sorted data; half of the values are below it. It is not pulled by a few extreme values.
Variance (sample)s2=∑(xi−xˉ)2n−1The average squared distance from the mean, divided by n − 1 because the mean was itself estimated from the sample.
Variance (population)σ2=∑(xi−xˉ)2nThe same squared distances divided by n, for data that is the whole population.
Standard deviation (sample)s=s2The square root of the variance, in the same units as the data: a typical distance from the mean.
Standard error of the meanSE=snHow precisely the sample mean estimates the true mean. It shrinks as the sample grows.
Coefficient of variationCV=s∣xˉ∣×100%The spread relative to the size of the values, as a percentage. Useful to compare data in different units.
Interquartile rangeIQR=Q3−Q1The width of the middle half of the data, between the first and third quartiles.

Sample or population: s or σ?

Use the sample standard deviation s when your numbers are a sample drawn from a larger group, such as 30 bolts out of a production run or 200 survey answers out of a city. Dividing by n − 1 instead of n (Bessel's correction) makes the variance an unbiased estimate of the group's variance.

Use the population standard deviation σ when your numbers are the entire group you care about, such as the marks of every student in one class. With many values the two are almost equal; with few values s is noticeably larger than σ.

Worked example, step by step

Take the eight values 2, 4, 4, 4, 5, 5, 7 and 9 (press “Load an example” to enter them).

  1. Add the values and divide by the count to get the mean: xˉ=2+4+4+4+5+5+7+98=408=5
  2. Subtract the mean from each value, square the differences and add them up: ∑(xi−xˉ)2=9+1+1+1+0+0+4+16=32
  3. Divide by n − 1 = 7 for the sample variance, or by n = 8 for the population variance: s2=327≈4.571428571σ2=328=4
  4. Take the square roots to get the standard deviations: s=327≈2.138089935σ=4=2

The median is 4.5, the average of the two middle values 4 and 5, and the mode is 4 because it occurs three times. The calculator shows exactly these numbers.

Quartiles and the interquartile range

There are several ways to compute quartiles. This calculator uses the inclusive method of the spreadsheet functions QUARTILE.INC and PERCENTILE.INC (type 7 in the classification of Hyndman and Fan): sort the n values, number them from 0, and interpolate at position h:

h=(n−1) pQ(p)=x⌊h⌋+(h−⌊h⌋) (x⌊h⌋+1−x⌊h⌋)

For the sorted values 1, 2, 4, 7, 8, 9, 10 and 12, n = 8, so the first quartile sits three quarters of the way between the second and third values:

h=7×0.25=1.75  ⇒  Q1=2+0.75 (4−2)=3.5

The same rule gives Q3 = 9.25 and an interquartile range of 5.75. Textbooks that use the “median of each half” method can give slightly different quartiles for small data sets; both are correct under their own definition.

Entering and pasting data

You can paste a whole column from a spreadsheet, a row of comma-separated values or text with one number per line. Numbers may have a sign and an exponent, such as -2.5 or 1.5e3. Do not include thousands separators: 1,234 is read as the two values 1 and 234.

In frequency mode each line holds a value and how many times it occurs, separated by a space, a tab, a colon or a semicolon. A line with only a value counts once. The calculator accepts up to 1,000 values or lines and frequencies up to 1,000,000.

Your data is saved in this browser only, so it is still there when you come back. It is never sent to our server. Clear it with CLR.

How precise are the results?

Every number is read exactly as you typed it and the calculator works in decimal arithmetic (bignumber.js), not in binary floating point. Sums, sums of squares and the variance numerator are exact; only the final divisions and square roots are rounded, to more than 40 significant digits.

Results are shown to 15 significant digits. That avoids the classic errors of the one-pass variance formula, which can lose every digit when the values are large and close together, as the NIST examples below show.

Accuracy and test cases

Every statistic on this page is checked automatically before each release against 56 test cases, including the NIST Statistical Reference Datasets for univariate summary statistics. The table shows a selection; run all of them in your own browser to see the same engine you are using pass.

Test cases: input, exact value, what the calculator shows, what plain double-precision arithmetic gives
InputExact valueCalculator showsPlain floating pointCheck
NIST Statistical Reference Datasets Certified mean and sample standard deviation to 15 significant digits. NumAcc3 and NumAcc4 have large values that differ only in the last digits; the plain floating-point column shows how much the one-pass formula loses.
xˉ (PiDigits, n=5000)Source: NIST StRD PiDigits (lower difficulty)4.53484.53484.5348—
s (Lew, n=200)Source: NIST StRD Lew (lower difficulty)277.332168044316277.332168044316277.3321680443161—
s (Mavro, n=50)Source: NIST StRD Mavro (lower difficulty)0.0004291234540030530.0004291234540030530.00042912345384629323—
xˉ (Michelso, n=100)Source: NIST StRD Michelso (lower difficulty)299.8524299.8524299.85239999999993—
s (Michelso, n=100)Source: NIST StRD Michelso (lower difficulty)0.07901054781905180.07901054781905180.07901054823364537—
s (NumAcc3, n=1001)Source: NIST StRD NumAcc3 (average difficulty)0.10.10.10723805294763608—
xˉ (NumAcc4, n=1001)Source: NIST StRD NumAcc4 (higher difficulty)10000000.210000000.210000000.200000098—
s (NumAcc4, n=1001)Source: NIST StRD NumAcc4 (higher difficulty)0.10.10—
Centre: mean, median, mode Includes the examples from the spreadsheet documentation of MEDIAN and MODE.MULT.
xˉ (2,4,4,4,5,5,7,9)408=55——
median⁡(1,2,3,4,5)Source: Microsoft Excel MEDIAN documentation example—3——
median⁡(1,2,3,4,5,6)Source: Microsoft Excel MEDIAN documentation example3+423.5——
mode⁡1(1,2,3,4,3,2,1,2,3)Source: Microsoft Excel MODE.MULT documentation example—2——
mode⁡2(1,2,3,4,3,2,1,2,3)Source: Microsoft Excel MODE.MULT documentation example—3——
Spread: variance and standard deviation Sample (n − 1) and population (n) versions of the same data.
σ (2,4,4,4,5,5,7,9)Source: Wikipedia: Standard deviation (population example)328=22——
s (2,4,4,4,5,5,7,9)3272.1380899352994——
Quartiles Inclusive method, as QUARTILE.INC.
Q1 (1,2,4,7,8,9,10,12)Source: Microsoft Excel QUARTILE.INC documentation example—3.5——
Q3 (1,2,4,7,8,9,10,12)9+14(10−9)9.25——
Decimal values that binary floating point gets wrong Exact decimal arithmetic gives the result you would get by hand.
0.1+0.23100.30.30000000000000004—
∑i=1100.1110.9999999999999999—
s2 (108+0.1, 108+0.2, 108+0.3)11000.01−2—
Reading pasted data Separators, frequencies and exponents.
xˉ (1×1, 2×1, 3×2)1+2+3⋅24=942.25——
1,5; 2,5 / 3—7——
Invalid input What the calculator says instead of a wrong number.
  —Enter at least one number.——
1 2 abc—Not a number: “abc” (entry 3).——
5—Sample statistics need at least 2 values.——

Show every test case

For a single statistic with a step-by-step explanation, or for other kinds of maths, try these calculators.

Frequently asked questions

What is the difference between sample and population standard deviation?

The sample standard deviation divides the sum of squared deviations by n − 1, the population standard deviation by n. Use the sample version when your data is a sample of a larger group, which is the usual case in surveys and experiments.

Why does my textbook give different quartiles?

Quartiles have several accepted definitions. This calculator uses the inclusive method of QUARTILE.INC in spreadsheets. Some textbooks take the median of each half of the data instead, which can differ for small data sets.

What if no value repeats?

Then the data has no mode and the calculator says so. If several values share the highest frequency, all of them are listed, as the spreadsheet function MODE.MULT does.

Can I enter a frequency table?

Yes. Tick “Each line is a value and its frequency” and write one value and its frequency per line, such as “20 3”. On the keypad, type the value, press FRQ, type the frequency and press DATA.

How many values can I enter?

Up to 1,000 values, or 1,000 lines in frequency mode with frequencies of up to 1,000,000 each. For larger data sets, a spreadsheet or statistics package is the better tool.

Is my data sent anywhere?

No. All calculations run in your browser and the data is saved only in this browser's local storage so you can come back to it. Clear it at any time with CLR.

How do I know the results are correct?

The calculator is tested against the NIST Statistical Reference Datasets and the documented spreadsheet examples. The “Accuracy and test cases” section lists them, and you can run every check in your own browser.