Covariance Calculator: inputs and meaning
Calculate sample or population covariance from paired numeric observations, showing both means and the cross-deviation sum. Enter one x,y pair per line. Preserve the pairing of observations. Choose Sample (n − 1) or Population (n).
Enter the data
Paste the matched observations into Paired observations, one pair on each line. Separate the two values with a comma, spaces or tabs. Blank internal rows, missing values and extra columns are rejected. Do not sort x and y independently: that changes the relationship. Choose Calculate or load the example to replace the input with the pairs below.
Worked example
For pairs (1, 2), (2, 4), (3, 6), the means are 2 and 4. The cross-deviation sum is 4. Sample covariance is 4/(3 − 1) = 2; population covariance is 4/3, approximately 1.33333333333.
Calculation and interpretation
Subtract each variable’s mean from its observations, multiply the two deviations within each pair, then sum. Sample covariance divides that sum by n − 1; population covariance divides by n. The implementation shifts values before centering and uses compensated summation to reduce floating-point accumulation error.
What this result cannot tell you
Positive covariance indicates that above-mean values tend to occur together; negative covariance indicates opposing deviations. Its magnitude depends on units: changing metres to centimetres changes covariance. Covariance is not bounded by −1 and 1. A constant variable produces zero covariance; a one-pair dataset is supported only in population mode, where it yields zero.
Precision and input bounds
Use finite decimal numbers, optionally with signs or exponent notation such as 1e3, without thousands separators or unit suffixes. Magnitudes cannot exceed 1e12; nonzero magnitudes must be at least 1e-12. The limit is 1,000 pairs and 100,000 characters. Both values on a line must be present; missing observations are not silently dropped. Displayed answers use 12 significant digits and browser floating-point arithmetic, not arbitrary-precision calculations. Decimal differences smaller than floating-point precision cannot be recovered from the entered numbers.
Changing inputs or the convention clears the result. Copy results copies the displayed summary and its sample/population label.
Use Correlation Calculator to compare a dimensionless linear-association measure that does not change merely because measurement units change.





