Regression & correlation
Correlation Coefficient Calculator
How tightly two variables move together, by all three standard measures at once.
Have a spreadsheet? Drop a CSV here
Or . CSV, TSV or plain text. You pick which column is which after it loads — the names in your file do not have to match ours. The file is read in your browser and never uploaded.
How to read this result
r runs from −1 to 1 and measures linear association only. Zero means no straight-line relationship — not no relationship. A perfect parabola has r near zero.
Square it for something interpretable. r = 0.5 sounds substantial and means the two variables share 25% of their variance. r² is the number to quote when someone asks how much one explains the other.
Pearson, Spearman and Kendall are all reported, and the gaps between them are informative. Pearson uses the values, so one extreme point can dominate it. Spearman and Kendall use only the ordering, so they cannot be dominated. When Pearson is much the largest, look for an outlier — the worked example below is exactly that case.
Always look at the scatter plot. Anscombe's quartet is four data sets with identical means, variances, correlations and regression lines: one is linear, one is curved, one has a single influential point and one is a vertical stack. A coefficient without a picture is not evidence.
The formula
The covariance divided by both standard deviations, which is what bounds it between −1 and 1 and removes the units.
Is it significant?
Compared against the t distribution on n − 2 degrees of freedom. The confidence interval uses Fisher's z transformation, because r itself is not normally distributed near ±1.
Worked example
Ten towns, one of them a city
Ten towns, each with a count of x and a count of y. Nine of them are small; the seventh has an x of 247 and a y of 486. Pearson's r says the relationship is nearly perfect. Is it?
x: 43, 21, 25, 42, 57, 59, 247, 32, 40, 55 y: 99, 65, 79, 75, 87, 81, 486, 71, 84, 90
- Compute Pearson's r on the values.r = 0.9868
- Square it.r² = 0.974 — apparently 97% of the variance explained
- Now rank both variables and correlate the ranks.Spearman's ρ = 0.758
- And count concordant against discordant pairs.Kendall's τ = 0.556
- The three disagree sharply, which points at one dominant observation.removing the seventh town drops Pearson's r to 0.61
The 0.987 is real arithmetic and a misleading summary: it is driven almost entirely by one town that is five times larger than the others. The gap between Pearson and Spearman is the tell, and it is why the calculator always reports all three.
Checked against R's cor and cor.test for all three methods.
The calculator above is loaded with these numbers by the Load the worked example button.
Assumptions, and when to use something else
- Pearson assumes a linear relationship, roughly interval-scale data, and — for its p-value and interval — approximate bivariate normality. It is sensitive to outliers in either variable.
- Spearman assumes only that the relationship is monotone and the data ordinal. It is unaffected by any transformation that preserves order, including logs.
- Kendall's τ assumes the same and has a cleaner probabilistic interpretation: it is the difference between the proportion of pairs that agree in ordering and the proportion that disagree.
All three assume the observations are independent. None of them says anything about causation, and none of them detects a non-monotone relationship.
- You want an equation, not just a strengthLinear regressionSlope, intercept and predictions in the data's own units.
- You want the share of variance explainedR-squared calculatorr² and the adjusted version, with the variance decomposition.
- You want the unstandardised versionCovariance calculatorCorrelation before dividing by the two standard deviations.
- You want to see the dataScatter plot makerAlways look before quoting a coefficient.
Questions people ask
What is a strong correlation?
Conventionally |r| below 0.3 is weak, 0.3 to 0.7 moderate and above 0.7 strong — but the thresholds are field-dependent. In physics 0.9 may be disappointing; in social science 0.4 can be a major finding. Square it and ask whether explaining that share of the variance is useful to you.
Does correlation imply causation?
No, and the reason is worth stating precisely: a correlation between x and y is equally consistent with x causing y, y causing x, a third variable causing both, and coincidence. Only the design of the study — randomisation, timing, controls — can distinguish those.
Pearson or Spearman?
Pearson for linear relationships between numeric variables with no extreme values. Spearman when the relationship is monotone but curved, when the data are ordinal, or when outliers are present. A large gap between the two, as in the example above, is itself a diagnostic.
Can correlation be zero when the variables are clearly related?
Yes. r measures straight-line association only, so a perfect U-shaped relationship gives r near zero. This is the single strongest argument for looking at the scatter plot before the coefficient.
How many points do I need?
Enough that the coefficient is stable, which is more than people expect. With n = 10 the 95% interval around r = 0.5 runs from about −0.18 to 0.86 — essentially uninformative. Thirty is a reasonable minimum for a coefficient you intend to quote.