Pearson correlation calculator with confidence interval
Pearson’s r between two variables, with p value, confidence interval, regression line and scatter plot.
Calculator inputs
Results
Enter your values and press “Calculate” to see the result.
| X | Y |
|---|---|
| 1 | 2.1 |
| 2 | 3.9 |
| 3 | 6.2 |
| 4 | 7.8 |
| 5 | 10.1 |
| 6 | 12.2 |
| 7 | 13.8 |
| 8 | 16.1 |
See the working step by step
- n = 8 pairs; t(6) = 71.856
In short
- What it calculates
- Pearson’s r between two variables, with p value, confidence interval, regression line and scatter plot.
- Formula used
r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √( Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² )- Example
- Example 1. An almost linear relationship.
Pearson correlation calculator
Pearson correlation measures how far two numeric variables move together in a straight line: near +1, when one rises the other does too; near −1, when one rises the other falls; near 0, there is no linear relationship. It is among the most used measures… and the most misread.
Paste the data for the two variables (two columns, one row per observation). You get the coefficient r, its p value and confidence interval, r² (the proportion of shared variation), the regression line and a scatter plot, which is the first thing to look at. Everything runs in your browser.
How it works
The coefficient r is the covariance of the two variables divided by the product of their standard deviations: a “standardised” version of how much they vary together. It runs from −1 to +1 and does not depend on units.
The p value tests that the true correlation is zero, with a Student’s t on n − 2 degrees of freedom. The confidence interval uses Fisher’s z transformation (r is transformed, the interval is worked out on that scale, where it is nearly normal, and the transformation is undone), so it is not symmetric.
Formula
r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √( Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² )
t = r · √( (n − 2) / (1 − r²) ), df = n − 2
CI: z = atanh(r); limits = tanh( z ± critical z / √(n − 3) )
r² = proportion of one variable’s variation shared with the other
Line: y = a + b·x with b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)², a = ȳ − b·x̄
Guide (Cohen): |r| ≈ 0.1 small · 0.3 medium · 0.5 large
Worked example
Example 1. An almost linear relationship.
With X = 1 to 8 and Y = 2.1, 3.9, 6.2, 7.8, 10.1, 12.2, 13.8, 16.1, the correlation is r = .999 (95% CI .997 to 1.000), p < .001, r² = .999. The line is y = 0.036 + 1.998x: each unit of X goes with almost two of Y.
Example 2. A curved relationship.
With y = x² for x = 1 to 10, r = .975 (CI .893 to .994): a very high correlation, but the relationship is a curve, not a line; the scatter plot shows it and the line fits the ends poorly. Always look at the chart.
Example 3. An outlier.
Ten points rising from 2 to 10 (Y = 2, 3, …, 10) and one that shoots up to 60. r drops to .644 (p = .045; CI .024 to .906): a single point changes the reading entirely. Spearman’s correlation does detect that the relationship is perfectly monotonic (ρ = 1).
Explanation
What Pearson correlation measures
The strength and direction of the linear relationship between two numeric variables. It runs from −1 (perfect negative linear relationship) to +1 (perfect positive); 0 means no linear relationship. It does not depend on measurement units.
How to read it
- The **sign** gives the direction; the **absolute value**, the strength.
- As a guide, 0.1 is a small relationship, 0.3 medium and 0.5 large, although it depends on the field.
- **r²** is the proportion of one variable’s variation shared with the other.
- The **confidence interval** shows the uncertainty: with few observations it is very wide.
Always look at the chart
Very different datasets can give the same r (the famous Anscombe’s quartet): a curve, an outlier or two subgroups can make r misleading. The scatter plot is the first thing to look at.
Correlation is not causation
Two variables moving together does not mean one causes the other: there may be a third variable, a reverse relationship or chance. To speak of cause you need a design that allows it.
When not to use Pearson
- If the relationship is **curved** (non-linear).
- If there are very influential **outliers**.
- If the data are **ordinal** or very skewed: use Spearman’s correlation.
- If observations are **not independent** (for example, repeated measures on the same people).
Common mistakes
- Reading correlation as causation.
- Ignoring the chart.
- Taking “significant” as “important”: with lots of data, an r of .1 is significant.
- Restricting the range of the data, which lowers the correlation.
- Correlating group means (ecological correlation) and applying it to individuals.
Limits of this calculator
- It measures linear relationships only; it assumes roughly bivariate normality for the test and interval.
- It does not accept missing data in a row; remove or complete those rows first.
- It accepts up to 2,000 pairs.
Notice
This is an estimate. For publication, check the figures with your statistics package and report r, the confidence interval and n.
Frequently asked questions
What does a Pearson correlation of 0.7 mean?
A strong positive linear relationship: when one variable rises, the other tends to rise. They share about 49% of their variation (r² = 0.49).
What r counts as high?
As a guide, 0.5 or more is large; 0.3 medium and 0.1 small. It depends a lot on the field: physics expects more; in social science, 0.3 is already relevant.
Does correlation mean causation?
No. Two variables moving together does not prove one causes the other.
When should I use Spearman instead of Pearson?
When the relationship is monotonic but not linear, there are important outliers or the data are ordinal.
What is the confidence interval of r?
The range of reasonable values for the population correlation. It is computed with Fisher’s z transformation and is not symmetric.
How much data do I need?
The more the better: with fewer than 20 pairs the interval is very wide. A minimum sample size depends on the correlation you want to detect.
Why is r high but the chart is a curve?
Because Pearson measures fit to a straight line: a monotonic curve gives a high r even if it is not linear. That is why you must look at the chart.
Is my data sent to a server?
No. The calculation runs in your browser.
Sources and references
The formula behind this calculator is not ours. These are the sources it comes from, in APA 7 format, in case you want to go to the original or cite them in your own work.
- Pearson, K. (1895). Notes on regression and inheritance in the case of two parents. Proceedings of the Royal Society of London, 58, 240–242. The origin of the correlation coefficient.
- Fisher, R. A. (1915). Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population. Biometrika, 10(4), 507–521. https://doi.org/10.2307/2331838 https://doi.org/10.2307/2331838 Fisher’s z transformation for the confidence interval.
- Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2.ª ed.). Lawrence Erlbaum Associates. The 0.1, 0.3 and 0.5 effect-size thresholds.
Need to calculate something else?
These tools are often used alongside this calculator.
Spearman correlation
Rank correlation between two variables, which detects monotonic relationships even if they are not straight…
Linear regression
Least-squares line or plane with coefficients, intervals, prediction, assumption checks and fit and residual…
Cohen’s d
Effect size between two groups or before and after, with confidence intervals, plain-language equivalents…
Cronbach’s alpha
Reliability of a scale or questionnaire: alpha with a confidence interval, omega, and which items improve or…
Effect size converter
Convert between Cohen’s d, r, eta squared, f, odds ratio and AUC to compare studies that report the effect…
Sample size
How many responses you need to estimate a percentage or a mean, with finite population, design effect and…