Pearson correlation calculator
The r coefficient, R², p value and an interpretation of the strength.
Calculator inputs
Results
Enter your values and press “Calculate” to see the result.
In short
- What it calculates
- The r coefficient, R², p value and an interpretation of the strength.
- Formula used
r = Σ(x − x̄)(y − ȳ) / √( Σ(x − x̄)² · Σ(y − ȳ)² )- Example
- X: 10, 12, 14, 16, 18, 20
Pearson correlation calculator
The Pearson coefficient measures the strength and direction of the linear relationship between two quantitative variables, on a scale from −1 to +1.
Alongside the coefficient the exact p value is computed, showing whether the observed relationship could be down to chance.
How it works
Both variables are standardised against their means and the product of the deviations is averaged. The result is converted into a t statistic with n−2 degrees of freedom to obtain the p value.
Formula
r = Σ(x − x̄)(y − ȳ) / √( Σ(x − x̄)² · Σ(y − ȳ)² )
t = r · √(n − 2) / √(1 − r²)
Interpretation: |r| ≥ 0.9 very strong · ≥ 0.7 strong · ≥ 0.4 moderate · ≥ 0.2 weak
Worked example
X: 10, 12, 14, 16, 18, 20
Y: 15, 17, 20, 21, 25, 26
r = 0.9899
R² = 0.9799
p < 0.001 → very strong, statistically significant correlation
Explanation
It only detects linear relationships
That is its fundamental limitation. Two variables can be perfectly related through a curve and give a Pearson correlation near zero. Anscombe's quartet demonstrates it with four data sets sharing an identical correlation and looking completely different when plotted. Always look at the graph.
Correlation does not imply causation
Ice cream sales and drownings rise together, and neither causes the other: both depend on heat. That hidden third variable explains many of the spectacular correlations in circulation. Before concluding anything, ask what else might be driving both series.
Outliers dominate
A single atypical data point can create a strong correlation where none exists, or destroy a real one. With small samples the effect is dramatic. If you suspect an outlier, calculate Spearman's correlation too, which works on ranks and is immune to them.
What the squared coefficient means
It indicates the proportion of shared variance. A correlation of 0.7 looks high, but squared it is 0.49: less than half the variation in one variable is explained by the other. It is a far more sober reading than the coefficient alone.
Frequently asked questions
How does it differ from Spearman?
Pearson measures linear relationships on the raw values; Spearman works on ranks, detects any monotonic relationship and resists outliers better.
How many pairs do I need?
Three is the technical minimum, but at least 30 pairs are recommended for reliable conclusions.
What does R² mean?
The proportion of one variable’s variability explained by the other. An r of 0.7 gives an R² of 0.49, roughly half.
What does R squared mean?
The proportion of shared variance. A correlation of 0.7 gives 0.49, meaning only half the variation is explained.
How many data pairs do I need?
With fewer than twenty, a single outlier can change the result entirely. The more pairs, the more stable the estimate.
Need to calculate something else?
These tools are often used alongside this calculator.
t test
Compare two group means, paired samples, or one sample against a value.
Sample size
How many responses you need for your survey to be representative.
Standard deviation
Sample and population deviation, variance and coefficient of variation.
Margin of error
How precise your survey is, given the sample you actually collected.
Z score
How many standard deviations a value sits from the mean and which percentile it occupies.