Correlation Calculator (Pearson + Spearman)
Correlation calculator. Paste paired data for Pearson r and Spearman rho, with the p-value and a 95% confidence interval. Educational only.
Correlation Calculator (Pearson and Spearman)
How to use the correlation calculator
Paste your paired data
Put one x, y pair on each line, separated by a comma, space, or tab. You can paste two columns straight from a spreadsheet. You need at least three complete pairs, and four for the confidence interval.
Calculate
The tool computes both Pearson's r (for linear relationships) and Spearman's ρ (for monotonic, rank-based relationships) at once, so you can compare them.
Read the strength and significance
The headline is Pearson's r, from −1 to +1. The p-value tests whether Pearson's r differs from zero, and the 95% confidence interval shows the plausible range for the true r. Spearman's ρ is shown as a coefficient only, without a p-value.
Interpret with care
Correlation is not causation, and r only measures linear association. Plot your data and verify against statistical software before drawing conclusions or publishing.
Correlation — measuring how two variables move together
Pearson and Spearman: two questions, two coefficients
A correlation coefficient summarises, in a single number between −1 and +1, how strongly two variables move together. The most familiar is Pearson's r, which measures the strength and direction of a linear relationship: +1 is a perfect straight-line increase, −1 a perfect straight-line decrease, and 0 no linear association at all. It is computed as the covariance of the two variables divided by the product of their standard deviations, which standardises it so that the units cancel out. Pearson's r is ideal when the relationship is roughly straight-line and the data are reasonably normal, but it can be fooled: a strong curved relationship can produce a small r, and a single outlier can inflate or deflate it dramatically. That is why the second coefficient, Spearman's ρ, is so useful. Spearman simply replaces the raw values with their ranks and then computes Pearson's r on those ranks. This makes it measure monotonic association — whether y consistently rises (or falls) as x rises, even if the relationship is curved. It is also less sensitive to an outlier, which can take the top or bottom rank but no more, and it does not rely on the data being normal; NIST's Dataplot manual recommends the rank correlation for data that can only be ranked, for monotonic relationships that are not linear, and where normality fails.
Reporting both, as this calculator does, is good practice, and the gap between them is informative. When Spearman is much larger than Pearson, the relationship is probably monotonic but curved, or pulled down by an outlier. When Pearson is the larger, a single extreme point or a curve that turns back on itself may be propping it up. Agreement is not proof of a straight line: eleven points on y = x² from x = −5 to 5 give r = 0 and ρ = 0, a perfect agreement about a perfect relationship that neither coefficient can see. Alongside the coefficient, the calculator reports the sample size, a t-statistic and two-tailed p-value testing whether Pearson's r differs from zero, and a 95% confidence interval for r built with the Fisher z-transformation, so you can judge not just the strength of the association but how precisely it has been estimated.
"Pearson asks whether the relationship is a straight line; Spearman asks whether it's consistently one-directional. Report both — and remember that neither, on its own, says anything about cause."
What a correlation can't tell you
The single most important caveat is the oldest one: correlation does not imply causation. Two variables can correlate strongly because one causes the other, because both are driven by a third (confounding) variable, because of selection effects, or by pure coincidence in a small sample. A significant p-value tells you the association is unlikely to be zero in the population; it says nothing about why. Sample size matters too — with very large samples, trivially small correlations become "statistically significant" yet practically meaningless, so always look at the magnitude of r, not just the p-value. And because r measures only linear (or, for Spearman, monotonic) association, you should always plot your data: Anscombe's famous quartet is four datasets whose Pearson r agree to two decimal places (0.816 for three of them, 0.817 for the fourth), yet one is a smooth curve and another is a column of points at a single x value with one point far to the right that creates the whole correlation. Their Spearman ρ, by contrast, come out at 0.818, 0.691, 0.991 and 0.500. Use this tool to compute the coefficients quickly and to build intuition, but for any analysis that will inform a decision or a publication, examine the scatterplot, check the assumptions, and verify the numbers in dedicated statistical software such as R, SPSS, Stata, or Prism.
Anscombe's quartet is why you plot the data first
Correlation r ranges from −1 to +1.
Pearson r measures a linear relationship.
Spearman ρ is Pearson r computed on the ranks.
Spearman tracks monotonic trends, curved or straight, and caps an outlier at the end rank.
r = covariance ÷ (SDₓ · SD_y).
Significance: t = r√((n−2)/(1−r²)), df = n−2.
The 95% CI uses the Fisher z-transform.
Correlation ≠ causation — ever.
r² is the variance explained by the linear fit.
Always plot the data — see Anscombe's quartet.
Frequently asked questions
Pearson's r measures the strength of a linear (straight-line) relationship using the raw values, and works best when the data are roughly normal with no extreme outliers. Spearman's ρ replaces the values with their ranks and measures a monotonic relationship — whether y consistently increases or decreases with x, even if the trend is curved. Spearman is more robust to outliers and non-normal data. Reporting both lets you see whether an association is linear or merely monotonic.
The usual yardstick is Jacob Cohen's: in "A Power Primer" (Psychological Bulletin, 1992, Table 1) he set an r of 0.10 as small, 0.30 as medium and 0.50 as large, and wrote that these definitions "were made subjectively". The calculator labels an absolute r from 0.1 weak, from 0.3 moderate, from 0.5 strong, and from 0.7 very strong; that last band is our own, not Cohen's. What counts as large depends on the field and the question, so treat any label as a starting point. Also consider r², the square of r, which is the proportion of variance one variable shares with the other: an r of 0.5 means only 25% of the variance is shared.
It indicates the observed correlation is unlikely if the true correlation were zero — but it doesn't prove a meaningful or causal relationship. With large samples even a tiny, practically irrelevant correlation can be "statistically significant." Always look at the size of r and its confidence interval, not just the p-value. And significance never establishes causation: a third variable, selection bias, or coincidence can all produce a significant correlation between unrelated things.
Because a correlation only tells you two variables move together, not why. The relationship could run the other way, both could be driven by a common cause (a confounder), the sample could be selected in a way that creates a spurious link, or it could be coincidence — there are famous "spurious correlations" between completely unrelated time series. Establishing causation requires controlled experiments or careful causal-inference methods, not a correlation coefficient.
Because a single number can hide the shape of the relationship. Anscombe's quartet is four datasets with nearly identical means, variances, and Pearson correlation (0.82 to two decimals), yet one is a straight-line trend with ordinary scatter, one a smooth curve, one an exact line knocked off by a single outlier, and in one every point shares the same x except a single point far to the right, which alone creates the correlation. Only a scatterplot reveals these. Always plot your x against y before trusting a correlation coefficient — it takes seconds and prevents serious misinterpretation.
Using the Fisher z-transformation. Because the sampling distribution of r is skewed (especially near ±1), r is transformed with the inverse hyperbolic tangent into a value that is approximately normal, the interval is built there using a standard error of 1/√(n−3), and the endpoints are transformed back with the hyperbolic tangent, using 1.96 standard errors either side. The result is an approximate 95% confidence interval for the population correlation, which is why it is not symmetric around r. It needs at least four pairs and is undefined when r is exactly ±1, and the calculator says so in either case rather than printing a number.
Technically you can compute a correlation from three pairs, but with so few points the estimate is extremely unstable and the confidence interval enormous. An observed r of 0.5 from 10 pairs has a 95% interval running from −0.19 to 0.86, so it cannot even rule out a negative correlation; from 30 pairs the same r gives 0.17 to 0.73. For planning, Cohen's power tables (1992, Table 2) give the pairs needed to detect a true correlation 80% of the time at α = 0.05, two-sided: 28 for a large r of 0.5, 85 for a medium 0.3, and 783 for a small 0.1. Small samples also make the result very sensitive to a single outlier. Treat correlations from tiny samples as suggestive at best, and use a formal power calculation when planning a study.
When two or more values are equal, they share the average of the ranks they would otherwise occupy — for example two values tied for 2nd and 3rd both get rank 2.5. The calculator then computes Pearson's correlation on these average ranks, which is the standard, tie-correct way to compute Spearman's ρ and the one NIST's Dataplot manual gives ("Ties are replaced with an average rank"). The shortcut 1 − 6Σd² ÷ (n(n² − 1)) is exact only without ties: on Anscombe's fourth dataset, where ten x values are tied, it gives 0.625 against the correct 0.500.
Use it for learning, exploration, and quick checks. For any analysis that informs a decision, a thesis, or a publication, verify the result in established statistical software (R, SPSS, Stata, Prism), check the assumptions, examine the scatterplot, and consider whether a different method is more appropriate. This tool is educational and runs a standard algorithm, but reproducing the analysis in a validated package is good scientific practice.
No. The data you paste is processed entirely in your browser. Nothing is sent to a server, stored, or shared, and no account is required. The calculation runs on your device only, so your dataset never leaves it.
Method & sources
How it computes
Pearson r = Sxy ÷ (√Sxx · √Syy). Spearman ρ is the same computation on the ranks, tied values sharing the average of the ranks they span. Significance, for Pearson's r only: t = r√((n−2)/(1−r²)) on n−2 degrees of freedom, two-tailed p from Student's t. 95% interval by Fisher's z: tanh(atanh r ± 1.959964/√(n−3)), which needs at least four pairs and |r| < 1.
What this tool implements
- NIST/SEMATECH e-Handbook §1.3.3.26 calls the scatter plot the most important and most heavily used graphical tool for uncovering the existence and nature of relationships between variables, and states that association does not imply causality.
- NIST Dataplot defines r as Sxy / (√Sxx √Syy) and tests it on F(1, N−2), which is t² on N−2 degrees of freedom. Its rank correlation is the same statistic on ranks, with ties replaced by an average rank, and is recommended for data that can only be ranked, for monotonic but non-linear relationships, and where normality fails.
- Spearman is less sensitive to an outlier than Pearson, not immune to one: an extreme value still takes the end rank. Agreement between the two is not evidence of a straight line — a symmetric U-shape gives 0 for both.
- Strength labels: Cohen (1992, Table 1) sets r = 0.10, 0.30 and 0.50 as small, medium and large; the page's "very strong" band from 0.7 is RECATOOLS' own. Cohen's Table 2 gives 28, 85 and 783 pairs for 80% power at α = 0.05, two-sided.
- Checked 2026-10-08 against an independent reference (exact Student-t CDF, two independent Spearman formulas) on 14 datasets including Anscombe's quartet: every displayed value agreed. r² is the share of variance the linear fit explains.
Sources
- NIST/SEMATECH. e-Handbook of Statistical Methods, §1.3.3.26 Scatter Plot. https://www.itl.nist.gov/div898/handbook/eda/section3/eda33q.htm
- NIST. Dataplot Reference Manual, CORRELATION (LET subcommand): r and its significance test. https://www.itl.nist.gov/div898/software/dataplot/refman2/auxilla…
- NIST. Dataplot Reference Manual, RANK CORRELATION (1997), p. 2-43: Spearman rank correlation, ties replaced with an average rank. https://www.itl.nist.gov/div898/software/dataplot/refman2/ch2/ran…
- Cohen, J. (1992). A power primer. Psychological Bulletin 112(1), 155-159, Tables 1 and 2. https://doi.org/10.1037/0033-2909.112.1.155
Pick up where you left off
Stored only in this browser — never sent to our servers.