Paste two lists of paired values to measure how strongly they move together. The calculator gives Pearson’s correlation coefficient r for a straight-line relationship and Spearman’s rank correlation ρ for any steadily increasing or decreasing one, plus r², the t statistic and the two-tailed p-value for testing whether the correlation is zero.
What is a correlation coefficient?
A correlation coefficient is a single number between −1 and 1 that describes how two variables move together. Positive values mean they rise together, negative values mean one falls as the other rises, and values near zero mean there is no consistent relationship. Pearson’s r, the most common, measures how closely the points follow a straight line.
Spearman’s rank correlation ρ (rho) replaces each value by its rank and then computes Pearson’s r on the ranks. It measures whether the relationship is monotonic — consistently increasing or decreasing — even if it is curved, and it is much less affected by outliers. A t-test on r, with n − 2 degrees of freedom, tells you whether a correlation this large could plausibly arise by chance if the true correlation were zero.
How to use the correlation coefficient calculator
- Enter the x values in the first box.
- Enter the matching y values in the same order.
- Choose Pearson for straight-line relationships or Spearman for ranked or curved-but-steady ones.
Formula
r = [nΣxy − ΣxΣy] ÷ √([nΣx² − (Σx)²][nΣy² − (Σy)²])
Spearman’s ρ is Pearson’s r calculated on the ranks of the data instead of the values. Tied values share the average of the ranks they would occupy. With no ties it equals 1 − 6Σd² ÷ (n(n² − 1)), where d is the difference between each pair’s ranks.
To test whether a correlation could be zero in the population, t = r√(n − 2) ÷ √(1 − r²) is compared with a t-distribution with n − 2 degrees of freedom.
Worked examples
Height and weight
- x values
- 150, 160, 165, 170, 175, 180, 185
- y values
- 52, 58, 63, 66, 70, 79, 83
- Headline coefficient
- Pearson r (linear relationship)
- Pearson r
- 0.985048
- Spearman ρ
- 1
- r²
- 0.97032
For seven adults, r = 0.985: a very strong positive linear relationship. t = 12.785 with 5 degrees of freedom gives p = 0.00005, far below 0.05.
A curved relationship with an outlier
- x values
- 1, 2, 3, 4, 5, 6, 7, 8
- y values
- 1, 4, 9, 16, 25, 36, 49, 200
- Headline coefficient
- Spearman ρ (rank / monotonic relationship)
- Spearman ρ
- 1
- Pearson r
- 0.757954
- r²
- 1
y rises with every increase in x, so the ranks match perfectly and Spearman’s ρ = 1. Pearson’s r is only 0.758, because the points don’t lie on a straight line and the last value is extreme.
Smallest |r| that is significant at the 5% level (two-tailed)
| Pairs (n) | Degrees of freedom | Critical t | Critical |r| |
|---|---|---|---|
| 5 | 3 | 3.182 | 0.878 |
| 10 | 8 | 2.306 | 0.632 |
| 15 | 13 | 2.16 | 0.514 |
| 20 | 18 | 2.101 | 0.444 |
| 30 | 28 | 2.048 | 0.361 |
| 50 | 48 | 2.011 | 0.279 |
| 100 | 98 | 1.984 | 0.197 |
Why a narrow range hides a relationship
Correlation depends on how much variation the sample covers. Test scores and college grades may correlate well across all applicants, yet much less among admitted students, because admission removed the low scorers. If your data only span a narrow slice of x, a weak r does not mean the variables are unrelated in general.
Common mistakes
- Treating correlation as causation. Ice-cream sales and drownings are correlated because both rise in summer.
- Using Pearson’s r on curved or ranked data. Use Spearman’s ρ when the relationship is monotonic but not linear, or the data are ranks.
- Ignoring outliers. A single extreme point can create a strong Pearson correlation in unrelated data, or hide a real one.
- Confusing significance with strength. With hundreds of pairs, a weak r of 0.15 can be statistically significant yet explain only about 2% of the variation.
Frequently asked questions
What is the difference between Pearson and Spearman correlation?
Pearson measures how well the data fit a straight line and is sensitive to outliers. Spearman measures how well the order of x matches the order of y, so it detects any steadily rising or falling pattern and is more robust to outliers.
Does correlation mean causation?
No. Two variables can be correlated because one causes the other, because a third factor drives both, or by chance. Correlation alone can’t tell these apart.
What counts as a strong correlation?
As a rough guide, |r| above 0.7 is strong, 0.5–0.7 moderate, 0.3–0.5 weak and below 0.3 very weak. Always check a scatter plot as well — a single outlier can create or hide a correlation.
What does r² tell me?
The share of the variation in y that a straight line on x accounts for. A correlation of 0.7 gives r² = 0.49, so about half the variation is shared and half is not.
Sources
- Introductory Statistics 2e, 12.4: Testing the Significance of the Correlation Coefficient, OpenStax, Rice University
- Introductory Statistics 2e, 12.3: The Regression Equation (correlation coefficient), OpenStax, Rice University
- Spearman Rank Correlation Coefficient, Wolfram MathWorld
Last updated · Calculations checked by automated tests· Editorial policy