Covariance Calculator
Enter comma-separated values for X and Y (e.g. 10,34,23,54,9 and 4,5,11,15,20)
Covariance shows how two variables move together.
If one value increases and the other also increases, covariance is positive.
If one increases while the other decreases, covariance is negative.
This covariance calculator helps you measure that relationship in seconds.
No manual formulas. No long steps.
You just enter paired data values.
The calculator instantly shows the covariance result.
Covariance is widely used in statistics, finance, machine learning, and data analysis.
It helps you understand relationships between variables before deeper analysis.
If you want to learn how to calculate covariance, or verify your manual work, this tool gives fast and accurate results.
What Is Covariance?
Covariance measures the direction of the relationship between two variables.
It tells you whether both variables move together or move in opposite directions.
- When both variables increase or decrease together, the covariance is positive.
- When one increases and the other decreases, the covariance is negative.
If there is no clear movement pattern, the covariance is close to zero.
Covariance does not show the strength of the relationship.
It only shows the direction.
That is why covariance is often used before correlation.
It helps analysts understand how two datasets behave together before deeper comparison.
Covariance Formula
The covariance formula depends on your data type and is based on deviations from the mean and sum of squares, which you can calculate using our Sum of Squares Calculator.
You can calculate covariance for a population or for a sample.
Population covariance formula:

Sample covariance formula:

What each symbol means:
- Xi and Yi are individual data values
- X̄ and Ȳ are the means of X and Y
- Σ means sum of all values
- N is the total population size
- n is the sample size
Use the population formula only when you have complete data.
In most real cases, the sample covariance formula is used.
How to Calculate Covariance Step by Step
Calculating covariance manually takes a few clear steps.
Step 1: List paired values
Write both variables as ordered pairs. Each X value must match a Y value.
Step 2: Find the mean of each variable
Calculate the average of X values and the average of Y values.
Step 3: Subtract the mean from each value
Find how far each value is from its mean.
Step 4: Multiply the deviations
Multiply each X deviation with its matching Y deviation.
Step 5: Add and divide
Sum all multiplied values.
Divide by n − 1 for sample data or N for population data.
This final result is the covariance.
If you want to avoid errors, use the covariance calculator to check your answer instantly.
Example of Calculating Covariance
Let’s walk through a simple example.
Suppose you have two variables, X and Y.
X values: 2, 4, 6
Y values: 3, 5, 7
Step 1: Find the means
Mean of X = (2 + 4 + 6) ÷ 3 = 4
Mean of Y = (3 + 5 + 7) ÷ 3 = 5
Step 2: Subtract the means
| X | Y | X − X̄ | Y − Ȳ |
|---|---|---|---|
| 2 | 3 | −2 | −2 |
| 4 | 5 | 0 | 0 |
| 6 | 7 | 2 | 2 |
Step 3: Multiply deviations
(-2 × -2) + (0 × 0) + (2 × 2) = 8
Step 4: Divide
Sample covariance = 8 ÷ (3 − 1) = 4
The positive result shows both variables move in the same direction.
How to Find Covariance in Excel
Excel makes calculating covariance simple.
You just need the right function.
For sample data:
Use the COVARIANCE.S function.
Example:=COVARIANCE.S(A1:A5, B1:B5)
For population data:
Use the COVARIANCE.P function.
Example:=COVARIANCE.P(A1:A5, B1:B5)
Each range must contain paired values in the same order.
Common Excel mistakes include:
- Using the wrong function for sample data
- Selecting mismatched ranges
- Including empty cells
If you want instant results without formulas, the covariance calculator is a faster option.
Interpreting Covariance Results
Covariance tells you how two variables move together.
- A positive covariance means both variables increase or decrease together.
This shows a direct relationship. - A negative covariance means one variable increases while the other decreases.
This shows an inverse relationship.
A covariance value close to zero means there is little or no linear relationship.
The size of covariance does not indicate strength.
Large values can appear simply because the data scale is large.
For strength comparison, correlation is usually the better metric.
Common Mistakes When Calculating Covariance
Small errors can lead to wrong covariance results.
One common mistake is using the population formula for sample data.
This usually understates the true relationship.
Another issue is forgetting to subtract the mean from each value.
Covariance always depends on deviations from the mean.
Some people mix up covariance with correlation.
Covariance shows direction, not strength.
Data order also matters.
If X and Y values are not paired correctly, the result becomes meaningless.
Using a covariance calculator helps avoid these mistakes.
When Covariance Is Not Enough
Covariance has one major limitation.
It depends on the scale of your data.
If one variable is measured in large units, the covariance value can look large even when the relationship is weak.
This makes comparisons difficult across different datasets.
In these cases, correlation is a better choice.
Correlation standardizes the result between −1 and 1.
Use covariance to understand direction first.
Use correlation when you need strength and comparison across datasets.