Correlation Coefficient CalculatorPearson’s r, Spearman’s ρ and Kendall’s τ, with p-Value, Confidence Interval and Scatter Plot
Paste two columns of data and see all three correlation coefficients side by side. You also get r², the regression line, an outlier-sensitivity check, an APA sentence and the sample size you need. You can also test a reported r or compare two correlations.
Methods follow Pearson (1896), Spearman (1904), Kendall (1938) and Fisher’s z transformation. Spearman and Kendall intervals use the Bonett and Wright (2000) and Fieller standard errors. Every coefficient and p-value is cross-checked against SciPy, and all math runs in your browser.
What is a correlation coefficient?
A correlation coefficient measures the strength and direction of the relationship between two variables on a scale from −1 to +1. A value of +1 is a perfect positive relationship, −1 is a perfect negative one and 0 means no linear relationship. Pearson’s r = Σ(x − x̄)(y − ȳ) / √[Σ(x − x̄)² Σ(y − ȳ)²] measures linear association. Spearman’s ρ and Kendall’s τ measure any monotonic relationship using ranks.
Paste two columns from Excel or Google Sheets
Separate columns with tabs, commas or semicolons. If the first row holds text, it is read as the variable names.
Use this to check whether a correlation reported in a paper is significant, and how precise it is.
This compares correlations from two independent samples, such as the same two variables measured in men and women.
Results update as you type.
Enter your data
Your interpretation appears here.
Scatter plot with least-squares line
Each dot is one observation. Ringed dots are poorly explained by the line (|standardized residual| > 2), and the diamond marks the most influential point.
Pearson vs Spearman vs Kendall
All three coefficients for your data. Large gaps between them point to non-linearity or outliers.
Regression line and prediction
The least-squares line that Pearson’s r describes. Use it only within the range of your X values.
Outlier sensitivity
How much does r depend on any single observation? A robust correlation barely moves when one point is dropped.
Power and sample size
Sample size needed to detect a correlation of this size in a new study (two-sided, Fisher z approximation).
Report it (APA 7th edition style)
Notes on your result
Step-by-step solution
How to Use This Correlation Coefficient Calculator
- Enter paired data. Type or paste the X values in one box and the matching Y values in the other, in the same order. You can also paste two columns straight from a spreadsheet. Each pair is one person, day or item.
- Choose which coefficient to headline. Pearson’s r is the default for linear relationships between continuous variables. Pick Spearman’s ρ or Kendall’s τ for ranks, ordinal scales, skewed data or curved but consistently rising (or falling) patterns. All three are shown either way.
- Read the gauge, r², p-value and confidence interval. The needle shows direction and strength. r² tells you the share of variance the two variables share. The interval shows how precisely you have estimated the population correlation.
- Look at the scatter plot. A correlation can hide curves, clusters and outliers. The outlier-sensitivity card tells you whether a single point is carrying your result.
- Report and plan. Copy the APA sentence, and use the sample-size card to plan a replication.
Already have an r from a paper? Use the Test an r value tab. Want to know whether a correlation is stronger in one group than another? Use Compare two r.
Correlation Coefficient Formulas
PEARSON’S r
Sxy = Σ(x − x̄)(y − ȳ)
The covariance scaled by both standard deviations. It measures straight-line association, and the significance test assumes roughly normal data.
SPEARMAN’S ρ
(no ties: 1 − 6Σd² / n(n² − 1))
Rank each variable, averaging tied ranks, then correlate the ranks. It captures any monotonic trend and resists outliers.
KENDALL’S τ-b
C and D count concordant and discordant pairs, and n₁ and n₂ adjust for ties. It is the most robust option for small samples.
Testing significance and building the confidence interval
For Pearson’s r, the test statistic is t = r√(n − 2) / √(1 − r²) with n − 2 degrees of freedom, giving the same p-value as testing the regression slope. For the interval, r is converted with Fisher’s transformation, z = ½ ln[(1 + r)/(1 − r)]. z is roughly normal with SE = 1/√(n − 3), so the calculator builds z ± 1.96 SE and converts back to r. This is why the interval is asymmetric: it is compressed toward ±1. The P-Value Calculator converts r to p directly if that is all you need.
Pearson vs Spearman vs Kendall: Which Correlation Should You Use?
| Coefficient | Measures | Data type | Sensitive to outliers? | Choose it when |
|---|---|---|---|---|
| Pearson’s r | Linear association | Interval or ratio | Yes, strongly | Both variables are continuous, roughly normal and the scatter looks straight |
| Spearman’s ρ | Monotonic association | Ordinal or continuous | Much less | The data are ranks, Likert scales or skewed, or the trend curves but keeps one direction |
| Kendall’s τ-b | Concordance of pairs | Ordinal or continuous | Least | The sample is small or has many ties, and you want an easily interpreted probability |
Kendall’s τ is usually smaller in magnitude than ρ for the same data, often by about a third. That is a different scale, not a weaker finding. If both variables are categorical (yes/no, groups), use Cramér’s V from the Chi Square Test Calculator instead. If one variable is a two-group category and the other is numeric, the point-biserial correlation is equivalent to Cohen’s d, and that calculator converts between them.
Worked Example: Calculating Pearson’s r by Hand
The calculator’s default, illustrative dataset has 15 adults reporting last night’s hours of sleep (X) and completing a reaction-time test the next morning (Y, in milliseconds).
- Means: x̄ = 96 / 15 = 6.40 hours; ȳ = 4,544 / 15 = 302.93 ms.
- Sums of squares and cross-products: Sxx = Σ(x − x̄)² = 30.10; Syy = Σ(y − ȳ)² = 1,632.93; Sxy = Σ(x − x̄)(y − ȳ) = −172.10.
- Pearson’s r: −172.10 / √(30.10 × 1,632.93) = −172.10 / 221.70 = −0.776.
- r²: 0.603, so about 60% of the variation in reaction time is shared with sleep.
- Significance: t = −0.776 × √13 / √(1 − 0.603) = −4.44 with 13 df, p = 0.0007.
- 95% CI: z = −1.036, SE = 1/√12 = 0.289, giving z from −1.602 to −0.470, which converts back to r from −0.92 to −0.44.
- Rank-based check: Spearman’s ρ = −0.78 and Kendall’s τb = −0.59 agree with Pearson’s r, so the relationship is consistently negative and not driven by one point. Dropping the most influential observation (6.5 h, 315 ms) moves r only to −0.82.
- Regression line: ŷ = 339.5 − 5.72x. Each extra hour of sleep goes with about 5.7 ms faster reactions in this sample.
APA write-up: There was a strong negative correlation between hours of sleep and reaction time, r(13) = −.78, p < .001, 95% CI [−.92, −.44].
How to Interpret a Correlation Coefficient
Strength depends only on the absolute value. The sign gives the direction: positive means both rise together, negative means one falls as the other rises. Two widely used verbal scales are below. Evans (1996) is common in introductory courses, and Cohen (1988) in the behavioral sciences.
Cohen’s benchmarks: |r| = 0.10 is small, 0.30 is medium and 0.50 is large. These are deliberately lower than Evans’ labels, because in human behavior an r of 0.30 is often meaningful. Always judge strength against typical findings in your own field.
r² is the more honest number
Squaring r gives the coefficient of determination, the proportion of variance in one variable shared with the other. An r of 0.50 sounds like “halfway”, but it explains only 25% of the variance. An r of 0.30 explains 9%.
Correlation is not causation
A strong correlation can come from a third variable (ice-cream sales and drownings both follow temperature), from reverse causation, or from a selected sample. Establishing causation needs experimental design or careful causal modeling, not a larger r.
Always plot your data. Anscombe (1973) built four datasets with nearly identical r ≈ 0.82 that look completely different: a clean line, a curve, a line with one outlier, and a single extreme point creating the whole correlation. In the third Try an example dataset, one point lifts r from 0.64 to 0.82. That is why this calculator shows the scatter plot and the outlier-sensitivity check. To screen each variable for outliers on its own first, run it through the Interquartile Range Calculator.
Sample Size for Detecting a Correlation
Small correlations need large samples. These are the total number of pairs needed for a two-sided test, using the Fisher z approximation. Results typically fall within one or two pairs of exact methods such as G*Power.
| |r| | r² (variance shared) | n for 80% power | n for 90% power | n for 80% power (α = .01) |
|---|---|---|---|---|
| 0.1 | 1% | 783 | 1047 | 1164 |
| 0.2 | 4% | 194 | 259 | 288 |
| 0.3 | 9% | 85 | 113 | 125 |
| 0.4 | 16% | 47 | 62 | 69 |
| 0.5 | 25% | 30 | 38 | 42 |
| 0.6 | 36% | 20 | 25 | 28 |
| 0.7 | 49% | 14 | 17 | 19 |
| 0.8 | 64% | 10 | 12 | 13 |
For survey designs where you also care about margin of error, follow up with the Sample Size Calculator.
How to Compare Two Correlation Coefficients
To test whether r₁ from one sample differs from r₂ in another, convert both with Fisher’s z and compute z = (z₁ − z₂) / √(1/(n₁ − 3) + 1/(n₂ − 3)). Then compare z with the standard normal distribution. The difference z₁ − z₂ is Cohen’s q, an effect size where 0.10 is small, 0.30 is medium and 0.50 is large. For example, r = 0.52 (n = 120) against r = 0.31 (n = 140) gives z = 2.03 and p = 0.042, a significant but small-to-medium difference (q = 0.26). This test assumes independent samples. Correlations that share a variable within the same sample need Steiger’s test instead.
How to Report a Correlation in APA Format
Give the coefficient symbol in italics, the degrees of freedom (n − 2) in parentheses, the value to two decimals without a leading zero, the p-value and the confidence interval:
- Pearson: r(13) = −.78, p < .001, 95% CI [−.92, −.44]
- Spearman: rs(13) = −.78, p < .001
- Kendall: τb = −.59, p = .002
The calculator writes the full sentence with your variable names, including the strength and direction words.
Common Correlation Mistakes
- Mismatched pairs. X₁ must belong with Y₁. Sorting one column on its own silently destroys the data.
- Using Pearson on curved data. A perfect U-shape can give r = 0. Check the plot, and if the trend is monotonic, use Spearman’s ρ.
- Calculating r on a restricted range. Correlating test scores only among top students shrinks r compared with the full population.
- Pooling groups that differ. Combining men and women, or two clinics, can create or hide a correlation (Simpson’s paradox). Compare the groups separately with the Compare two r tab.
- Confusing significance with strength. With n = 1,000, r = 0.07 is significant yet explains half a percent of the variance.
- Extrapolating the line. The regression prediction is valid only inside the observed X range.
Related Statistics Calculators
Correlation usually follows data description and leads into effect size reporting and study planning.
Frequently Asked Questions
Subtract each variable’s mean from its values, multiply the paired deviations and add them up to get Sxy. Then divide by the square root of the product of the sums of squared deviations, Sxx times Syy. The result is Pearson’s r, which always lies between −1 and +1.
It depends on the field. A common scale calls |r| of 0.40 to 0.59 moderate, 0.60 to 0.79 strong and 0.80 or more very strong. Cohen’s benchmarks treat 0.10 as small, 0.30 as medium and 0.50 as large. In physics or instrument calibration you may expect r above 0.99, while in psychology r = 0.30 is often meaningful.
A negative correlation means that as one variable increases, the other tends to decrease, such as more sleep going with faster (lower) reaction times. The sign shows only direction. An r of −0.78 is exactly as strong as +0.78.
Pearson’s r measures linear relationships using the actual values and is sensitive to outliers. Spearman’s rho correlates the ranks, so it measures any consistently increasing or decreasing relationship and is more robust. Use Spearman for ordinal data, skewed data or curved monotonic trends.
Kendall’s tau is preferred for small samples and data with many tied ranks, and its value has a direct interpretation as the difference between the probabilities of concordant and discordant pairs. It is usually smaller in magnitude than Spearman’s rho for the same data, so do not compare a tau with a rho from another study.
Convert r to a t statistic with t = r times the square root of (n − 2), divided by the square root of (1 − r²). Then find the two-sided p-value from the t distribution with n − 2 degrees of freedom. The Test an r value tab does this for any r and n.
Transform r with Fisher’s z = 0.5 ln((1 + r)/(1 − r)), add and subtract 1.96 divided by the square root of (n − 3), then convert both limits back with the hyperbolic tangent. The interval is not symmetric around r because correlations are bounded at −1 and +1.
r is the correlation coefficient and shows the direction and strength of the relationship. r squared, the coefficient of determination, is the proportion of variance the two variables share. An r of 0.6 means r squared is 0.36, so 36 percent of the variation is shared.
You can compute r with three pairs, but the result is very imprecise. To detect a medium correlation of 0.30 with 80 percent power at alpha 0.05, you need about 85 pairs, while a large correlation of 0.50 needs about 30. The sample size table and power card give exact figures.
No. A correctly calculated correlation always lies between −1 and +1. A value outside that range signals a calculation error, often mismatched sums or mixing sample and population formulas.
For two independent samples, convert each r to Fisher’s z, take the difference and divide by the square root of 1/(n1 − 3) + 1/(n2 − 3). Compare the result with the standard normal distribution. The Compare two r tab returns the z statistic, p-value and Cohen’s q effect size.
Write the italic symbol, the degrees of freedom in parentheses, the value without a leading zero, the p-value and the confidence interval. For example: r(13) = −.78, p < .001, 95% CI [−.92, −.44]. Use r_s for Spearman’s rho and tau_b for Kendall’s tau.
Methodology and Sources
How the numbers are computed. Pearson’s r uses centered sums for numerical stability. Spearman’s ρ is Pearson’s r applied to average ranks, so ties are handled exactly. Kendall’s τ-b counts all concordant and discordant pairs, and its two-sided p-value uses the tie-corrected normal approximation (the same as SciPy’s asymptotic method). Pearson and Spearman p-values come from the t distribution with n − 2 df, evaluated through the regularized incomplete beta function. Confidence intervals use Fisher’s z with SE = 1/√(n − 3) for r, √((1 + ρ²/2)/(n − 3)) for ρ (Bonett and Wright, 2000), and √(0.437/(n − 4)) for τ (Fieller, Hartley and Pearson, 1957). Outlier sensitivity recomputes r with each point left out in turn. Before release, every coefficient, p-value, interval and regression estimate was cross-checked against SciPy 1.18 (pearsonr, spearmanr, kendalltau and linregress), with agreement to at least nine decimal places on tied and untied test datasets.
References
- Pearson, K. (1896). Mathematical contributions to the theory of evolution. III. Regression, heredity, and panmixia. Philosophical Transactions of the Royal Society A, 187, 253–318. doi:10.1098/rsta.1896.0007
- Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72–101. doi:10.2307/1412159
- Kendall, M. G. (1938). A new measure of rank correlation. Biometrika, 30(1–2), 81–93. doi:10.1093/biomet/30.1-2.81
- 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. doi:10.2307/2331838
- Bonett, D. G., and Wright, T. A. (2000). Sample size requirements for estimating Pearson, Kendall and Spearman correlations. Psychometrika, 65(1), 23–28. doi:10.1007/BF02294183
- Fieller, E. C., Hartley, H. O., and Pearson, E. S. (1957). Tests for rank correlation coefficients. I. Biometrika, 44(3–4), 470–481. doi:10.1093/biomet/44.3-4.470
- Anscombe, F. J. (1973). Graphs in statistical analysis. The American Statistician, 27(1), 17–21. doi:10.1080/00031305.1973.10478966
- Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum Associates.
- Evans, J. D. (1996). Straightforward Statistics for the Behavioral Sciences. Brooks/Cole.
Disclaimer: This calculator is an educational and analytical aid. Verify results used in published research, clinical decisions or regulatory submissions with validated statistical software, and consult a qualified statistician where needed.
Manzoor Ahmad
Founder of DexoCalc · 13+ years in web development and SEO
Manzoor builds and personally reviews every DexoCalc calculator. Reading health and supplement research for years showed him how often a headline correlation rests on a small, noisy sample or a single extreme data point. That is why this tool shows the scatter plot, the confidence interval and an outlier check next to every r. All formulas are cross-checked against reference statistical software before release.
