Correlation Calculator

Paste the pairs, one per line, with x and y separated by a space, a tab, a semicolon or a comma. You get Pearson's r, Spearman's ρ, the p-value of each as a test of significance, the ranks, and the working.

Free Runs in your browser Checked Tuesday, November 10, 2026

One pair per line: the x value and the y value. Use the decimal mark of your language. Each line needs exactly two numbers, and at least three lines are needed.

Result

Pearson correlation r — Measures the straight-line relation between x and y, from -1 to 1.
p-value of r — Two-tailed; a small value means the correlation is unlikely to be zero by chance.
Spearman correlation ρ — The Pearson correlation of the ranks. It measures a monotone relation, which need not be a straight line.
p-value of ρ — Two-tailed, from the t approximation for ρ.
Number of pairs — The number of x, y pairs read.
Degrees of freedom — n − 2, used by both t tests.
The pairs and their ranks

How it is worked out

This tool runs in your browser. What you enter is not sent to us.

How to use it

  1. Type one pair per line in Pairs x, y: the x value, then the y value.
  2. Check that each line holds two numbers and that there are at least three lines.
  3. Read Pearson correlation r and p-value of r, then Spearman correlation ρ and p-value of ρ.
  4. Check The pairs and their ranks and How it is worked out.

Pearson's r and Spearman's ρ

Pearson's r measures how closely the points lie on a straight line: it is the covariance of x and y divided by the product of their standard deviations. It runs from -1 for a perfect falling line, through 0 for no linear relation, to 1 for a perfect rising line.

Spearman's ρ replaces each value by its rank and then computes Pearson's r of the ranks. It measures any consistent rising or falling pattern, not only a straight line, and it is less affected by outliers. Tied values share the average of their ranks.

r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² Σ(y − ȳ)²)
ρ = r of the ranks; without ties, ρ = 1 − 6Σd² ÷ (n(n² − 1))
t = r √((n − 2) ÷ (1 − r²)), with n − 2 degrees of freedom

Significance and the p-value

The t test asks whether a correlation found in the sample could be zero in the population. The p-value is the probability of a correlation at least as far from zero as the one found, if the true correlation were zero. A small p-value shows that the relation is unlikely to be chance; it does not show how strong or how important the relation is.

The test assumes that the pairs are independent. For Spearman's ρ the t test is an approximation, exact for large samples; with fewer than about ten pairs, read the p-value with care.

What the calculator does not cover

  • Correlation is not causation: a strong r shows that two quantities move together, not which one causes the other.
  • Regression lines and predictions. For a line through the points, use the linear regression calculator.
  • Correlations for more than two variables, for groups of pairs that are not independent, or for categories rather than measurements.

Worked example: IQ and hours of television

For ten people (IQ and television hours, from Wikipedia's example), Pearson's r is -0.0376 with a two-tailed p-value of 0.9179, and Spearman's ρ is -0.1758, exactly -29/165, with a p-value of 0.6272. Neither correlation is significant at 5%.

x y Rank of x Rank of y Difference
106 7 7.0 3.0 4.0
86 0 1.0 1.0 0.0
100 27 4.0 7.0 -3.0

Frequently asked questions

What is the difference between Pearson's r and Spearman's ρ?

Pearson's r measures a straight-line relation between the values, so a curve that always rises can give a lower r. Spearman's ρ works on the ranks and measures any steadily rising or falling relation, and it is less affected by extreme values.

What does a correlation of 0 mean?

It means there is no linear relation between x and y in these data. A correlation near 0 does not exclude a curved or other pattern, so look at the points as well.

How many pairs do I need?

The calculator needs at least three. With only a few pairs even a large correlation can have a large p-value, so collect more data before concluding anything.

Why is the p-value sometimes exactly 0?

When every point lies exactly on a line, r is 1 or -1 and the t value is infinite, so the p-value is 0. Real data rarely give this.

Do I have to paste the pairs in the same order?

Yes. Each line must pair the x value with the y value of the same case. The order of the lines does not matter for the result.

Does the calculator send my data anywhere?

No. The calculation runs in your browser, and nothing you type is sent to our servers.

Sources

Figures and text last checked on Tuesday, November 10, 2026.

We use necessary cookies to run the site. With your consent, Google also uses advertising cookies to show personalised ads. If you reject them, you still see ads, but they are not personalised.