Correlation coefficient calculator

This correlation coefficient calculator measures how strongly two variables move together. Paste your X and Y values and read Pearson’s r, r², the p value, a 95% confidence interval and the best-fit line, with a scatter plot so you can see whether a straight line is a fair summary.

Your numbers are calculated in your browser. Nothing you enter is sent or stored.

Correlation coefficient calculatorOr describe it in Studio →

The first X goes with the first Y, and so on. The numbers stay in your browser.

Pearson r

0.7746

A large positive correlation, not statistically significant.

r² (shared variance)
0.6
p (two-tailed)
0.1240
Pairs (n)
5
95% CI of r
-0.34 to 0.984
Best-fit line
y = 2.2 + 0.6x

To report

r(3) = .77, p = .124, 95% CI [-.34, .98]

1525
Check your result: r² is r squared (0.775² = 0.60 in the example), the sign of r matches the slope of the best-fit line (+0.6 here), and r always lies between −1 and 1. If the scatter plot shows a curve, r is not telling the whole story.
Pearson r for the opening example
0.775
Pearson r for the opening example
its p value with five pairs
.124
its p value with five pairs
its 95% confidence interval
−0.34 to 0.98
its 95% confidence interval
Spearman rho for the same data
0.738
Spearman rho for the same data
  • Pearson r or Spearman rho
  • p value and 95% CI
  • Best-fit line equation
  • Scatter plot
  • Runs in your browser, free

01

How to calculate a correlation coefficient

  1. Paste the X values in the first box and the Y values in the second, in the same order: the first X belongs with the first Y.
  2. Read r. It updates as you type.
  3. Look at the scatter plot before you interpret the number: one outlier or a curved pattern can make r misleading.
residualxy
A fitted line and a residual. Each dot is one pair of measurements. The line is the one that makes the squared vertical distances as small as possible. A residual, the dashed segment, is the distance from a point to the line; the tighter the points hug the line, the closer r is to 1 or −1.

02

Pearson correlation formula

r = Σ(x − x̄)(y − ȳ) ÷ √( Σ(x − x̄)² × Σ(y − ȳ)² )

r runs from −1 (a perfect falling line) through 0 (no linear relationship) to +1 (a perfect rising line). Its square, r², is the share of the variation in one variable that a straight-line relationship with the other accounts for.

03

Worked example

The calculator opens with X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5. The means are 3 and 4.

Σ(x − x̄)(y − ȳ) = 6, Σ(x − x̄)² = 10, Σ(y − ȳ)² = 6
r = 6 ÷ √(10 × 6) = 0.775, r² = 0.60

With only five pairs this is not statistically significant (p = .124), and the 95% confidence interval runs from −.34 to .98: a strong correlation in the sample, but little certainty about the population. The best-fit line is y = 2.2 + 0.6x.

04

How to interpret r

|r|Label (Cohen, 1988)
below 0.10negligible
0.10 to 0.29small
0.30 to 0.49medium
0.50 and abovelarge

These labels are a rough guide; what counts as strong depends on the field. And a correlation, however strong, does not show that one variable causes the other.

05

p value and confidence interval

t = r × √(n − 2) ÷ √(1 − r²), on n − 2 degrees of freedom
95% CI: tanh( atanh(r) ± 1.96 ÷ √(n − 3) )

The p value tests whether the population correlation is zero. The interval, from Fisher’s z transformation, shows the range of population correlations compatible with your data, and is usually the more informative of the two.

06

Spearman’s rank correlation

Choose “Spearman (ranks)” when the data are ordinal, contain outliers, or rise together along a curve instead of a line. Each variable is replaced by its ranks (tied values share the average rank) and Pearson’s formula is applied to the ranks.

For the opening example the Y ranks are 1, 2.5, 4.5, 2.5 and 4.5, and Spearman’s rho is 0.738, against a Pearson r of 0.775. The two differ most when one extreme point dominates the data.

07

When Pearson’s r is the wrong tool

  • Curved relationships. r only measures straight-line association; a perfect U-shape can give r = 0.
  • Outliers. A single extreme pair can create or hide a correlation.
  • Ranks or ordinal scales. Switch the calculator to Spearman.
  • Two groups rather than two measurements. Compare means with the t-test calculator.

08

Common mistakes with correlation

  • Letting one outlier decide. X = 1 to 5 with Y = 3, 1, 4, 2, 3 gives r = 0.14; add a single pair at (20, 20) and r jumps to 0.97, p = .001.
  • Reading a curve as “no relationship”. Y = X² for X from −3 to 3 is a perfect relationship, yet r = 0.
  • Judging r without n. r = 0.775 is not significant with 5 pairs (p = .124) but gives p < .001 with 20 pairs.

Trust

How this page is checked

  • The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
  • The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
  • Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.

Cite this page

Sciloom. (2026). Correlation coefficient calculator. Zebra Nine Studio Inc. https://sciloom.si/correlation-coefficient-calculator

Read the full methodology · Who makes Sciloom

Frequently asked questions

What is a good correlation coefficient?

It depends on the field. As a rough guide, an absolute r of 0.1 is small, 0.3 medium and 0.5 or more large. In physical measurement much higher values are expected.

What is the difference between r and r²?

r gives the direction and strength of a linear relationship. r² is the proportion of variance in one variable accounted for by the other: r = 0.5 means r² = 0.25, or 25%.

Is my correlation statistically significant?

The calculator tests r against zero with a t-test on n − 2 degrees of freedom and reports the two-tailed p value. With few pairs, even a large r may not be significant.

Does correlation mean causation?

No. Two variables can move together because one causes the other, because a third factor drives both, or by chance.

Putting the scatter plot in a paper? The figure legend generator states n, r and the test for you.
Free to start, no sign-up.
Back to the tool ↑

More research tools