What this calculator does
Correlation measures how closely two variables move together, on a scale from −1 to +1. A value near zero means no linear relationship; values near either extreme mean the points fall close to a straight line. Linear regression then fits that line, giving an equation you can use to predict one variable from the other.
The most important caveat is the oldest one: correlation is not causation. Two variables can move together because one causes the other, because both are driven by something else, or by pure coincidence in a small sample. The arithmetic cannot distinguish these cases, and nothing in the output should be read as if it could.
The formula
Pearson’s r divides the covariance of the two variables by the product of their standard deviations, which normalises it onto the −1 to +1 scale. The regression slope is r scaled by the ratio of the standard deviations, and the intercept is fixed by requiring the line to pass through the mean of both variables.
| Term | Meaning |
|---|---|
| r | Pearson correlation coefficient, from −1 to +1. |
| R² | The proportion of variance in y explained by x. |
| Slope | How much y changes per unit of x. |
| Intercept | The value of y when x is zero. |
| Covariance | How the two vary together, in the original units. |
The inputs explained
| Field | What to enter |
|---|---|
| X values | The x values, separated by commas. |
| Y values | The y values, in the same order. Both lists must have at least two matching pairs. |
When to use it
Testing whether two measures relate
Study hours against exam scores, temperature against sales, advertising spend against revenue. The correlation quantifies the strength of the linear association.
Making a prediction
The line of best fit gives an equation. Substituting a new x produces a predicted y, though predictions far outside the range of your data are unreliable.
Understanding how much is explained
R² is the more interpretable figure. A correlation of 0.7 sounds strong until you note that R² is 0.49: under half the variation is accounted for.
Checking for a non-linear relationship
Pearson’s r only detects linear association. A perfect parabolic relationship can produce a correlation near zero, which is why plotting the data matters as much as calculating the coefficient.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
Correlation across different data patterns
The x values are 1 through 8 in every row; only the y values change.
| Y values | Correlation r | R² (variance explained) | Strength |
|---|---|---|---|
| 2, 4, 6, 8, 10, 12, 14, 16 | 1.000 | 100.0% | Strong |
| 2.1, 4.3, 6.2, 7.9, 10.4, 12… | 0.9995 | 99.9% | Strong |
| 3, 7, 5, 9, 8, 12, 11, 15 | 0.9314 | 86.8% | Strong |
| 16, 14, 12, 10, 8, 6, 4, 2 | -1.000 | 100.0% | Strong |
| 5, 9, 12, 14, 14, 12, 9, 5 | 0 | 0.000% | Negligible |
| 8, 3, 12, 5, 15, 2, 9, 7 | 0.0199 | 0.039% | Negligible |
How one outlier distorts the result
A well-behaved data set with a single point moved progressively further out of line.
| Y values | Correlation r | R² (variance explained) | Line of best fit |
|---|---|---|---|
| 2, 4, 6, 8, 10, 12 | 1.000 | 100.0% | y = 2.000x + 0 |
| 2, 4, 6, 8, 10, 20 | 0.9220 | 85.0% | y = 3.143x − 2.667 |
| 2, 4, 6, 8, 10, 40 | 0.7924 | 62.8% | y = 6.000x − 9.333 |
| 2, 4, 6, 8, 10, 100 | 0.7084 | 50.2% | y = 14.571x − 29.333 |
Questions
What is a strong correlation?
Conventionally, above 0.8 in absolute value is strong, 0.5 to 0.8 moderate, and below 0.3 negligible. But context matters enormously: a correlation of 0.4 can be substantial in social science and disappointing in physics.
Does correlation prove causation?
No. Two variables may correlate because one causes the other, because a third factor drives both, or by coincidence. Establishing causation requires experimental design or careful causal inference, not a coefficient.
What does R squared mean?
The proportion of variance in y explained by x. An R² of 0.64 means 64 per cent of the variation is accounted for by the linear relationship, and 36 per cent is not.
Can correlation be zero when a relationship exists?
Yes. Pearson’s r measures linear association only. A symmetric curved relationship can give r near zero despite being perfectly deterministic: which is why plotting the data is essential.
How many data points do I need?
At least two for the arithmetic, but correlations from small samples are unstable and can be large by chance. Meaningful conclusions generally need considerably more, and the number depends on the effect size you are hoping to detect.
For summarising each variable separately, see descriptive statistics. For precision of an estimate, use confidence intervals.