Skip to content
MoneyDeck

Correlation Coefficient Calculator

Measure how strongly two variables move together with Pearson’s r

Updated · Free, no signup

Separate with commas, spaces or new lines.

Pearson correlation coefficient (r)

0.8783

Coefficient of determination (R²)

0.7714

Strength and direction

Strong positive

Spearman rank correlation (ρ)

0.8533

t statistic

3.6742

p-value (two-tailed)

0.021312

Number of pairs (n)

6

Sample covariance

2.7

  • Strong positive relationship: R² = 0.7714, so about 77.1% of the variation in y is explained by a straight line in x.
  • The correlation is statistically significant at the 5% level (p = 0.0213).
  • Line of best fit: y = 0.7714x + 1.8.

Data (sorted by x) and line of best fit

About the Correlation Coefficient Calculator

This correlation coefficient calculator measures the strength and direction of the linear relationship between two variables. Paste your x values and y values as two lists and it returns Pearson’s r (from −1 to +1), the coefficient of determination R², Spearman’s rank correlation, and a t-test telling you whether the correlation is statistically significant.

It suits students checking homework, researchers exploring survey or lab data, and analysts asking questions like “does ad spend track sales?” or “are study hours related to test scores?”. The chart plots each pair next to the line of best fit so you can see whether a straight line is a sensible description of the data.

Values are paired by position: the first x goes with the first y, and extra values in the longer list are ignored. Remember that correlation does not prove causation, and Pearson’s r only captures straight-line relationships — Spearman’s rho is more robust to outliers and curved but monotonic trends.

With the default inputs, the pearson correlation coefficient (r) is 0.8783. Change any value above to recalculate instantly.

How to use the correlation coefficient calculator

  1. 1Paste or type your x values, separated by commas, spaces or new lines.
  2. 2Enter the matching y values in the same order.
  3. 3Read Pearson’s r and its strength label.
  4. 4Check R² for the share of variation explained and the p-value for significance.
  5. 5Look at the chart to confirm the relationship is roughly a straight line.

Formula and method

r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² × Σ(y − ȳ)²] t = r√(n − 2) ÷ √(1 − r²)

Pearson’s r divides the covariance of x and y by the product of their standard deviations, which scales it to lie between −1 (perfect negative line) and +1 (perfect positive line); 0 means no linear relationship. Squaring r gives R², the share of the variance in y explained by a linear fit.

Significance is tested with t = r√(n − 2)/√(1 − r²), which follows a t distribution with n − 2 degrees of freedom under the null hypothesis of zero correlation; the two-tailed p-value comes from the regularized incomplete beta function. Spearman’s rho is Pearson’s r applied to the ranks of the data, with ties given their average rank.

x̄, ȳ
Means of the x and y values
n
Number of (x, y) pairs
r
Pearson correlation coefficient
R²
Coefficient of determination (r squared)

Worked examples

Six paired observations

Here x̄ = 3.5, ȳ = 4.5, Σ(x − x̄)(y − ȳ) = 13.5, Σ(x − x̄)² = 17.5 and Σ(y − ȳ)² = 13.5. So r = 13.5 ÷ √(17.5 × 13.5) ≈ 0.878, R² ≈ 0.771, and with 4 degrees of freedom p ≈ 0.021 — a strong, significant positive correlation.

Study hours vs exam score

Scores rise almost perfectly in step with hours studied: r ≈ 0.994, so about 98.7% of the variation in scores is explained by hours, and the ranks agree perfectly (ρ = 1). The t statistic of about 15.2 with 3 degrees of freedom is highly significant.

Negative relationship

As x increases y falls steadily, giving r ≈ −0.995 and t = −18. Because every increase in x comes with a decrease in y, the ranks are perfectly reversed and Spearman’s rho is exactly −1.

Frequently asked questions

What is a good correlation coefficient?+

It depends on the field, but a common rule of thumb is |r| ≥ 0.7 strong, 0.5–0.7 moderate, 0.3–0.5 weak and below 0.3 very weak. In physics and engineering r above 0.95 may be expected; in social sciences 0.3 can be meaningful.

What is the difference between r and R²?+

r measures the strength and direction of a linear relationship (−1 to +1). R² is r squared (0 to 1) and tells you the proportion of variance in y explained by x. An r of 0.8 means R² = 0.64, or 64% explained.

Does correlation mean causation?+

No. A strong correlation shows two variables move together, but a third factor could drive both, the direction could be reversed, or it could be coincidence. Establishing causation needs controlled experiments or careful causal analysis.

When should I use Spearman instead of Pearson?+

Use Spearman’s rank correlation when data are ordinal, contain outliers, or follow a curved but consistently increasing or decreasing pattern. Pearson assumes a linear relationship and is sensitive to extreme values.

How many data points do I need?+

You need at least three pairs to compute a p-value, but small samples produce unstable estimates. With 10 pairs, r must exceed about 0.63 to be significant at 5%; with 30 pairs about 0.36 is enough.

Related tools