# Standard Deviation and Variance Calculator

Enter numbers separated by comma or space, then click Calculate.

 Sample Standard Deviation $s=$ Sample Variance $s^2=$ Population Standard Deviation $\sigma=$ Population Variance $\sigma^2=$

## Formulas for Standard Deviation and Variance

Sample Standard Deviation ($s$) and Variance ($s^2$) Formulas:

$$s=\sqrt{\frac{\sum \left(x-\hat{\mu}\right)^2}{n-1}}=\sqrt{\frac{\sum x^2-n\hat{\mu}^2}{n-1}}$$ $$s^2= \frac{\sum \left(x-\hat{\mu}\right)^2}{n-1}=\frac{\sum x^2-n\hat{\mu}^2}{n-1}$$

For the sample, $x$ refers to individual values, $\hat{\mu}$ refers to sample mean, and $n$ refers to sample size.

Population Standard Deviation ($\sigma$) and Variance ($\sigma^2$) Formulas:

$$\sigma=\sqrt{\frac{\sum \left(x-\mu\right)^2}{N}}=\sqrt{\frac{\sum x^2-N\mu^2}{N}}$$ $$\sigma^2= \frac{\sum \left(x-\mu\right)^2}{N}=\frac{\sum x^2-N\mu^2}{N}$$

For the population, $x$ refers to individual values, $\mu$ refers to population mean, and $N$ refers to population size.

If the data represents the whole population of interest, we should use the population formulas above. Otherwise, if the data only represents a subset of the population of interest, we should use the sample formulas above.
For example, all voters in an election can represent the voting population. An election survey is a sample as it only includes a subset of the voting population.

## An Example to Explain Standard Deviation Formula and Variance Formula

In this example, let us calculate the standard deviation of $1,2,3,4,5$.

If these numbers represent the whole population, we have the population size $N=5$, and the population mean $\mu=(1+2+3+4+5)/5=3$.
Next, we get the sum of squared numbers $\sum x^2=1^2+2^2+3^2+4^2+5^2=55$, $N\mu^2=5\times3^2=5\times9=45$, and the sum of squared deviations (also known as Sum of Squares, or SS) $\sum\left(x-\mu\right)^2=55-45=10$.
Therefore, the population variance is $\sigma^2=\frac{\left(55-45\right)}{5}=2$, and the population standard deviation is $\sigma=\sqrt2=1.414$.

If these numbers represent a sample of the population, we have the sample size $n=5$, and the sample mean $\hat{\mu}=(1+2+3+4+5)/5=3$.
Similarly, we get the sum of squared numbers $\sum x^2=1^2+2^2+3^2+4^2+5^2=55$, $n\hat{\mu}^2=5\times3^2=5\times9=45$, and the sum of squared deviations (also known as Sum of Squares, or SS) $\sum\left(x-\hat{\mu}\right)^2=55-45=10$.
Therefore, the sample variance is $s^2=\frac{\left(55-45\right)}{5-1}=2.5$, and the sample standard deviation is $s=\sqrt{2.5}=1.581$.