Pearson Correlation Coefficient Calculator (r, R² and the Regression Line)
Pearson's r for any number of (x, y) pairs, with the sums it is built from, R² and the least-squares line.
Inputs
- Working
- Σ(x − x̄)(y − ȳ) = 6; Σ(x − x̄)² = 10; Σ(y − ȳ)² = 6; r = 6 ÷ √(10 × 6) = 0.7746
- R² (share of variation explained)
- 0.6000 — 60.0%
- Means
- x̄ = 3, ȳ = 4
- Least-squares line
- ŷ = 2.2 + 0.6x
- Pairs
- 5
- Direction and strength
- positive, strong (a rule of thumb, not a test)
Use this calculator on your own site
Free embed
- Two lines of HTML, unlimited views
- Shows a small CalculateEveryday bar, with a credit link under the calculator
What each Pearson Correlation Coefficient input means
- Paired values
- One row per pair of measurements, x and y, for the same subject: hours studied and score, temperature and sales. Blank rows are skipped; add rows for more pairs.
Pearson Correlation Coefficient formula
r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² × Σ(y − ȳ)²] · R² = r² · regression line: slope = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², intercept = ȳ − slope × x̄
Pearson's r measures how closely two variables follow a straight line together. For each pair, take how far x is from its mean and how far y is from its mean; when the two deviations tend to have the same sign the products add up to a positive number, when opposite signs a negative one, and when unrelated they cancel. Dividing by the product of the two spreads scales the result to between −1 and +1: +1 is a perfect rising line, −1 a perfect falling line, 0 no linear relationship. Squaring it gives R², the share of the variation in y that a straight line on x accounts for. The same sums give the least-squares line, so the page shows the equation ŷ = a + bx alongside r. Any number of pairs can be entered; the page skips blank rows.
Pearson Correlation Coefficient worked example
Five pairs: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5. The means are x̄ = 3 and ȳ = 4. The deviations from the means multiply and sum to Σ(x − x̄)(y − ȳ) = 6, while Σ(x − x̄)² = 10 and Σ(y − ȳ)² = 6. So r = 6 ÷ √(10 × 6) = 6 ÷ 7.746 = 0.7746, a strong positive correlation, and R² = 0.60: a straight line on x explains 60% of the variation in y. The line itself is slope 6 ÷ 10 = 0.6 and intercept 4 − 0.6 × 3 = 2.2, so ŷ = 2.2 + 0.6x.
More Pearson Correlation Coefficient examples
Hours of revision against test score for five students — (2, 65), (4, 70), (6, 78), (8, 82), (10, 91): r = 128 ÷ √(40 × 414.8) = 0.9937, R² = 0.9875, and the line ŷ = 58 + 3.2x says each extra hour went with about 3.2 more marks. With only five students, that is a description, not proof of an effect.
Where the Pearson Correlation Coefficient calculator can give the wrong answer
- r only sees straight lines. A perfect U-shaped relationship can have r near 0, so plot the points before trusting the number.
- One outlier can swing r a long way with a handful of points; five pairs and one wild value is a correlation of that value, not of the data.
- Correlation is not causation, and r says nothing about which variable drives which. Ice-cream sales and drownings correlate through summer.
- 'Strong / moderate / weak' at 0.7 and 0.3 is a common rule of thumb, not a test. Whether an r is statistically significant depends on the number of pairs — r = 0.5 is significant with 30 pairs and not with 8 — which needs the significance test in OpenStax §12.4.
- If either variable never changes, r is undefined (division by zero) and the page says so.
Spotted a mistake? Tell us
Pearson Correlation Coefficient reference table
| Pairs | Critical r |
|---|---|
| 5 | 0.878 |
| 6 | 0.811 |
| 7 | 0.754 |
| 8 | 0.707 |
| 10 | 0.632 |
| 15 | 0.514 |
| 20 | 0.444 |
| 30 | 0.361 |
| 50 | 0.279 |
| 100 | 0.197 |
Pearson Correlation Coefficient FAQ
- Find both means, then for every pair multiply x's deviation from its mean by y's deviation and add the products; divide that by the square root of (the sum of squared x-deviations times the sum of squared y-deviations). The page prints those three sums and the final division for any data you enter.
- 0.8 is a strong positive linear relationship: as x rises, y rises, and a line explains 64% of y's variation. −0.3 is a weak negative one: y tends to fall as x rises, but a line explains only 9% of the variation. The sign is the direction, the size is the tightness.
- R² is r squared. r keeps the sign and ranges −1 to 1; R² is 0 to 1 and reads as a percentage of variation explained. r = 0.7746 gives R² = 0.60, so 60% of the variation in y is accounted for by the straight-line relationship with x.
- Two is the mathematical minimum and gives r = ±1 whatever the data. For a number that means anything, use at least ten or so, and check significance for the count you have; with 5 pairs an r of 0.77 is not significant at the 5% level.