HOME / MATHEMATICS & STATISTICS / STATISTICS / CORRELATION COEFFICIENT CALCULATOR
Mathematics & Statistics / Statistics

Correlation Coefficient Calculator

Separate values with commas, spaces or new lines; a spreadsheet column pastes straight in.

Try an example

Pearson correlation

r = 0.7746

A strong positive linear relationship across 5 pairs; r² = 0.6, so 60.0% of the variation in Y is linearly associated with X.

p-value (two-sided)
0.124
t (3 df)
2.121
95% CI for r
-0.34 to 0.984
Spearman ρ
0.7379

Not significant at the 5% level; with 5 pairs a correlation this size can easily arise by chance.

Scatter plot

1.01.52.02.53.03.54.04.55.02.02.53.03.54.04.55.05.5
Least-squares line

r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² · Σ(y − ȳ)²). It measures only straight-line association: a perfect U-shape can give r = 0, and correlation alone never shows that one variable causes the other.

Measure how strongly two variables move together in a straight line. Enter paired X and Y values to get Pearson's r, r², a significance test with its p-value, a 95% confidence interval, Spearman's rank correlation and a scatter plot.

Formula

r=∑(x−xˉ)(y−yˉ)/∑(x−xˉ)2⋅∑(y−yˉ)2\text{r} = \sum (\text{x} - \bar{\text{x}})(\text{y} - \bar{\text{y}}) / \sqrt{ \sum (\text{x} - \bar{\text{x}})^{2} · \sum (\text{y} - \bar{\text{y}})^{2}}
t=rn−2/1−r2\text{t} = \text{r} \sqrt{\text{n} - 2} / \sqrt{1 - \text{r}^{2}}

Worked Example

X values1, 2, 3, 4, 5
Y values2, 4, 5, 4, 5
Result
Pearson r0.7746
r²0.60
p-value0.124 (t = 2.12, 3 df)

The deviations from the means (x̄ = 3, ȳ = 4) give Σ(x − x̄)(y − ȳ) = 6, Σ(x − x̄)² = 10 and Σ(y − ȳ)² = 6, so r = 6 ÷ √60 = 0.7746: a strong positive relationship. With only five pairs, though, p = 0.124, so a correlation this large could plausibly arise by chance.

Frequently Asked Questions

Does high correlation imply causation?

No. Correlation measures association, not causal direction or mechanism. A third variable can drive both, and the direction of any effect cannot be read from r.

What if the relationship is not a straight line?

Pearson r only measures linear association, so a perfect U-shape can give r = 0. Look at the scatter plot, and compare with Spearman’s rank correlation, which captures any consistently rising or falling pattern.

How many data points do I need?

More than you might think. With 5 pairs, r must exceed about 0.88 to be significant at the 5% level; with 30 pairs about 0.36 is enough. The p-value and confidence interval show how much a given r can be trusted.