Correlation Coefficient Calculator
Calculate the Pearson correlation coefficient r for paired data, with R², the two-tailed p-value, a 95% confidence interval, Spearman’s rank correlation and the least-squares line y = a + bx. Paste your x values and y values (same length, separated by commas, spaces or new lines). Example: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5 give r = 0.7746, R² = 0.6 and a p-value of 0.124.
Show steps
How to use the Correlation Coefficient Calculator
- Type or paste your X values in the first box and your Y values in the second. Use commas, spaces or new lines between numbers.
- Make sure both boxes have the same number of values (at least 3).
- Press Calculate to see Pearson r, R², the p-value, a confidence interval, Spearman’s rho and the regression line.
- Open Show steps to see the sums used.
Formula and method
r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² · Σ(y − ȳ)²)
r runs from −1 (perfect negative line) through 0 (no linear relationship) to +1 (perfect positive line). R² = r² is the share of the variation in Y explained by X.
Significance: t = r√(n − 2) ÷ √(1 − r²) with n − 2 degrees of freedom gives the two-tailed p-value.
Confidence interval: Fisher z = ½ ln((1 + r)/(1 − r)), standard error 1/√(n − 3), then transform back with tanh.
Regression: slope b = Sxy / Sxx, intercept a = ȳ − b x̄. Example: x = 1,2,3,4,5 and y = 2,4,5,4,5 give Sxy = 6, Sxx = 10, Syy = 6, so r = 6 / √60 = 0.7746.
What does the correlation coefficient tell you?
It measures how closely two variables follow a straight line. A positive r means they rise together, a negative r means one rises as the other falls, and a value near 0 means no linear pattern. It is unit-free, so you can compare correlations between different variables.
How strong is a given r?
| |r| | Common description |
|---|---|
| 0.90 to 1.00 | Very strong |
| 0.70 to 0.89 | Strong |
| 0.50 to 0.69 | Moderate |
| 0.30 to 0.49 | Weak |
| 0.00 to 0.29 | Very weak or none |
These cut-offs are conventions, not laws. What counts as strong depends on the field: 0.5 is high in social science, low in physics.
R-squared
R² is the share of the variance in Y that the straight line accounts for. With r = 0.7746, R² = 0.60, so about 60% of the variation in Y is explained by its linear relationship with X.
The p-value and sample size
The p-value is the chance of seeing a correlation at least this large if the true correlation were zero. With few pairs a high r can still have a large p-value: the example (r = 0.77, n = 5) has p = 0.124. With 30 pairs, an r of 0.37 is already significant at the 5% level.
Pearson vs Spearman
Pearson measures straight-line association and is sensitive to outliers. Spearman replaces the values with ranks, so it captures any monotonic relationship (always rising or always falling) and resists outliers. If Spearman is much larger than Pearson, the relationship is probably curved or an outlier is pulling r down.
Correlation is not causation
Ice cream sales and drowning deaths both rise in summer, but one does not cause the other. A third factor (temperature) drives both. Establishing cause needs experiments or careful study design.
Worked example: study hours and scores
Hours studied: 2, 3, 5, 6, 8, 9. Exam scores: 55, 62, 70, 74, 85, 88. The data are close to a straight line, so r is about 0.99 and the regression line predicts roughly 4.7 more points for every extra hour. Enter these values to see the exact numbers.
Accuracy and limits
The p-value is computed with the regularised incomplete beta function and agrees with standard statistical software to about 10 digits. The confidence interval needs n > 3. Results assume paired, independent observations.
Frequently asked questions
How do I calculate the correlation coefficient?
Subtract each mean, multiply the paired deviations and sum them, then divide by the square root of the product of the two sums of squared deviations.
What is a good correlation coefficient?
Above 0.7 in absolute value is usually called strong, but it depends on the field.
Can r be greater than 1?
No. Pearson r is always between −1 and +1.
What does R-squared mean?
The proportion of variation in Y explained by a straight-line relationship with X.
What if my data is not linear?
Use Spearman’s rho for a monotonic trend, or fit a curve; Pearson may understate a curved relationship.
Sources
Related calculators
Related to This Article
More math articles
- Money, Financial Assets, Bonds, and the Time Value of Money
- White House staff
- The Best Grade 5 Math Book for South Dakota Students
- Reconstruction Governments, Black Officeholding, and Federal Enforcement
- Chemistry Laboratory Safety: Use RAMP Before You Start
- The Roots of Expansionism and the Annexation of Hawaii
- Gain Access to the Answers: Explore the Solution Manual for “CHSPE Math for Beginners”
- How to Find the Expected Value of a Random Variable?
- The Best Grade 5 Math Book for Montana Students
- Overview of the ALEKS Mathematics Test



What people say about "Correlation Coefficient Calculator: Pearson r, R², p-Value and Spearman"?
No one replied yet.