Covariance Calculator

This calculator measures the covariance between two variables, a statistic that captures how they vary together, giving both the sample and population versions. Covariance is a building block of statistics that tells you the direction of the linear relationship between two quantities: a positive covariance means they tend to rise and fall together, a negative covariance means one tends to rise as the other falls, and a value near zero means little linear relationship. It is closely related to correlation, which is simply covariance standardised onto a fixed scale, and it underpins regression, portfolio theory in finance, where the covariance between asset returns drives diversification, and the variance-covariance matrices used throughout data science. This tool computes it directly. You paste your x values into one box and your matching y values into another, in the same order, and the calculator returns the sample covariance, which divides by one less than the number of pairs and is used when your data is a sample, and the population covariance, which divides by the number of pairs and is used when you have the whole population. It also shows the two means and the number of pairs. The results update as you type. Use it to explore the relationship between two variables, as a step toward correlation or regression, or for statistics study. Unlike correlation, covariance is not standardised, so its size depends on the units of your variables and is hard to interpret on its own; for a measure of strength that runs from minus one to plus one, follow up with the correlation coefficient. The sign of the covariance, however, immediately tells you the direction of the relationship.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner
1.5
sample covariance
Population covariance1.2
Mean of x3
Mean of y4

Sample covariance divides by n - 1; population covariance divides by n. Positive means the variables rise together; negative means they move oppositely.

How it works

For each pair, the calculator multiplies the deviation of x from its mean by the deviation of y from its mean, and adds these products. Dividing that sum by one less than the number of pairs gives the sample covariance; dividing by the number of pairs gives the population covariance. The sign shows the direction of the relationship.

Worked example

For x values 1 to 5 and y values 2, 4, 5, 4, 5, the means are 3 and 4. The products of the deviations sum to 6. The sample covariance is 6 divided by 4, which is 1.5, and the population covariance is 6 divided by 5, which is 1.2. Both are positive, so x and y tend to rise together.

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-06-07 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.