Correlation Coefficient Calculator (Pearson r)

The Pearson correlation coefficient (r) measures the strength and direction of a linear relationship between two variables, from −1 to +1. For X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5, r = 0.7746 and r² = 0.6, a strong positive correlation.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

What Is the Correlation Coefficient?

The Pearson correlation coefficient, written r, summarises how closely two variables move together in a straight-line pattern. A value of +1 means a perfect upward line, −1 means a perfect downward line, and 0 means no linear relationship at all.

Correlation is one of the first things you check when exploring data: do taller people weigh more, does advertising spend track sales, does study time go with exam score? It gives you a single number that is easy to compare across different pairs of variables because it is unitless.

Interpreting the Size of r

|r|Typical descriptionr² (variance explained)
0.00 – 0.19Very weak or noneunder 4%
0.20 – 0.39Weak4% – 15%
0.40 – 0.59Moderate16% – 35%
0.60 – 0.79Strong36% – 62%
0.80 – 1.00Very strong64% – 100%

These bands are rules of thumb. What counts as strong in physics differs from what counts as strong in psychology.

Pearson Correlation Formula

r = Σ(xᵢ − x̄)(yᵢ − ȳ) ÷ √[ Σ(xᵢ − x̄)² × Σ(yᵢ − ȳ)² ]
  • xᵢ and yᵢ are the paired observations.
  • x̄ and ȳ are the means of X and Y.
  • The numerator adds up how the two variables vary together (their covariance, unscaled).
  • The denominator scales that by the spread of each variable, which forces r to lie between −1 and 1.

To test whether r differs from zero, use t = r × √(n − 2) ÷ √(1 − r²) with n − 2 degrees of freedom.

Correlation vs Covariance

Covariance also measures how two variables move together, but its size depends on the units. Measure height in inches instead of centimetres and the covariance changes, while r stays exactly the same. Swapping X and Y also leaves r unchanged. That unit-free, symmetric behaviour is why r is the standard way to report a linear relationship.

When to Use Spearman Instead

If your data are ranks, are clearly curved but consistently rising, or contain outliers you cannot remove, Spearman’s rank correlation is often more suitable. It applies the same idea to ranks rather than raw values.

Worked Example: Calculating r Step by Step

X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5, so n = 5.

xyx − 3y − 4(x − 3)(y − 4)(x − 3)²(y − 4)²
12−2−2444
24−10010
3501001
4410010
5521241
Sum6106
  1. The means are x̄ = 3 and ȳ = 4.
  2. The numerator is Σ(x − x̄)(y − ȳ) = 6.
  3. The denominator is √(10 × 6) = √60 = 7.746.
  4. r = 6 ÷ 7.746 = 0.7746, and r² = 0.6.
  5. The test statistic is t = 0.7746 × √3 ÷ √0.4 = 2.1213 with 3 degrees of freedom, giving a two-tailed p-value of 0.124.

The correlation is strong, but with only five points it is not statistically significant at the 5% level. Small samples can produce impressive-looking r values by chance.

How to Use This Correlation Calculator

  1. Enter your X values in the first box and your Y values in the second, in the same order.
  2. Make sure both lists have the same number of values.
  3. Read r, r², the strength label, the t statistic and the p-value.
  4. Open the steps to see the sums used.

To turn the relationship into a prediction line, use the linear regression calculator.

Real-World Uses of Correlation

  • Business: relating marketing spend, price or footfall to sales.
  • Finance: measuring how two assets move together to build diversified portfolios.
  • Health research: exploring links between lifestyle factors such as exercise and blood pressure.
  • Education: checking whether an entrance test relates to later performance.
  • Science and engineering: validating whether a sensor reading tracks a reference measurement.

What Are the Most Common Mistakes With the Correlation Coefficient Calculator (Pearson r)?

  • Assuming causation. Ice cream sales and drownings both rise in summer. A correlation says nothing about why.
  • Ignoring nonlinear patterns. A perfect U-shaped relationship can have r close to 0. Always plot the data.
  • Letting outliers decide. One extreme point can create or destroy a correlation.
  • Restricted range. Looking at only part of the range of X can hide a real relationship.
  • Mismatched pairs. The order of X and Y must line up observation by observation.
  • Reading r as a percentage. r = 0.77 does not mean 77% explained. That is r² = 0.6, or 60%.

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

What does a correlation coefficient of 0.77 mean?

It indicates a strong positive linear relationship: as X increases, Y tends to increase. About 60% (r²) of the variation in Y is linearly associated with X.

Does correlation imply causation?

No. Two variables can move together because of a third factor, by coincidence or because causation runs the other way. Establishing causation needs experiments or careful causal analysis.

What is the difference between r and r²?

r shows direction and strength of the linear relationship, from −1 to 1. r² is the proportion of variance in one variable that the linear relationship accounts for, from 0 to 1.

Can the correlation be negative?

Yes. A negative r means that as one variable increases, the other tends to decrease. An r of −1 is a perfect downward line.

How many data points do I need?

At least three to compute r, but correlations from small samples are unreliable. The p-value helps you judge whether the correlation could be chance.

What is the difference between Pearson and Spearman correlation?

Pearson measures linear association using the values themselves. Spearman works on ranks, so it captures monotonic relationships and is less affected by outliers.