Covariance Calculator

Covariance shows whether two variables move together: positive when they rise and fall in sync, negative when one rises as the other falls. Enter paired X and Y values to get sample and population covariance plus the correlation coefficient, which scales the relationship to a −1 to 1 range.

Same count as Y, in the same order
One Y for every X

Results

Formula

Covariance averages the product of paired deviations from the means:
Cov(X,Y) = Σ(x − x̄)(y − ȳ) ÷ (n − 1)  [sample]
Dividing by the two standard deviations gives the correlation coefficient r.

How to use this calculator

  1. Enter the X values — commas or spaces between them.
  2. Enter the matching Y values in the same order.
  3. Press Calculate. Check the correlation to judge the strength, not just the direction.
Covariance Calculator — how the calculation works, illustrated
Covariance Calculator — how the calculation works, illustrated

Worked example

X: 2, 4, 6, 8 and Y: 1, 3, 4, 7.

  1. Means: x̄ = 5, ȳ = 3.75.
  2. Products of deviations: 8.25 + 0.75 + 0.25 + 9.75 = 19.
  3. Sample covariance: 19 ÷ 3 ≈ 6.333.
  4. Correlation: ≈ 0.981 — a very strong positive relationship.

Result: Sample covariance ≈ 6.333, correlation ≈ 0.981.

Frequently asked questions

What is the difference between covariance and correlation?

Covariance shows direction only, in squared mixed units, so its size is hard to interpret. Correlation divides by the standard deviations, giving a unit-free strength measure from −1 to 1.

Does a strong correlation mean one variable causes the other?

No. Correlation never proves causation — a third factor may drive both, or the pattern may be coincidence.

Why sample vs population covariance?

Sample covariance divides by n − 1 to correct bias when your pairs are a sample of a larger population; population covariance divides by n.

Related calculators