What is the correlation coefficient?
Paste your x values and your y values, in matching order. The correlation coefficient calculator gives Pearson’s r, r² and whether r is significant.
- Correlation coefficient r
- 0.87831
For your 6 pairs, the correlation coefficient is r = 0.87831 (r² = 0.771429).
- r² (coefficient of determination)
- 0.771429
- Direction
- Positive
- Pairs (n)
- 6
- t statistic
- 3.67423
- p-value (two-tailed)
- 0.0213116
- Degrees of freedom
- 4
- Slope of the best-fit line
- 0.7714285714
- Intercept of the best-fit line
- 1.8
Correlation coefficient r: 0.87831. For your 6 pairs, the correlation coefficient is r = 0.87831 (r² = 0.771429).
The straight line r measures
How to calculate
Computes Pearson’s correlation coefficient r between paired x and y values, with r², the t statistic and the p-value of the test that the correlation is 0.
Example with the default inputs (x values [1, 2, 3, 4, 5, 6], y values [2, 4, 5, 4, 5, 7]): For your 6 pairs, the correlation coefficient is r = 0.87831 (r² = 0.771429).
Method: r = Sxy ÷ √(Sxx × Syy), with Sxx = Σ(x − x̄)², Syy = Σ(y − ȳ)², Sxy = Σ(x − x̄)(y − ȳ); t = r √(n − 2) ÷ √(1 − r²).
- The first x goes with the first y, and so on, so both lists must be the same length (2 to 10,000 pairs).
- r measures a straight-line link only; a strong curved link can still give r near 0.
- The p-value assumes the pairs are independent and the data are roughly normal.
Worked examples
Each example is checked against the calculator on every build.
- x values 1, 2, 3, 4, 5, 6, y values 2, 4, 5, 4, 5, 7 gives Correlation coefficient r 0.87831, r² (coefficient of determination) 0.771429, Pairs (n) 6, t statistic 3.674235, p-value (two-tailed) 0.021312, Slope of the best-fit line 0.771429, Intercept of the best-fit line 1.8.Source: NIST Dataplot Reference Manual, CORRELATION: r = Sxy ÷ (√Sxx √Syy); significance from (N − 2) r² ÷ (1 − r²) on the F distribution (https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/correlat.htm, retrieved 2026-10-02)
- x values 0.2, 337.4, 118.2, 884.6, 10.1, 226.5, 666.3, 996.3, 448.6, 777, 558.2, 0.4, 0.6, 775.5, 666.9, 338, 447.5, 11.6, 556, 228.1, 995.8, 887.6, 120.2, 0.3, 0.3, 556.8, 339.1, 887.2, 999, 779, 11.1, 118.3, 229.2, 669.1, 448.9, 0.5, y values 0.1, 338.8, 118.1, 888, 9.2, 228.1, 668.5, 998.5, 449.1, 778.9, 559.2, 0.3, 0.1, 778.1, 668.8, 339.3, 448.9, 10.8, 557.7, 228.3, 998, 888.8, 119.6, 0.3, 0.6, 557.6, 339.3, 888, 998.5, 778.9, 10.2, 117.6, 228.9, 668.4, 449.2, 0.2 gives r² (coefficient of determination) 0.999994, Slope of the best-fit line 1.002117, Intercept of the best-fit line -0.262323, Pairs (n) 36.Source: NIST StRD linear least squares dataset Norris, certified R-squared 0.999993745883712 (https://www.itl.nist.gov/div898/strd/lls/data/LINKS/v-Norris.shtml, retrieved 2026-10-02) (certified values to 15 digits)
- x values 1, 2, 3, y values 9, 6, 3 gives Correlation coefficient r -1, r² (coefficient of determination) 1, p-value (two-tailed) 0, Direction Negative.Source: NIST Dataplot Reference Manual, CORRELATION: r = Sxy ÷ (√Sxx √Syy); significance from (N − 2) r² ÷ (1 − r²) on the F distribution (https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/correlat.htm, retrieved 2026-10-02)
- x values 1, 2, 3, 4, y values 1, 3, 3, 1 gives Correlation coefficient r 0, r² (coefficient of determination) 0, t statistic 0, p-value (two-tailed) 1, Direction None (r = 0).Source: NIST Dataplot Reference Manual, CORRELATION: r = Sxy ÷ (√Sxx √Syy); significance from (N − 2) r² ÷ (1 − r²) on the F distribution (https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/correlat.htm, retrieved 2026-10-02)
How it works
Type the x values and the y values, 2 to 10,000 of each, in matching order: the first x goes with the first y. There is no answer when the lists have different lengths, or when every x (or every y) is the same.
With n pairs and the means x̄ and ȳ:
- Sxx = Σ(x − x̄)², Syy = Σ(y − ȳ)², Sxy = Σ(x − x̄)(y − ȳ).
- r² = Sxy² ÷ (Sxx × Syy).
- Correlation coefficient r = √r², with the sign of Sxy.
- Direction: positive when Sxy > 0, negative when Sxy < 0, none when Sxy = 0.
- Slope of the least-squares line = Sxy ÷ Sxx; intercept = ȳ − slope × x̄. The chart draws this line from the smallest to the largest x.
From 3 pairs up, the test that the true correlation is 0:
- Degrees of freedom = n − 2.
- F = (n − 2) r² ÷ (1 − r²), and the t statistic = √F with the sign of r (t = r √(n − 2) ÷ √(1 − r²)).
- p-value (two-tailed) = P(F(1, n − 2) > F), the same as 2 × P(T > |t|) for Student’s t with n − 2 degrees of freedom.
- When r = ±1 exactly, the p-value is 0 and t is left out. With 2 pairs, r is always ±1 and there is no test.
Every number is read as the exact decimal you typed, and Sxx, Syy, Sxy, r², F, the slope and the intercept are worked out in exact fractions, so r² has no rounding error before it is shown. r, r², t and p are shown to 6 significant figures; the slope and intercept to 10.
Worked examples by hand
x = 1, 2, 3, 4, 5, 6 and y = 2, 4, 5, 4, 5, 7. x̄ = 3.5, ȳ = 4.5. The x distances are −2.5, −1.5, −0.5, 0.5, 1.5, 2.5 and the y distances −2.5, −0.5, 0.5, −0.5, 0.5, 2.5. Sxx = 17.5, Syy = 13.5, Sxy = 6.25 + 0.75 − 0.25 − 0.25 + 0.75 + 6.25 = 13.5. r² = 13.5² ÷ (17.5 × 13.5) = 13.5 ÷ 17.5 = 27/35 = 0.771429, r = 0.878310. F = 4 × (27/35) ÷ (8/35) = 13.5, t = √13.5 = 3.67423 on 4 degrees of freedom, p = 0.0213116. Slope = 13.5 ÷ 17.5 = 0.771429; intercept = 4.5 − 0.771429 × 3.5 = 1.8.
NIST’s Norris data (36 pairs). r² = 0.999993745883712, the certified R-squared; the slope 1.00211681802045 and intercept −0.262323073774029 match the certified B1 and B0.
x = 1, 2, 3 and y = 9, 6, 3. The points lie on y = 12 − 3x, so r = −1, r² = 1 and p = 0.
x = 1, 2, 3, 4 and y = 1, 3, 3, 1. Sxy = (−1.5)(−1) + (−0.5)(1) + (0.5)(1) + (1.5)(−1) = 0, so r = 0, t = 0 and p = 1.
Other questions people ask
How do I calculate the correlation coefficient?
Find the means x̄ and ȳ. Then Sxx = Σ(x − x̄)², Syy = Σ(y − ȳ)² and Sxy = Σ(x − x̄)(y − ȳ), and r = Sxy ÷ √(Sxx × Syy). For x = 1 to 6 and y = 2, 4, 5, 4, 5, 7: Sxx = 17.5, Syy = 13.5, Sxy = 13.5, so r = 0.878.
What does the correlation coefficient tell me?
How closely the points follow a straight line, and in which direction. r = 1 is a perfect rising line, r = −1 a perfect falling line, and r near 0 means no straight-line link.
What is r²?
r squared, the coefficient of determination: the share of the variation in y that a straight line in x explains. r = 0.878 gives r² = 0.771, so the line explains about 77% of the variation.
Is the correlation significant?
The p-value answers that: it is the chance of an |r| at least this large if there were no correlation. With 6 pairs and r = 0.878, p = 0.0213, below 0.05. With few pairs, even a large r may not be significant.
Does correlation mean causation?
No. Two things can rise together because a third thing drives both, or by chance. A correlation shows a link, not what causes it.
Why is r 0 when my points make a clear curve?
Pearson’s r only measures straight-line links. Points on a hump, such as 1, 3, 3, 1, have r = 0 even though y depends on x.