Covariance Calculator

Calculate sample and population covariance to see how two paired numerical variables vary together.

Calculate covariance
Enter equal-length X and Y data sets separated by commas, spaces, or semicolons.

About covariance

Covariance measures whether two paired numerical variables tend to move together. A positive covariance means observations above the mean of X are generally paired with observations above the mean of Y, and values below the two means also tend to occur together. A negative covariance means above-average values of one variable tend to accompany below-average values of the other. A value near zero indicates little net linear co-movement, but it does not rule out a nonlinear relationship. The calculation first finds the arithmetic mean of each list. For every pair, it multiplies the deviation of X from its mean by the deviation of Y from its mean, then adds those products. Pairs moving in the same direction contribute positive products, while pairs moving in opposite directions contribute negative products. The final divisor determines whether the result is population or sample covariance. Population covariance divides the cross-product sum by n and is appropriate when the entered pairs are the complete population of interest. Sample covariance divides by n minus 1, applying Bessel's correction because the sample means are estimated from the same observations. The sample result is therefore slightly farther from zero whenever there are at least two pairs. This calculator displays both so you can select the value that matches your data and analysis. Unlike correlation, covariance retains measurement units. If X is measured in meters and Y in seconds, covariance is measured in meter-seconds. Rescaling either variable changes the magnitude, making generic labels such as weak or strong inappropriate. Pearson correlation standardizes covariance by the two standard deviations and is usually easier for comparing relationships across different scales. Pairing and order are essential. Each X value must correspond to the Y value observed for the same person, item, location, or time. Sorting one list independently destroys those pairings and produces a meaningless answer. Missing observations should be handled consistently as complete pairs, and both lists must have equal length. Outliers can dominate the cross-product sum, so a scatterplot and data-quality review should accompany the calculation. Covariance is widely used in portfolio analysis, multivariate statistics, regression, signal processing, and exploratory research. A positive asset covariance suggests returns often move together, while a negative value may indicate diversification potential. In every setting, interpret the sign and magnitude with the variables' units, sampling design, uncertainty, and subject-matter context.

Covariance examples

These paired data sets demonstrate positive, negative, and zero covariance.

Paired DataCovarianceInterpretation
X: 1,2,3,4,5; Y: 2,4,5,4,5Sample 1.5; population 1.2The two variables generally rise together.
X: 1,2,3,4; Y: 8,6,4,2Sample -3.33333333; population -2.5Y falls consistently as X rises.
X: 1,2,3; Y: 4,4,4Sample 0; population 0Y has no variation, so every centered product is zero.

How to calculate covariance

  1. Enter the first variable's observations in their original paired order.
  2. Enter the matching second-variable observations with the same number of values.
  3. Select Calculate Covariance to get sample covariance, population covariance, and both means.
  4. Choose the sample or population result according to whether the data are a sample or the complete population.

Covariance FAQ

What is the difference between sample and population covariance?

Population covariance divides by n because all members are included. Sample covariance divides by n minus 1 to correct estimation bias.

What does negative covariance mean?

It means the variables tend to move in opposite directions around their means. The magnitude depends on measurement units and should not be judged with a universal cutoff.

Is covariance the same as correlation?

No, covariance retains the product of the variables' units. Correlation standardizes covariance and always falls between negative one and positive one.

Why must both lists have equal length?

Covariance is calculated from matched pairs, so every X requires one corresponding Y. Unequal lists leave observations unpaired and do not define the statistic.

Can covariance prove one variable causes another?

No, it only summarizes observed linear co-movement. Confounding, time trends, selection, or coincidence can produce covariance without causation.