Skip to content

Correlation Coefficient Calculator

Pearson r, Spearman ρ, r², t statistic and p-value from paired (x, y) data, with a plain-language strength rating.

Your details

Paired data

One row per individual or observation, with its two measurements x and y.

Results update as you type

Pearson correlation r

0.9581

Strength and direction
Very strong, positive
r² (shared variance)
0.918
t statistic
9.462
Degrees of freedom (n − 2)
8
p-value (two-tailed)
1.3 × 10⁻⁵
Spearman rank correlation ρ
0.9544
Spearman p-value (approx.)
1.8 × 10⁻⁵
Number of pairs n
10

p = 1.3 × 10⁻⁵ < 0.05: the correlation is statistically significant at the 5 % level.

Step-by-step solution
  1. r = Σ(x − x̄)(y − ȳ) / √(Σ(x − x̄)² · Σ(y − ȳ)²) = 0.95811
  2. t = r√(n − 2) / √(1 − r²) = 0.95811 × √8 / √(1 − 0.917974) = 9.462
  3. p = 2 × P(T(8) ≥ |t|) = 1.3 × 10⁻⁵
  4. ρ = r(rank x, rank y) = 0.954412

Data and ranks (ties share the average rank)

A correlation coefficient summarizes in one number how closely two quantitative variables move together. Height and shoe size, temperature and ice-cream sales, revision time and grades: when one goes up, does the other tend to go up (positive correlation), go down (negative correlation), or do neither?

This page works as a Pearson correlation calculator and a Spearman calculator at once. From your list of (x,y)(x, y) pairs it returns:

  • Pearson's r, the classic product-moment coefficient that measures the strength of a linear relationship, from −1 to +1;
  • a plain-language strength rating (weak, moderate, strong…) with the direction;
  • r², the share of variance the two variables have in common;
  • the t statistic with n−2n - 2 degrees of freedom and the two-tailed p-value for testing whether the true correlation is zero;
  • Spearman's ρ, the rank correlation, which captures any monotonic relationship and resists outliers, with an approximate p-value;
  • a table showing the rank of every value, ties sharing the average rank.

The steps show each formula with your numbers.

How to use this calculator

  1. Enter one pair per row: the two measurements taken on the same individual, day or item. The order of the rows does not matter, but the pairing does.
  2. Add rows as needed (at least 3, up to 200). Blank rows are skipped; a row with only one value is flagged.
  3. Read r at the top, its strength rating, then the p-value. Compare with ρ: if they differ a lot, look for outliers or a curved pattern.
  4. Open the table to see the ranks used for Spearman's coefficient.

Swapping the x and y columns does not change r or ρ: correlation is symmetric, unlike linear regression.

The formula

Pearson's r is the covariance divided by the product of the standard deviations:

r=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2 ∑(yi−yˉ)2r = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum (x_i - \bar{x})^2\,\sum (y_i - \bar{y})^2}}

To test H0:ρ=0H_0: \rho = 0 (no correlation in the population), compute

t=rn−21−r2t = \frac{r\sqrt{n - 2}}{\sqrt{1 - r^2}}

which follows a Student tt distribution with n−2n - 2 degrees of freedom; the p-value is 2 P(T≥∣t∣)2\,P(T \ge |t|).

Spearman's ρ is Pearson's r applied to the ranks of the data, tied values receiving the average of the ranks they occupy. Without ties it reduces to ρ=1−6∑di2n(n2−1)\rho = 1 - \dfrac{6\sum d_i^2}{n(n^2 - 1)}, where did_i is the difference of ranks. The calculator always uses the rank-Pearson form, which is exact with ties.

Worked example

On ten summer days a lemonade stand records the daily high temperature xx (°C) and the cups sold yy — the default data: (18, 42), (21, 50), (23, 47), (23, 58), (26, 61), (28, 66), (30, 64), (31, 75), (33, 80), (35, 78).

The calculator finds r=0.9581r = 0.9581: a very strong positive linear relationship. Then r2=0.918r^2 = 0.918, so about 91.8 % of the day-to-day variation in sales goes with temperature.

The significance test gives t=0.9581×8/1−0.918=9.462t = 0.9581 \times \sqrt{8} / \sqrt{1 - 0.918} = 9.462 with 8 degrees of freedom, and a two-tailed p-value of 1.3 × 10⁻⁵, far below 0.05: a correlation this strong is very unlikely to arise by chance in ten days.

The two days at 23 °C are tied, so each receives rank 3.5. Spearman's coefficient is ρ=0.9544\rho = 0.9544, close to r, which confirms that the relationship is monotonic and not driven by one extreme day.

How strong is my correlation?

Size of r (sign ignored) Usual description
below 0.1 negligible, no linear relationship
0.1 to 0.3 weak
0.3 to 0.5 moderate
0.5 to 0.7 strong
0.7 to 1 very strong

These bands follow Cohen's widely used conventions (0.1 small, 0.3 medium, 0.5 large), but they are only a guide: in physics a correlation of 0.9 may be disappointing, while in psychology 0.3 can be important. Strength and significance are different things: with 1,000 pairs, r=0.07r = 0.07 is "significant" yet negligible; with 5 pairs, r=0.8r = 0.8 may not be significant.

Pearson or Spearman?

Use Pearson when both variables are numeric, the relationship looks like a straight line on a scatter plot and there are no extreme outliers; its significance test also assumes approximately normal data. Use Spearman for ranks or ordinal scales (satisfaction from 1 to 5), for a relationship that rises steadily but curves, or when one or two outliers would dominate Pearson's r. A large gap between r and ρ is itself a warning sign worth investigating.

Remember that a correlation, however strong, does not prove causation: hot weather drives lemonade sales, but a hidden third variable often explains both xx and yy.

Frequently asked questions

How do I use a Pearson correlation calculator?

Enter your paired observations, one (x, y) pair per row, and read r at the top. It ranges from −1 (perfect negative line) through 0 (no linear relationship) to +1 (perfect positive line). The p-value tells you whether r differs significantly from zero.

What is a good correlation coefficient?

It depends on the field. As a rough guide, |r| above 0.5 is strong and above 0.7 very strong. What matters is whether the relationship is large enough to be useful for your question, and whether it is statistically significant given your sample size.

What does a negative correlation mean?

That high values of x go with low values of y, and vice versa — for example car age and resale price. The sign gives the direction; the size of |r| gives the strength. r = −0.8 is as strong as r = +0.8.

How many pairs do I need for a reliable correlation?

The calculator needs at least 3, but small samples give very unstable estimates: with 5 pairs, even r = 0.85 is only borderline significant. Aim for 30 or more pairs if you want a reasonably precise estimate of r.

Why are Pearson’s r and Spearman’s ρ different?

Pearson measures linear association on the raw values; Spearman measures monotonic association on the ranks. A curved but steadily rising pattern, or a single outlier, can make them differ. If ρ is much higher than r, the relationship is probably monotonic but not linear.

Sources

Last updated:

More Statistics calculators

People also use