Saved

Press the star next to a tool's name to save it.

All my tools

Correlation Calculator

This correlation calculator works out Pearson's correlation coefficient r for paired data, with r², a t-test p-value, means, standard deviations and covariance.

Enter the same number of values in each box, in matching order. Separate them with commas, spaces or new lines.

Your data stays in your browser. Nothing is uploaded.

Pearson correlation coefficient

–

Enter X and Y values and press Calculate.

A correlation calculator measures how strongly two sets of numbers move together. Enter your X values and your Y values, and this correlation calculator works out Pearson's correlation coefficient, r, from −1 to +1, along with r², a t-test and its p-value, the means, the standard deviations and the covariance. Use it for study hours and test scores, advertising spend and sales, temperature and ice-cream sales, or any other paired data.

How to use the correlation calculator

  1. Enter the X values in the first box, separated by commas, spaces or new lines.
  2. Enter the matching Y values in the second box, in the same order, so the first X goes with the first Y.
  3. Press Calculate. You need at least 3 pairs.
  4. Read r, then the details below it.

You can paste columns straight from a spreadsheet: copy the X column into the first box and the Y column into the second.

The formula

Pearson's correlation coefficient is the covariance of the two variables divided by the product of their standard deviations:

r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² × Σ(y − ȳ)²]

Here x̄ and ȳ are the means. The result is always between −1 and +1. A value of +1 means the points lie exactly on a rising straight line, −1 means exactly on a falling line, and 0 means there's no linear relationship at all.

Worked example

Five students study for 2, 4, 6, 8 and 10 hours and score 65, 70, 78, 85 and 92 on a test.

  • Means: 6 hours and 78 marks
  • Covariance: 34.5
  • Standard deviations: 3.1623 hours and 10.9316 marks
  • r = 34.5 ÷ (3.1623 × 10.9316) = 0.998
  • r² = 0.996, so study time explains 99.6% of the variation in these scores
  • t = 27.418 with 3 degrees of freedom, p ≈ 0.0001

That's a very strong positive correlation: in this small group, more study went with higher scores.

Is the correlation significant?

A correlation from a sample could be non-zero just by chance. To test it, the calculator uses Student's t-distribution. For pairs from an uncorrelated bivariate normal distribution, the statistic t = r√(n − 2) ÷ √(1 − r²) follows a t-distribution with n − 2 degrees of freedom. The two-tailed p-value is the chance of seeing a correlation at least this strong, in either direction, if the true correlation were zero. A small p-value, commonly below 0.05, suggests the correlation is unlikely to be chance alone. The test holds approximately for data that aren't normal when the sample is large enough.

How strong is strong?

Several authors have offered rules of thumb for what counts as a weak or strong correlation, but all such criteria are in some ways arbitrary. Context matters: a correlation of 0.8 may be very low when checking a physical law with precise instruments, yet very high in the social sciences, where many other factors play a part. That's why the calculator reports r, r² and the p-value rather than a single label. r² is often easier to explain: it's the share of the variation in Y that a straight line through X accounts for.

What correlation doesn't tell you

  • Cause and effect. Two things can rise together because a third factor drives both.
  • Curved relationships. Pearson's r only measures straight-line relationships; a strong curve can give a small r.
  • The slope. A correlation of 1 can come from a steep line or a shallow one.
  • Outliers. One extreme point can change r a lot, so look at a scatter plot of your data too.

Your privacy

The numbers are processed in your browser and aren't uploaded or saved.

Correlation and covariance

Covariance measures how two variables vary together, in the units of X multiplied by the units of Y, so its size depends on the scale of the data. If you measure height in centimeters instead of meters, the covariance changes, even though the relationship is the same. Pearson's r fixes this by dividing the covariance by both standard deviations, which removes the units. That's why r always falls between −1 and +1 and can be compared across very different data sets.

Where correlation is used

  • Education: how study time, attendance or sleep relate to test results.
  • Business: how advertising spend, price or season relate to sales.
  • Health and fitness: how exercise relates to resting heart rate or weight.
  • Science: how one measured quantity changes with another, before fitting a model.
  • Finance: how the returns of two investments move together, which matters when building a balanced portfolio.

Getting reliable results

Small samples can produce strong-looking correlations by chance, which is why the p-value matters most when n is small. Collect as many pairs as you reasonably can, make sure each pair was measured on the same person, day or item, and check the data for typing mistakes before you calculate. If the relationship looks curved on a scatter plot, a straight-line measure like Pearson's r will understate it, and a different method may suit the data better.

Common mistakes

  • Pairs out of order. Each X must line up with its own Y.
  • Different list lengths. Every X needs a Y.
  • Reading r as a percentage. Use r² for the share of variation explained.
  • Assuming causation from a strong r.

What next

Use this often? Add Correlation to your Home screen.

Frequently asked questions

What does the correlation calculator work out?

Pearson's correlation coefficient r, r², the t statistic and two-tailed p-value, the means, the standard deviations and the covariance of your paired data.

What does a correlation of 0.998 mean?

A very strong positive straight-line relationship: as X rises, Y rises almost perfectly in step.

What is the difference between r and r²?

r shows the direction and strength of the linear relationship, from −1 to +1. r² is the share of the variation in Y explained by X.

How is the p-value for a correlation calculated?

With Student's t-distribution: t = r√(n − 2) ÷ √(1 − r²), with n − 2 degrees of freedom, two-tailed.

Does correlation prove causation?

No. A strong correlation shows two variables move together, not that one causes the other.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools