The expected squared deviation of a random variable from its mean; or, the average squared deviation of data about their mean.

The variance of a random variable $X$ is the expected squared deviation from its mean:

$$\mbox{Var}\left[X\right] = \mbox{E}\left[\left(X - \mbox{E}\left[X\right]\right)^2\right] = \mbox{E}\left[X^2\right] - \left(\mbox{E}\left[X\right]\right)^2.$$

As such, the variance captures the "spread" of a random variable around its expected value. The square root of the variance is the standard deviation.

The variance of a dataset is the mean squared deviation from its mean, sometimes called a "population variance."

The two kinds of variance are related. Variance in the first sense is a property of a random variable. One way to estimate that property from data (viewed as $n$ independent realizations of the variable) uses the population variance of the data. A related estimator called the "sample variance." It is equal to $n/(n-1)$ times the population variance.

Not all random variables have finite variance. This occurs when $\mbox{E}\left[X^2\right] $ diverges. For example, the Cauchy distribution (Student t distribution with 1 degree of freedom) does not have a finite variance.