Written by Dackohn; last reviewed November 2026.
Pearson’s r = Σ(x − x̄)(y − ȳ) / √[Σ(x − x̄)² × Σ(y − ȳ)²]. For x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5, the sums are 6, 10 and 6, so r = 6 / √60 = 0.77. It ranges from −1 to 1 and measures straight-line association.
Worked example
Hours of revision (x) and a test score out of 5 (y). The means are x̄ = 3 and ȳ = 4.
| x | y | x − x̄ | y − ȳ | (x − x̄)(y − ȳ) | (x − x̄)² | (y − ȳ)² |
|---|---|---|---|---|---|---|
| 1 | 2 | −2 | −2 | 4 | 4 | 4 |
| 2 | 4 | −1 | 0 | 0 | 1 | 0 |
| 3 | 5 | 0 | 1 | 0 | 0 | 1 |
| 4 | 4 | 1 | 0 | 0 | 1 | 0 |
| 5 | 5 | 2 | 1 | 2 | 4 | 1 |
| Sum | 6 | 10 | 6 | |||
So r = 6 / √(10 × 6) = 6 / 7.746 = 0.775.
Is it significant?
Convert r to a t statistic with df = n − 2: t = r × √(n − 2) / √(1 − r²) = 0.775 × 1.732 / 0.632 = 2.12. With df = 3, the two-tailed p-value is .124, which is not significant. Even a correlation as large as 0.77 can be due to chance with only five points. The Pearson r table gives the same answer: with df = 3, you need |r| of at least 0.878 at the 5% level.
What r and r² mean
The sign shows the direction, and the size shows how tightly the points follow a line. Squaring gives r² = 0.60, which means a straight line accounts for 60% of the variation in y. Rough labels often used are 0.1 small, 0.3 medium and 0.5 large, but what counts as strong depends on the field.
In Excel or Google Sheets
=CORREL(A1:A5,B1:B5) returns r, and =RSQ(B1:B5,A1:A5) returns r².
Common mistakes
- Skipping the plot. A curved relationship can have r near 0, and one outlier can create or destroy a correlation. Try it in the regression playground.
- Reading causation into r. See correlation vs causation.
- Using Pearson on ranks or skewed data. Use Spearman’s correlation instead, which is Pearson’s r computed on the ranks.
- Ignoring sample size. With 5 points, r = 0.77 is not significant. With 1,000 points, r = 0.07 is.
Try it yourself
Correlation Calculator →Pearson and Spearman with a p-value and confidence interval. Guess the Correlation →Train your eye for what r looks like.Frequently asked questions
What is the formula for the correlation coefficient?
r equals the sum of (x minus mean x)(y minus mean y), divided by the square root of the sum of squared x deviations times the sum of squared y deviations.
What is a strong correlation?
A common guide calls 0.1 small, 0.3 medium and 0.5 large, but this depends on the field. Always look at a plot too.
How do I calculate correlation in Excel?
Use =CORREL(range1, range2). For r squared, use =RSQ(known_ys, known_xs).
Related reading: Correlation vs causation · Linear regression calculator · Regression playground
Sources & further reading: NIST/SEMATECH e-Handbook of Statistical Methods · OpenStax Introductory Statistics. How we compute & validate: methodology. Written & reviewed by Dackohn; last reviewed August 2026.