Correlation Coefficient Calculator

Paste paired X and Y values to get Pearson r, R², Spearman ρ, and two-tailed significance — with every sum of squares shown step by step.

Presets:

10 valid pairs

Correlation Results (n = 10 pairs, df = 8)

Pearson r

0.9917

R² (Explained)

0.9834

98.3% variance

Spearman Rank (ρ)

0.9879

t-statistic (df = 8)

21.7781

Two-tailed p-value

< 0.0001

Sample Covariance (s_xy)

18.8556

r = 0.992 — a strong positive linear relationship: as Study Hours goes up, Exam Score tends to go up as well.

Significance at α = 0.05: Statistically significant linear correlation (p < 0.05).

Regression line: y = 6.082x + 50.478Open in Scatter Plot Maker

Step-by-Step Pearson r Formula Substitution

Toggle steps

1. Sample means & SDs

x̄ = 3.9, s_x = 1.7607

ȳ = 74.2, s_y = 10.7992

2. Sums of squares & cross-products

SS_xx = Σ(x − x̄)² = 27.9

SS_yy = Σ(y − ȳ)² = 1,049.6

SS_xy = Σ(x − x̄)(y − ȳ) = 169.7

3. Substitute into Pearson r

r = SS_xy ÷ √(SS_xx × SS_yy)

r = 169.7 ÷ √(27.9 × 1,049.6) = 0.9917

How to Calculate the Correlation Coefficient (Pearson r)

Given n paired observations (x₁, y₁), (x₂, y₂), …, (xₙ, yₙ), Pearson's product-moment correlation coefficient standardizes how X and Y co-vary around their respective sample means x̄ and ȳ:

r = Σ(xᵢ − x̄)(yᵢ − ȳ) ÷ √[ Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² ] = SS_xy ÷ √(SS_xx · SS_yy)
  1. Find both sample means: Compute x̄ = (Σx) ÷ n and ȳ = (Σy) ÷ n. If you also need medians, modes, or outlier fences on a single column first, check our mean median mode calculator.
  2. Compute deviations and cross-products: For every pair, subtract the mean to get (xᵢ − x̄) and (yᵢ − ȳ). When above-average X values pair with above-average Y values, their product is positive; when above-average X pairs with below-average Y, their product is negative.
  3. Divide by geometric spread: Dividing SS_xy by √(SS_xx · SS_yy) cancels out physical measurement units—so converting temperatures from Celsius to Fahrenheit or distances from miles to kilometers leaves r completely unchanged!

How to Interpret r: Strength, Sign, and R²

Positive, negative, and zero correlation

A positive correlation (0 < r ≤ +1) means X and Y move in the same direction: higher study hours tend to pair with higher test scores. A negative correlation (−1 ≤ r < 0) means X and Y move in opposite directions: higher unit prices tend to pair with fewer units sold. Note that r = −0.85 is a stronger linear relationship than r = +0.60 because |−0.85| > |+0.60|!

Correlation strength guidelines

|r| RangeR² (Variance Explained)Practical Interpretation
0.90 to 1.0081% to 100%Very strong linear alignment (common in physics/calibration).
0.70 to 0.8949% to 79%Strong linear relationship; reliable trendline predictions.
0.40 to 0.6916% to 48%Moderate relationship (typical in behavioral & business data).
0.10 to 0.391% to 15%Weak linear trend; wide scatter around the regression line.
0.00 to 0.09< 1%Negligible or zero linear association.

Pearson r vs Spearman rank correlation (ρ)

This calculator outputs both Pearson r and Spearman's rank correlation (ρ) side by side so you can spot curvature or outlier distortion immediately. Click the Curved growth preset above to see why: exponential pairs (1, 2) through (8, 460) bend upward sharply, pulling linear Pearson r down to roughly 0.78 even though Y increases every single time X increases — which Spearman captures as ρ = 1.000!

Testing Statistical Significance: t-Statistic and p-Value

Sample size matters enormously when judging correlation. With only n = 4 pairs, even random coins can produce r = 0.75 fairly often; with n = 200 pairs, r = 0.20 is highly unlikely to happen by pure luck. To test the null hypothesis H₀: ρ = 0 (no linear correlation in the underlying population), the calculator computes Student's t-statistic with df = n − 2 degrees of freedom:

t = (r · √(n − 2)) ÷ √(1 − r²)

When the resulting two-tailed p-value is smaller than 0.05, the correlation is statistically significant at the 95% confidence level.

Correlation Does Not Imply Causation (and Why You Should Plot Your Data)

Even when r = 0.92 and p < 0.0001, correlation alone cannot prove that changing X causes Y to change — a lurking confounding variable (like summer heat driving both ice-cream sales and swimming-pool attendance) may drive both columns together. Furthermore, Anscombe's famous quartet proves that four wildly different datasets—a clean line, a parabola, a line with one extreme Y outlier, and a vertical cluster with one leverage point—can all share the exact same r = 0.816! Always click Open in Scatter Plot Maker in the results panel (or visit our full scatter plot maker) to inspect your coordinates visually, or check each variable's own distribution in the histogram maker.

Correlation Coefficient Calculator FAQ

What does the correlation coefficient r measure?

Pearson's correlation coefficient r measures the strength and direction of a straight-line (linear) relationship between two continuous numeric variables X and Y. It ranges strictly from −1 (perfect downward line) through 0 (no linear trend) to +1 (perfect upward line).

What is the formula for Pearson's correlation coefficient?

Pearson r equals the sum of cross-products of deviations divided by the square root of the product of each variable's sum of squared deviations: r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² · Σ(y − ȳ)²]. Equivalently, r equals sample covariance s_xy divided by (s_x · s_y).

What is considered a strong correlation?

As a general rule of thumb across introductory statistics and social science, |r| ≥ 0.70 indicates a strong linear correlation, 0.40 ≤ |r| < 0.70 indicates a moderate correlation, 0.10 ≤ |r| < 0.40 indicates a weak correlation, and |r| < 0.10 indicates virtually no linear relationship.

What is the difference between Pearson r and Spearman rank correlation?

Pearson r measures strictly linear association using raw numeric values and can be distorted by outliers or curved growth. Spearman rank correlation (ρ) converts X and Y into rank positions (1st, 2nd, 3rd...) before computing r, making it ideal for monotonic curves, ordinal scales, or outlier-heavy pairs.

How do I know if my correlation is statistically significant?

Compare the two-tailed p-value (computed from t = r√(n − 2) ÷ √(1 − r²) with df = n − 2 degrees of freedom) against your alpha threshold, typically α = 0.05. When p < 0.05, a correlation as strong as yours would rarely occur by random chance alone if the true population correlation were zero.

Why can r be close to zero even when X and Y are clearly related?

Because Pearson r detects straight lines only! If Y rises steeply and then falls symmetrically in an inverted-U curve (such as performance versus arousal), positive slopes on the left cancel negative slopes on the right, producing r ≈ 0. Always check the scatter preview to spot curves.