Statistics

Covariance Calculator

Calculate the covariance between two variables.


Covariance Calculator

Advertisement

Measures how two variables move together — positive when they tend to rise and fall together, negative when they move in opposite directions.

How it works

For each pair of values, the product of their deviations from their own means is summed, then divided by one less than the number of pairs.

What this does not include

This does not include normalizing to a fixed -1 to 1 scale — for that standardized version, use this site’s correlation coefficient calculator instead.

How to use this calculator

  1. Enter two equal-length lists of paired values.

A worked example

x = 1, 2, 3, 4, 5 and y = 2, 4, 6, 8, 10 (y is always exactly 2× x) → covariance = 5, a strong positive value.

x = 1, 2, 3, 4 and y = 4, 3, 2, 1 (y falls as x rises) → covariance = −1.6667, negative as expected.

What the variables mean

Variable Meaning
x, y Two equal-length lists of paired values
n − 1 Bessel’s correction, used when estimating from a sample rather than a full population

Edge cases worth knowing

Covariance keeps the original units of the data, unlike correlation — its raw magnitude depends on the scale x and y were measured in, which is exactly why correlation exists as a separate, unit-free version.

A covariance near zero doesn’t rule out a relationship — it only measures a linear tendency; two variables can be strongly related in a curved, non-linear way that covariance won’t detect at all.

Frequently asked questions

What does a covariance of zero mean?

The two variables show no linear tendency to move together — though they could still be related in a non-linear way that covariance doesn’t detect.

Why isn’t covariance bounded like correlation is?

Covariance keeps the original units and scale of the data, so its magnitude depends on how the variables are measured — correlation deliberately strips that scale away to allow comparison across different datasets.

Why divide by n-1 instead of n?

This is Bessel’s correction, the standard adjustment used when estimating a population’s spread from a sample rather than the entire population.

Be the first to rate this

Written by

J. Adeyemi

Statistics writer

J. Adeyemi writes the statistics and probability calculators, from descriptive summaries through to distributions and conditional probability. The recurring theme is scope: each page states precisely which question it answers, because most statistical mistakes come from applying a correct formula to the wrong question. Related-but-different measures get separate pages rather than being quietly merged.

Reviewed by

K. Novak

Calculator reviewer — statistics

K. Novak reviews the statistics and probability calculators, checking formula correctness and the scope boundary each page draws around itself. Closely related measures are routinely confused with one another, so review confirms that a page computing one of them says clearly that it is not computing the others.

How we write and review

Related calculators