Skip to content

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

Paired values

Each row is one observation: its x and its y. Paste-friendly: type a value and tab to the next box.

Pearson r
0.7746

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̄

r=∑(x−xˉ)(y−yˉ)∑(x−xˉ)2∑(y−yˉ)2r = \frac{\sum (x - \bar{x})(y - \bar{y})}{\sqrt{\sum (x - \bar{x})^{2} \sum (y - \bar{y})^{2}}}

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

The smallest r that is significant at the 5% level (two-tailed), by number of pairs
PairsCritical r
50.878
60.811
70.754
80.707
100.632
150.514
200.444
300.361
500.279
1000.197
Source: 95% critical values of the sample correlation coefficient, degrees of freedom = pairs − 2 (OpenStax Introductory Statistics 2e, §12.4)

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.