Correlation coefficient calculator (Pearson, Spearman, regression line)
Paste X and Y and the correlation coefficients, P values, confidence interval and a scatter plot appear instantly. The calculations use the same code as the BenchFig correlation and regression screen and match SciPy.
Your numbers are processed only in this browser. Nothing is sent to a server (it is gone when you close the page).
Copy columns in Excel and paste them (values on the same row form a pair). Paste two columns at once and they are split into X and Y. A text first line becomes the name. Rows with only one value are dropped.
How to use it
- Copy the X column and the Y column in Excel and paste them into the two boxes (or copy both at once and paste into the left box). Values on the same row form a pair.
- The table shows both Pearson and Spearman. The one chosen under “Sentence” is used for the large display and the sentence.
- Always look at the scatter plot for outliers or curved relationships. “Make the graph in BenchFig” opens the correlation and regression screen.
Pearson or Spearman?
| Pearson’s r | Spearman’s ρ | |
|---|---|---|
| Measures | Strength of a straight-line relationship | Agreement of ranks (a monotonic relationship) |
| Suited to | Two continuous variables with an elliptical cloud of points | Outliers, curved (e.g. saturating) relationships, ranks or scores |
| Outliers | One point can change it a lot | Robust |
| Confidence interval | From Fisher’s z (shown in the table) | — |
If the scatter plot looks linear use Pearson; if it curves or has outliers use Spearman, and say which one you used. See Pearson vs Spearman for worked examples.
How to read the results
- r runs from −1 to 1: positive slopes up, negative slopes down, near 0 means a weak linear relationship
- r² is the share of the variation in Y explained by the straight line. r = 0.9 gives r² = 0.81
- The P value tests whether the correlation is zero. Large n makes weak correlations significant; small n can miss strong ones — use the 95% CI of r to judge the strength
- Correlation is not causation; consider other factors that affect both variables (confounding)
The least-squares slope and intercept and the 95% CI of the slope are shown too. For prediction from X to Y, see linear regression and R².
The same values in Excel
| Quantity | Excel formula |
|---|---|
| Pearson’s r | =CORREL(X, Y) (or =PEARSON(X, Y)) |
| r² | =RSQ(Y, X) |
| P value (two-tailed) | =T.DIST.2T(ABS(r*SQRT((n-2)/(1-r^2))), n-2) |
| Slope and intercept | =SLOPE(Y, X), =INTERCEPT(Y, X) |
| Spearman’s ρ | Rank X and Y with =RANK.AVG, then =CORREL of the ranks |
Excel has no function that returns the P value of r directly, so convert r to t and use T.DIST.2T.
How it was checked
r, its P value and 95% CI (Fisher’s z), ρ and the regression line match SciPy 1.18 (pearsonr, spearmanr, linregress). The Spearman P is exact (counting all permutations, as SciPy’s permutation test) when n ≤ 10 with no ties, and otherwise uses the t approximation. No P value is given when the points lie exactly on a line.
FAQ
Is my data sent anywhere?
No. Everything runs in your browser and the numbers are never sent to a server. They disappear when you close the page.
What value of r counts as a strong correlation?
There is no fixed cut-off and conventions vary by field. Many texts call 0.7 or above strong, but it is safer to report r with its 95% CI and the scatter plot than to rely on labels.
How many pairs do I need?
The calculation works from three pairs, but with small n the confidence interval is very wide (for r = 0.5 and n = 10, the 95% CI is about −0.19 to 0.86).
Why is there no P value?
When the points lie exactly on a line (r = ±1) the test is meaningless, so no P is given. Spearman’s P is also not given for n ≤ 3.
Other calculators
Related guides
Product names are trademarks or registered trademarks of their respective owners.