🧮
🧮 Math & statistics

Correlation Coefficient Calculator (Pearson & Spearman)

Results update as you type.

Your numbers

Understanding the correlation coefficient calculator — concept and principle

A correlation coefficient measures how strongly two variables move together, on a scale from −1 to +1. Pearson's r captures straight-line (linear) association; Spearman's ρ captures any monotonic association by working on ranks. Researchers use them to check whether study time relates to grades, advertising to sales, or height to weight, before moving on to regression.

Scatter of six points split at the meansMost points sit in the green quadrants where (x − x̄)(y − ȳ) is positive. The products sum to 13.5, giving r = 0.878, R² = 0.771 and Spearman ρ = 0.853.Do x and y move together?x̄ = 3.5ȳ = 4.5++−−6.256.25Σ(x−x̄)(y−ȳ)= 13.5r = 13.5 ÷ √(17.5×13.5)= 0.878R² = r²= 0.771Spearman (ranks)ρ = 0.853green corners push r up, pink corners pull it down
Points in the green corners add to the sum; here r = 0.878, a strong positive link.

How it is calculated

X and Y must be paired values of equal count (at least 3). Units cancel, so r has no unit.

The principle

The numerator adds up products of deviations: when a point is above average in both x and y (or below in both), the product is positive; when one is above and the other below, it is negative. Dividing by the two spreads rescales the sum so that a perfect line gives exactly ±1. Geometrically, r is the cosine of the angle between the two centred data vectors. Ranks make Spearman's version insensitive to outliers and to curved but steadily increasing relationships.

Worked example

  1. X = 1, 2, 3, 4, 5, 6 and Y = 2, 4, 5, 4, 5, 7. Means: x̄ = 3.5, ȳ = 4.5.
  2. Σ(x − x̄)(y − ȳ) = 13.5, Σ(x − x̄)² = 17.5, Σ(y − ȳ)² = 13.5.
  3. r = 13.5 ÷ √(17.5 × 13.5) = 13.5 ÷ 15.3704 = 0.8783100657, and R² = 0.7714285714.
  4. Ranks of Y: 1, 2.5, 4.5, 2.5, 4.5, 6 (the two 4s and the two 5s are tied). Pearson r on the ranks gives Spearman ρ = 0.8533103352.
  5. t = 0.87831 × √(4 ÷ 0.228571) = 3.674 with 4 df, so the two-tailed p-value = 0.0213116411.

How to read the result

Where does your result fall?≥0-0.3-0.10.10.3≥1Large negativeMedium negativeSmall negativeNegligibleSmall positiveMedium positiveLarge positiveYour result: 0.87831 · Large positiveReference: Cohen (1988) guide for |r|
Where does your result fall?

The sign gives the direction and the size gives the strength. A common rough guide (Cohen, 1988) calls |r| ≈ 0.1 small, 0.3 medium and 0.5 large, though conventions vary by field. Here r ≈ 0.88 is a strong positive association, and p ≈ 0.021 < 0.05 means it is unlikely to be pure chance with six points. R² = 0.77 means a straight line accounts for about 77% of the variation in Y.

Common mistakes

Keep in mind: The p-value assumes independent pairs and, for Pearson, roughly bivariate normal data. With very few points a large r can still be unreliable.

Frequently asked questions

When should I use Spearman instead of Pearson?

Use Spearman for ordinal data (rankings, Likert scales), skewed data or monotonic but non-linear relationships.

Is r = 0.5 twice as strong as r = 0.25?

Not in terms of explained variance: R² is 0.25 versus 0.0625, four times larger.

Does a significant p-value mean the correlation is strong?

No. With thousands of pairs even r = 0.05 can be significant; always look at the size of r as well.

Sources: Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum. · NIST/SEMATECH e-Handbook of Statistical Methods.

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →