Statistics & Probability

Covariance Calculator

Enter paired X and Y values to get their covariance.

Your numbers

Separate numbers with commas, spaces or new lines. You can paste a column from a spreadsheet.
Separate numbers with commas, spaces or new lines. You can paste a column from a spreadsheet.

Your results

Sample covariance
Sample covariance
—
Population covariance
—
Mean of X
—
Mean of Y
—
Correlation r
—

Covariance Calculator by TheCalcTools

How the Covariance Calculator works

Covariance measures whether two variables move together. Positive means they tend to rise together; negative means one tends to fall as the other rises.

Its size depends on the units of the data, so it is hard to judge on its own. Dividing by both standard deviations gives the correlation coefficient, which is always between −1 and 1.

The formula

Sample covariance = Σ(x − x̄)(y − ȳ) ÷ (n − 1); population covariance divides by n

Worked example

Using the default values shown in the calculator:

X values2, 4, 6, 8
Y values (same order)3, 7, 5, 9
  1. Means: X = 5.0, Y = 6.0.
  2. Products of deviations: (−3)(−3) + (−1)(1) + (1)(−1) + (3)(3) = 16.
  3. Sample covariance = 16 ÷ 3 = 5.3333; population = 16 ÷ 4 = 4.

Result:

Sample covariance5.3333
Population covariance4.0000
Mean of X5.0000
Mean of Y6.0000
Correlation r0.8000

Frequently asked questions

Covariance or correlation?

Use correlation to compare strength across different data sets. Covariance is used inside other formulas, such as portfolio risk and regression slopes.

Sources and further reading

More in Statistics & Probability · All calculators

This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.