Covariance Calculator
StatisticsCalculate sample and population covariance between two variables in seconds. Enter paired X, Y data points to measure how the two variables move together instantly.
Add up to 12 data points. At least 2 pairs are required.
Sample Covariance
Population
0
Mean X
0
Mean Y
0
No linear relationship detected
Based on 0 paired observations. Covariance only shows direction, not strength โ use the Correlation Coefficient Calculator to normalize this into a โ1 to +1 scale.
What is a Covariance?
The Covariance Calculator measures how two variables move together by computing both sample and population covariance from your paired X, Y data points. Enter as many data pairs as you have, and the calculator instantly returns the covariance value, mean of each variable, and a plain-language interpretation of the direction of the relationship.
Covariance is a foundational statistical concept โ it's the building block behind correlation, linear regression, and portfolio variance in finance. While covariance alone doesn't tell you the strength of a relationship (that requires correlation), it reliably tells you the direction: whether two variables tend to rise and fall together, or move in opposite directions.
If you need a standardized, scale-independent measure of relationship strength instead, use the Correlation Coefficient Calculator, which builds directly on the same covariance calculation shown here.
How to use this Covariance calculator
Enter your paired data โ add rows of X and Y values that correspond to the same observation (e.g., hours studied and test score for each student).
Add or remove pairs โ use the "+ Add Pair" button to include more observations, or the ร button to remove a row. A minimum of 2 pairs is required.
Read the sample covariance โ the highlighted result card shows sample covariance by default, since it's the version most commonly used in real-world analysis.
Compare with population covariance โ shown alongside, in case your dataset represents a complete population rather than a sample.
Check the direction interpretation โ the colored panel below the result tells you plainly whether the relationship is positive, negative, or negligible.
Review the step-by-step breakdown โ expand the calculation steps to see the means, deviations, and final covariance formula substitution.
Formula & Methodology
Sample covariance: Cov(X,Y) = ฮฃ(x โ xฬ)(y โ ศณ) / (n โ 1) Population covariance: Cov(X,Y) = ฮฃ(x โ xฬ)(y โ ศณ) / n Variable definitions: - x, y โ individual paired data values - xฬ, ศณ โ mean of X and mean of Y respectively - n โ number of paired observations Worked example: Data pairs: (2, 10), (4, 15), (6, 18), (8, 24), (10, 27) โ n = 5. Step 1 โ Means: xฬ = (2+4+6+8+10)/5 = 6, ศณ = (10+15+18+24+27)/5 = 18.8 Step 2 โ Deviation products: (2โ6)(10โ18.8) = 35.2, (4โ6)(15โ18.8) = 7.6, (6โ6)(18โ18.8) = 0, (8โ6)(24โ18.8) = 10.4, (10โ6)(27โ18.8) = 32.8 Step 3 โ Sum of products: 35.2 + 7.6 + 0 + 10.4 + 32.8 = 86 Step 4 โ Sample covariance: 86 / (5 โ 1) = 21.5 Since the covariance is positive, X and Y tend to increase together โ a signal worth confirming with the Correlation Coefficient Calculator to measure exactly how strong that relationship is. Note: Like correlation, covariance only detects linear co-movement. Two variables with a strong curved or cyclical relationship can still produce a covariance near zero, so always visualize your data (e.g., with a scatter plot) alongside any covariance calculation.
Frequently Asked Questions