Covariance Calculator
Paste two data sets as x,y pairs to find both the sample and population covariance in one step. Covariance shows whether two variables tend to move in the same direction, the opposite direction, or independently. The tool reports both estimators, the number of pairs, and a plain-language read on the direction of the relationship.
How to calculate covariance
- Type or paste your paired data in the box, one x,y pair per line.
- Separate the two numbers on each line with a comma, a space, or a tab.
- Read the Sample covariance card (divides the sum of products by n minus 1).
- Compare it to the Population covariance card (divides by n).
- Check the Pairs (n) count and the direction note, then use Copy result.
Examples
A positive relationship
1,2 2,4 3,5 4,4 5,5
Sample = 1.5, population = 1.2, n = 5
A negative relationship
1,6 2,4 3,2
Sample = -2, population = -1.333333, n = 3
A mixed data set of four pairs
2,1 4,3 6,2 8,5
Sample = 3.666667, population = 2.75, n = 4
Frequently asked questions
What is covariance?
Covariance measures how two variables change together. A positive value means they tend to rise and fall together; a negative value means one rises as the other falls; near zero means little linear co-movement.
What is the difference between sample and population covariance?
Both add up the same products of deviations from the means. Sample covariance divides that sum by n minus 1 (an unbiased estimate for a sample); population covariance divides by n (when your data is the whole population).
Why is the sample covariance larger?
It divides the same sum of products by a smaller number, n minus 1 instead of n, so its magnitude is always slightly larger than the population value. With 5 pairs the sample is 5/4 times the population figure.
How do I enter my data?
Put one x,y pair on each line and separate the two numbers with a comma, a space, or a tab. Blank lines are ignored, and every non-empty line must contain exactly two numbers.
How many pairs do I need?
At least two. Sample covariance divides by n minus 1, so a single pair would divide by zero. The lists of x and y values must also be equal in length since each x pairs with one y.
How is covariance different from correlation?
Correlation is covariance scaled by the two standard deviations, giving a unitless value between -1 and 1. Covariance keeps the original units and is unbounded, so its size alone does not tell you how strong the link is.
How precise are the results?
Both covariance figures are rounded to about six decimal places, and a value that computes to negative zero is shown as 0. That precision is well beyond most real data sets.
Can covariance be negative or zero?
Yes. A negative covariance means the variables move in opposite directions, and a value at or near zero means no linear relationship. The direction note under the result reflects the sign of the sample value.
Is my data private?
Yes. All parsing and calculation happen in your browser, so your numbers are never uploaded. You can even use the tool offline once the page has loaded.
Learn more
- Covariance vs correlation
How covariance and correlation relate, why one has units and the other does not, and when to reach for each when comparing two variables.
Related tools
Correlation Coefficient Calculator
Calculate the Pearson correlation coefficient r and r squared from two data sets. Paste paired x,y values to measure linear association. Free and private.
Linear Regression Calculator
Fit a least squares line to your x and y data. Get the slope, intercept, equation, r-squared, and correlation, plus a scatter plot, in your browser.
Standard Deviation Calculator
Calculate standard deviation and variance online. Paste a list of numbers to get the mean, count, and both sample and population results instantly.
Descriptive Statistics Calculator
Get a full descriptive statistics summary from a list of numbers: mean, median, mode, variance, standard deviation, quartiles and the interquartile range.
Annulus Area Calculator
Calculate the area of an annulus, the ring between two concentric circles, from its outer and inner radius. Returns both circumferences and width too. Free.
Area Calculator
Find the area of a circle, square, rectangle, triangle, trapezoid, parallelogram, ellipse, sector or rhombus. Free and runs in your browser.