Correlation Coefficient Calculator
Paste two columns of paired numbers to measure how closely they move together…
Paste two columns of paired numbers to measure how closely they move together, and drag any point on the scatter plot to watch r change.
Read 12 pairs; left out the header row (“Temperature (°C)”, “Ice creams sold”).
More optionsTwo-sided, 95% confidence
ExamplePearson’s r
0.9645
A very strong positive correlation: as Temperature (°C) goes up, Ice creams sold tends to go up too. Significant at the 5% level (p < 0.05).
Paste your own two columns, or drag a point.
Drag any point and watch r change. With the plot focused, arrow keys move the highlighted point (the one furthest from the line) and [ ] pick another.
- p-value
- 4.16 × 10⁻⁷
- 95% CI for r
- 0.875 to 0.99
- r² (shared variation)
- 0.93 (93%)
How this works: 10 sources,
How this works
Method
Pearson’s correlation coefficient r measures how closely two quantities follow a straight line together, from −1 (a perfect falling line) through 0 (no linear pattern) to +1 (a perfect rising line). In the example, twelve days of temperature and ice cream sales give r = 0.96: warmer days come with more sales almost in lockstep. Full method
Sources
- Wikipedia, Pearson correlation coefficient
- Wikipedia, Fisher transformation
- Anscombe, Graphs in statistical analysis (The American Statistician, 1973)
- NIST/SEMATECH e-Handbook of Statistical Methods
- Abramowitz and Stegun, Handbook of Mathematical Functions, chapters 6, 7 and 26 (1964)
- SciPy 1.18 scipy.stats (reference values for the tests)
- statsmodels 0.15 (reference values for the A/B test and regression intervals)
- Welch, The generalization of Student’s problem when several different population variances are involved (Biometrika) (1947)
- Fleiss, Levin and Paik, Statistical Methods for Rates and Proportions, 3rd edition (sample size for two proportions) (2003)
- Hyndman and Fan, Sample quantiles in statistical packages (The American Statistician) (1996)
How it’s tested
2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.
Privacy
On your device. Nothing you enter or open leaves this browser. About privacy labels
Changes
- First published: live curves with draggable cut-offs, and tests on pasted data (t-tests, ANOVA, chi-square, Fisher’s exact, correlation, regression, A/B), checked against SciPy.
How the correlation coefficient works
Pearson’s correlation coefficient r measures how closely two quantities follow a straight line together, from −1 (a perfect falling line) through 0 (no linear pattern) to +1 (a perfect rising line). In the example, twelve days of temperature and ice cream sales give r = 0.96: warmer days come with more sales almost in lockstep.
r is the sum of the products of each pair’s distances from the two means, divided by the square root of the two sums of squares. Squared, it is the share of the variation the two have in common: r² = 0.93. To test whether the true correlation could be 0, t = r√((n − 2)/(1 − r²)) on n − 2 degrees of freedom. The confidence interval uses Fisher’s z transformation, atanh(r), which is close to normal with standard error 1/√(n − 3).
Always look at the scatter plot. Anscombe’s quartet is four data sets with the same r of 0.82 that look nothing alike: a line, a curve, a line with one outlier and a vertical stack with one far point. Drag a point far from the others and watch r swing. Spearman’s rank correlation, the other option, works on ranks, so it measures any steadily rising or falling pattern and shrugs off outliers. And neither says what causes what: hot days drive both ice cream sales and sunburn.
r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² Σ(y − ȳ)²) · t = r√((n − 2) ÷ (1 − r²))
- Pearson’s r is the covariance of two variables divided by the product of their standard deviations; it measures linear association only. Source: Wikipedia, Pearson correlation coefficient.
- Fisher’s transformation z = artanh(r) is approximately normal with standard error 1/√(n − 3), which gives confidence intervals for a correlation. Source: Wikipedia, Fisher transformation.
- Anscombe’s four data sets share the same means, variances, correlation (0.816) and regression line, yet look completely different when plotted. Source: Anscombe, Graphs in statistical analysis (The American Statistician, 1973).
How strong a correlation must be to be significant
The smallest |r| with a two-sided p-value under 0.05 and under 0.01, by the number of pairs (r = t ÷ √(df + t²)).
| Pairs | df | |r| for p < 0.05 | |r| for p < 0.01 |
|---|---|---|---|
| 4 | 2 | 0.95 | 0.99 |
| 5 | 3 | 0.878 | 0.959 |
| 6 | 4 | 0.811 | 0.917 |
| 8 | 6 | 0.707 | 0.834 |
| 10 | 8 | 0.632 | 0.765 |
| 12 | 10 | 0.576 | 0.708 |
| 15 | 13 | 0.514 | 0.641 |
| 20 | 18 | 0.444 | 0.561 |
| 25 | 23 | 0.396 | 0.505 |
| 30 | 28 | 0.361 | 0.463 |
Show all 15 rowsShow fewer
| 50 | 48 | 0.279 | 0.361 |
| 100 | 98 | 0.197 | 0.256 |
| 200 | 198 | 0.139 | 0.182 |
| 500 | 498 | 0.088 | 0.115 |
| 1,000 | 998 | 0.062 | 0.081 |
Common questions
What counts as a strong correlation?
A common rule of thumb (Evans, 1996) calls |r| under 0.2 very weak, 0.2 to 0.4 weak, 0.4 to 0.6 moderate, 0.6 to 0.8 strong and above 0.8 very strong. In practice it depends on the field: 0.3 can be important in medicine and disappointing in physics.
Pearson or Spearman?
Pearson for a straight-line relationship between measurements without big outliers. Spearman for ranks, ratings, curved but steady relationships, or data with outliers. If they disagree a lot, the scatter plot will usually show why.
My correlation is significant but small. Does it matter?
With enough data, even r = 0.1 is significant (see the table), but it means the two share only 1% of their variation. Report r and its confidence interval, not just the p-value.