Correlation Coefficient Calculator
Paste two columns of numbers to get Pearson's r with its p-value and 95% confidence interval, Spearman's rho, a scatter plot, and a ready-to-copy APA 7 sentence. Everything is computed in your browser, so your data is never uploaded.
| Statistic | Value |
|---|---|
| Pearson r | .85 |
| p-value | 0.066 |
| 95% CI | [-.12, .99] |
APA report
r(5) = .85, p = .066
Upload your dataset and generate a complete paper draft with statistics, figures, and references—free preview.
Generate paperHow to use the correlation calculator
1. **Enter your data.** Paste two columns (X and Y) from Excel, Google Sheets or SPSS, type values separated by commas or spaces, or load a CSV file and pick the two variables. 2. **Check the pairs.** Each row is one observation (one participant, one sample, one day). Rows with a missing value in either column are dropped, and the calculator shows how many complete pairs (n) it used. 3. **Read the output.** You get Pearson's r, r², the t statistic, degrees of freedom (n − 2), the two-sided p-value and a 95% confidence interval, plus Spearman's rho with its own p-value. 4. **Look at the scatter plot** before you trust any number. It is the fastest way to spot a curve, an outlier or two separate clusters. 5. **Copy the APA 7 sentence** into your results section and adjust the variable names.
The whole calculation runs locally in your browser. Nothing you paste is sent to a server.
What a correlation coefficient measures
A correlation coefficient summarises the **strength and direction of the association** between two variables on a scale from −1 to +1. Positive values mean the variables tend to rise together; negative values mean one tends to fall as the other rises; values near 0 mean no consistent linear (or monotonic) pattern.
**Pearson's r** measures *linear* association between two continuous variables, such as height and weight or study time and exam score.
**Spearman's rho (ρ)** is Pearson's r computed on the ranks of the data. It measures *monotonic* association — whether Y tends to go up (or down) as X goes up, even if not in a straight line. Use it for ordinal data such as Likert ratings, for skewed variables, or when a few extreme values would dominate Pearson's r. Tied values receive the average of the ranks they span, which is the standard tie correction.
Correlation describes association only. It does not tell you which variable causes the other, or whether a third variable drives both.
Assumptions
**Pearson's r** is most trustworthy when:
- both variables are measured on an interval or ratio scale;
- the relationship is roughly linear (check the scatter plot);
- there are no influential outliers;
- observations are independent (each pair comes from a different unit);
- for the p-value and confidence interval, the pair of variables is approximately bivariate normal. With larger samples this matters less.
**Spearman's rho** only requires that the data can be ranked, that observations are independent, and that the relationship is monotonic. If your scatter plot shows a U-shape, neither coefficient is appropriate; the association is real but not monotonic.
Formulas
Pearson's correlation coefficient:
`r = Σ(x − x̄)(y − ȳ) / √[Σ(x − x̄)² · Σ(y − ȳ)²]`
Significance test (H0: ρ = 0), with df = n − 2:
`t = r · √(n − 2) / √(1 − r²)`
95% confidence interval via the Fisher z transformation:
`z = atanh(r) = ½ · ln[(1 + r) / (1 − r)]`, `SE = 1 / √(n − 3)`
`CI = tanh(z ± 1.96 · SE)`
Spearman's rho is Pearson's r applied to the ranks. When there are no ties it equals `1 − 6Σd² / [n(n² − 1)]`, where d is the difference between each pair of ranks; with ties the calculator uses the rank-based Pearson formula, which handles them correctly.
Worked example
A tutor records weekly study hours and the final exam score for eight students:
| Student | Hours (X) | Score (Y) | |---|---|---| | 1 | 2 | 55 | | 2 | 4 | 60 | | 3 | 5 | 58 | | 4 | 6 | 67 | | 5 | 8 | 70 | | 6 | 9 | 76 | | 7 | 11 | 79 | | 8 | 12 | 85 |
Results (verified with Python and SciPy):
- Pearson **r = 0.979**, r² = 0.958, t(6) = 11.71, **p < .001** (p = 0.000023)
- 95% CI for r (Fisher z): **[0.884, 0.996]**
- Spearman **ρ = 0.976**, p < .001
About 96% of the variance in exam scores is shared with study hours in this small sample. The confidence interval is wide at the lower end (0.88) because n is only 8 — a reminder that small samples give imprecise estimates even when the p-value is tiny. Spearman's rho is almost identical because the relationship is close to a straight line; the one non-monotonic step (student 3 scored lower than student 2) pulls ρ slightly below 1.
How to interpret r
- **Direction:** the sign tells you whether the association is positive or negative.
- **Strength:** a common rule of thumb (Cohen, 1988) treats |r| ≈ 0.10 as small, 0.30 as medium and 0.50 as large. These are rough conventions; what counts as strong depends on your field and measures.
- **r²** is the proportion of variance the two variables share. r = 0.30 means only 9% shared variance.
- **The p-value** answers whether r differs from zero, not whether it is large. With n = 1,000, r = 0.07 is significant at p < .05 but practically negligible.
- **The confidence interval** tells you the range of population correlations compatible with your data. Report it — it is more informative than the p-value alone.
If you want to predict Y from X and get an equation, use the [linear regression calculator](/tools/linear-regression-calculator). For simple regression, its R² equals r² from this page.
Reporting the correlation in APA 7 style
Report the coefficient without a leading zero (it cannot exceed 1), the degrees of freedom in parentheses, the exact p-value to two or three decimals (or p < .001), and the confidence interval:
> A Pearson correlation showed a strong positive association between weekly study hours and exam score, *r*(6) = .98, *p* < .001, 95% CI [.88, 1.00].
For Spearman: *r*s(6) = .98, *p* < .001. Italicise statistical symbols, and say which coefficient you used and why.
If you are writing a full paper from a dataset with many variables, Data2Paper's [Generate Paper](/generate-paper) tool runs the analysis and drafts the whole manuscript, and you can preview the first half for free before deciding to unlock it.
Common mistakes
- **Claiming causation.** A strong r between ice cream sales and drownings reflects summer, not a causal link.
- **Skipping the scatter plot.** Very different patterns (a curve, a single outlier, two clusters) can produce the same r.
- **Using Pearson on ranked or heavily skewed data.** Switch to Spearman, and say so.
- **Range restriction.** Correlations computed on a narrow slice of the data (only top students, only adults over 60) are usually weaker than in the full population.
- **Treating non-significant as zero.** With a small sample, a non-significant r can still be large; look at the confidence interval.
- **Pooling different groups.** Combining two groups with different means can create a correlation that exists in neither group alone.
- **Running dozens of correlations** and reporting only the significant ones without correcting for multiple comparisons.