Covariance Calculator

Calculate sample and population covariance between two variables.

What the Covariance Calculator does

Covariance measures whether two variables vary together. Its sign is meaningful — positive means they rise together — but its size depends entirely on the units involved, which is why correlation is usually reported instead.

Formula

  • Sample: cov = Σ((x − x̄)(y − ȳ)) ÷ (n − 1)
  • Population: cov = Σ((x − x̄)(y − ȳ)) ÷ n
  • Correlation r = cov ÷ (σx × σy)

Inputs explained

InputUnitRequiredNotes
X valuestextYesSeparate values with commas, spaces or new lines.
Y valuestextYesSeparate values with commas, spaces or new lines.
Data set typeone of 2 optionsYes

How to use it

  1. Choose Data set type.
  2. Enter X values and Y values.
  3. Select Calculate.

Worked example

X values 2, 4, 6, 8 against Y values 3, 7, 8, 12.

X
2, 4, 6, 8
Y
3, 7, 8, 12
Type
Sample

Sample covariance ≈ 9.33, correlation ≈ 0.968.

Frequently asked questions

Why is covariance hard to interpret?

Because it carries the units of both variables multiplied together. A covariance of 500 could be strong or trivial depending on the scales involved.

Related calculators