Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Covariance Calculator

Calculate covariance between two datasets to see how they vary together. Enter paired values to get covariance plus helpful intermediate results.

Enter the Details

Use this calculator to estimate the covariance of any two sets of data. It computes
the sample covariance and population covariance of two variables, and also outputs the means of X and Y.

Values (x,y):
First column contains values of the independent variable (X), second column contains values of the dependent variable (Y).
Column delimiter is space or comma. Enter one x,y pair per row.


Result will appear here...


Last updated: March 17, 2026

Created by: Eon Tools Dev Team

Reviewed by: Ankit Khatiwada



What the covariance calculator does

Covariance measures how two variables move together. This calculator takes paired x and y data and works out the covariance, in both its sample and population forms, along with the mean of each variable. A positive result means they tend to rise and fall together, and a negative one means they move in opposite directions.

It is the raw measure of a linear relationship, and the quantity that correlation and regression are built on. Below is how it works and how to read it.

How to use it

  1. Enter your data in the box, one x,y pair per row, values separated by spaces or commas.
  2. Press Calculate for the sample and population covariance and the two means, or Reset to clear it.

How covariance is worked out

Covariance looks at how far each value sits from its own mean, and whether the two variables stray from their means together. For each pair, it multiplies how far x is from the mean of x by how far y is from the mean of y, then averages those products:

Covariance = the average of (x minus mean of x) × (y minus mean of y)

When x and y are both above their means, or both below, the product is positive. When one is above while the other is below, the product is negative. Averaging these across all the pairs gives a single number whose sign captures the overall direction in which the two variables move together.

Reading the sign

The sign is the clearest thing covariance tells you. A positive covariance means the two variables tend to move in the same direction: when one is high, the other tends to be high. Height and weight have positive covariance, as taller people tend to weigh more.

A negative covariance means they move in opposite directions: when one is high, the other tends to be low, like the amount of a product for sale and its price. A covariance near zero means there is little linear tendency either way, with the two variables not tracking each other in a straight-line sense.

Why the size is hard to read

The sign of covariance is easy to interpret, but its size is not. The number depends entirely on the units of the two variables. Measure the same data in centimetres instead of metres, or dollars instead of cents, and the covariance changes, even though the relationship has not.

This is the one real drawback of covariance, and it is exactly why correlation exists. Correlation takes the covariance and rescales it into a number between minus 1 and 1, stripping out the units so the strength of the relationship can be compared across different data. So use covariance for the direction of a relationship, and turn to correlation when you want to judge how strong it is.

Sample versus population

The calculator gives two versions. The population covariance divides the total by the number of pairs, and is right when your data is the whole group you care about. The sample covariance divides by one less than the number of pairs, and is right when your data is a sample used to estimate a larger population.

Dividing by one less for a sample is the same correction that appears in the sample variance. It nudges the estimate up slightly to make up for the fact that a sample tends to look a little tighter than the population it came from. For most real data, which is a sample, the sample covariance is the one to use.

A worked example

Suppose you enter the pairs (1, 5), (2, 9), (3, 19), and (5, 25). The mean of x is 2.75 and the mean of y is 14.5.

Working through the deviations gives a sample covariance of about 15.17 and a population covariance of about 11.38. Both are positive, which says that as x rises, y tends to rise too. But the size, 15 or 11, is not directly meaningful on its own, since it hangs on the units of the data. To judge how strong that upward relationship is, you would convert it into a correlation.

Entering your data

Enter one x,y pair per row, with the two values separated by a space or comma, and the same number of rows for each variable. The calculator returns the sample and population covariance and the two means. Remember that the sign is the readily interpretable part, while the size depends on the units.

Questions people ask

What is covariance?

A measure of how two variables move together, found by averaging the product of each pair's distances from their two means. Its sign shows the direction of the relationship.

What does a positive or negative covariance mean?

Positive means the variables tend to rise and fall together; negative means they move in opposite directions. Near zero means little linear tendency either way.

How is covariance different from correlation?

Correlation is covariance rescaled to a number between minus 1 and 1, free of units. Covariance gives the direction; correlation gives a comparable measure of strength.

Should I use the sample or population version?

Use the sample version when your data is a sample estimating a larger group, which is the usual case. Use the population version when your data is the entire group.

References

A quick note on where the methods here come from. Covariance and its relationship to correlation are set out in the NIST/SEMATECH e-Handbook of Statistical Methods, the US government's public statistics reference. OpenStax Introductory Statistics is a free, widely used textbook covering covariance and correlation.

  1. NIST/SEMATECH e-Handbook of Statistical Methods (covariance and correlation). https://www.itl.nist.gov/div898/handbook/
  2. OpenStax, Introductory Statistics (correlation and covariance). https://openstax.org/details/books/introductory-statistics-2e


Ankit Khatiwada

Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.