Correlation Coefficient Calculator
Paste two columns of numbers into a spreadsheet and you can see they move together, but your eye cannot tell you how strongly, whether the pattern could be luck, or what line best fits it. That is the gap between looking at data and being able to say something defensible about it.
This calculator takes paired X and Y values and returns Pearson’s correlation coefficient r with its strength reading, r-squared, both means and standard deviations, the least-squares regression line, and a proper significance test with a t-statistic and two-tailed p-value.
Pearson’s r measures linear association only. It can miss a strong curved relationship completely, and correlation alone never proves causation.
Quick Answer
Key takeaways
- R measures linear association only, on a fixed scale from -1 to +1. The sign gives direction; the size gives strength.
- R-squared converts r into a percentage of variance explained, which is usually the more honest number to quote.
- A strong r from a tiny sample can still be luck. The p-value in the result is what separates a pattern from a coincidence.
- If X or Y never varies, r is undefined, and this calculator says so instead of inventing a number.
- Quick Answer
- How to use the correlation coefficient calculator
- The Pearson formula, step by step
- Worked example, checked against this exact tool
- What r and r-squared tell you, and what they hide
- The significance test: why n is half the story
- What competing calculators miss
- Frequently Asked Questions
- Add This Calculator to Your Website
- References
How to use the correlation coefficient calculator
Paste your X values into the first box and your Y values into the second, comma-separated, keeping the pairing intact: the first X goes with the first Y, the second with the second, and so on. Order inside each list is the pairing, so never sort one list on its own. The boxes are pre-filled with the worked example, and the Load sample data button restores it if you clear them.
Press Calculate and read the result in order: r and its strength band first, then r-squared, then the significance line at the bottom. If the tool reports that r is undefined, one of your lists is constant, and no correlation exists to compute. If your next step is judging how precise an estimate like this is at larger samples, the confidence interval calculator covers the interval side of the same statistical thinking.
The Pearson formula, step by step
Pearson’s r compares how the two variables vary together against how much each varies on its own.
There is a second way to see the same number that explains why r is unit-free. Convert every X and Y to a z-score, a count of standard deviations from its mean, and r is simply the average product of the paired z-scores: points that are high on both, or low on both, push r up, and mismatched points pull it down. That is why the area to z-score calculator is a useful companion when you are learning the standardization step. Penn State’s statistics course notes use the same definition and the same t-test for significance that this calculator runs, and OpenStax Introductory Statistics sets out the test’s assumptions: paired quantitative data, a roughly linear pattern, and no single point dominating the result.
Worked example, checked against this exact tool
The calculator is pre-filled with five pairs: X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 6. Every figure below is what it returns.
| Output | Value | Reading |
|---|---|---|
| Pearson’s r | 0.8528 | Strong positive |
| r-squared | 0.7273 | 72.7% of Y variance explained |
| X mean and SD | 3.0000, 1.5811 | Sample standard deviation |
| Y mean and SD | 4.2000, 1.4832 | Sample standard deviation |
| Regression line | y = 1.8000 + 0.8000x | Least-squares fit |
| Significance | t = 2.828, df = 3, p = 0.0663 | Not significant at 5% |
The sums behind r are worth seeing once: ∑x = 15, ∑y = 21, ∑xy = 71, ∑x² = 55, ∑y² = 97. The numerator is 5 x 71 – 15 x 21 = 40, and the denominator is √{(5 x 55 – 225)(5 x 97 – 441)} = √{50 x 44} = 46.90, giving r = 40 / 46.90 = 0.8528. The slope of the regression line, 0.8000, is a different animal from r: it is in Y-units per X-unit, and the average slope calculator covers slope as a standalone concept when you need it for two endpoints rather than a fitted line.
What r and r-squared tell you, and what they hide
R answers one narrow question well: how tightly do the points hug a straight line? Its bands, as this calculator applies them, run from very weak under 0.30 through weak, moderate, and strong, to very strong at 0.90 and above. Those bands are conventions, not laws: in psychology an r of 0.30 can be a meaningful finding, while in instrument calibration anything under 0.99 is a problem.
What r hides matters just as much. A perfect U-shaped relationship can return r near zero, because no straight line fits a curve. One extreme outlier can manufacture an r of 0.85 out of a shapeless cloud, or destroy a real one. And r says nothing about cause. Always picture the scatterplot before quoting the number; the statistic summarizes a shape it cannot show you.
The significance test: why n is half the story
The test asks whether an r this size could plausibly appear if the population correlation were zero. It converts r to a t-statistic, t = r√[(n – 2)/(1 – r²)], and reads a two-tailed p-value from the t distribution with n – 2 degrees of freedom, computed here through the incomplete beta function rather than a lookup table.
The worked example is the perfect cautionary case. R = 0.8528 looks decisive, yet with n = 5 the test gives p = 0.0663, just over the 5% line: five pairs can line up this well by chance about one time in fifteen. Hold r fixed and grow the sample and the verdict flips fast, because t grows with √(n – 2). At n = 12 the same r gives t of about 5.2 and a p-value under 0.001. Report r, n, and p together; quoting any one of them alone misleads.
What competing calculators miss
Most correlation tools in the search results return r and stop, and a few add a chart. The gaps that matter are quieter than that.
Miss 1: no significance test. R without a p-value invites overconfidence, above all on the small samples students and analysts actually paste in. This calculator runs the full t-test and states the verdict in plain words next to the numbers.
Miss 2: no regression line. Half the people computing a correlation want the line that goes with it. The slope and intercept are in the same result block here, derived from the same sums, so the two never disagree.
Miss 3: silent failure on constant data. When every X is identical, many tools return NaN or, worse, 0, which reads as no correlation when the truth is no correlation can be defined. This one names the problem and stops.
One honest limit: this is a Pearson-only tool. It does not compute Spearman’s rank correlation, draw the scatterplot, or flag outliers for you, so curved or outlier-driven data still needs your eyes on a plot before you trust the output.
Frequently Asked Questions
Pearson’s r is the standard correlation coefficient for linear relationships. It runs from -1 to +1: +1 is a perfect upward line, -1 is a perfect downward line, and 0 means no linear relationship at all. This calculator computes it from paired X and Y values using the sums formula shown in the formula section.
It depends on the field, but the bands this calculator uses are a common guide: 0.90 and up is very strong, 0.70 to 0.89 is strong, 0.50 to 0.69 is moderate, 0.30 to 0.49 is weak, and below 0.30 is very weak. A moderate r from a large, clean sample is usually worth more than a strong r from five noisy points.
R-squared is r multiplied by itself, and it reads as the share of Y’s variation that the linear relationship with X accounts for. An r of 0.8528 gives an r-squared of 0.7273, meaning about 72.7% of the variation in Y tracks X in the sample data. The other 27.3% is down to everything else, including noise.
The p-value is the probability of seeing an r at least this large in a sample of this size if there were truly no correlation in the population. Small samples produce large r values by luck surprisingly often: with only 5 pairs, even r = 0.8528 gives p = 0.0663, which misses the usual 5% significance line.
Because significance depends on sample size as much as on r. The t-statistic grows with the square root of n – 2, so the same r = 0.85 that is inconclusive at n = 5 becomes clearly significant at n = 12 or 15. Collect more pairs before concluding anything either way.
R is undefined. Correlation measures how Y moves as X moves, and if X never moves there is nothing to measure: the formula divides by zero variance. This calculator detects that case and tells you plainly instead of returning a fake number.
No. A strong r says two variables move together in your data. It cannot say one causes the other: a third variable may drive both, the causation may run the other way, or the pairing may be coincidence, which is exactly what the significance test is there to screen for.
Use Spearman’s rank correlation when your data are ranks or ordered categories, when the relationship is curved but steadily rising or falling (monotonic rather than linear), or when a few extreme outliers would dominate Pearson’s r. This calculator is Pearson-only, so if a scatterplot shows a clear curve, treat its r as a lower bound and switch methods.
The least-squares line y = a + bx that best predicts Y from X in your sample. Its slope is r scaled by the ratio of the two standard deviations, and it always passes through the point (X mean, Y mean). In the worked example the line is y = 1.8000 + 0.8000x.
Two pairs is the mathematical minimum, and the calculator accepts it, but the significance test has almost no power at tiny samples. Treat anything under about 10 pairs as exploratory, and aim for 20 or more pairs before relying on the p-value.
Add This Calculator to Your Website
References
- Penn State University, STAT 200 course notes: correlation strength guidelines, the t-test for a population correlation, and its assumptions. Penn State STAT 200: Correlation. Accessed October 2026.
- OpenStax, Introductory Statistics: testing the significance of the correlation coefficient, including the critical-value method and test assumptions. OpenStax Introductory Statistics: Significance of the Correlation Coefficient. Accessed October 2026.
- Frank Harrell, Biostatistics for Biomedical Research: Pearson and Spearman correlation, Fisher’s z transformation, and confidence intervals for r. Biostatistics for Biomedical Research: Correlation and Nonparametric Regression. Accessed October 2026.
- Richard Lowry, VassarStats: the significance test for the Pearson product-moment correlation coefficient and its t distribution basis. VassarStats: Significance of a Correlation Coefficient. Accessed October 2026.
- CourseKata, Improving Psychological Research Methods and Data Science: the correlation coefficient as the slope of the standardized regression line. CourseKata: The Correlation Coefficient, Pearson’s R. Accessed October 2026.
