Correlation Coefficient Calculator

Pearson’s r, R² and the regression line for paired data

Enter paired X and Y values (same count in each box, matched in order) to get Pearson’s correlation coefficient, R², and the best-fit regression line.

Enter Your Data Points

X and Y need the same count of values, paired in order (8 X values, 0 Y values).

Textbooks differ — pick the method yours uses.

Correlation & regression

X and Y need the same count of values, paired in order (8 X values, 0 Y values).

Five Number Summary

Minimum1
Q1 (25th)2.5
Median4.5
Q3 (75th)6.5
Maximum8
Interquartile range (IQR)4
Count (n)8
Outliers (1.5 × IQR rule)None

Additional Statistics

Mean (average)4.5
ModeNone
Range7
Sum36
Std deviation (sample)2.4495
Std deviation (population)2.2913
Variance (sample)6
Mean absolute deviation2
Coefficient of variation0.5443
Standard error of the mean0.866
10th percentile1.7
90th percentile7.3
Lower inner fence (Q1 − 1.5·IQR)-3.5
Upper inner fence (Q3 + 1.5·IQR)12.5

Box & Whisker Plot

Histogram

Step-by-step solution

Export & Share

The share link reproduces your exact data and settings — paste it in an email, chat, or assignment and anyone who opens it sees the same results.

Saved Datasets

Saved to this device only (browser local storage). Use a share link to move data between devices.

What is the correlation coefficient?

Pearson’s correlation coefficient (r) measures the strength and direction of a linear relationship between two variables. It ranges from −1 (a perfect negative relationship) to +1 (a perfect positive relationship), with 0 meaning no linear relationship at all.

How to interpret r

As a rough guide: |r| above 0.7 is usually called a strong relationship, 0.3–0.7 moderate, and below 0.3 weak — but these thresholds vary by field, so treat them as a starting point rather than a rule. R² (r squared) is often more intuitive: it’s the share of the variation in Y that’s explained by X. An r of 0.8 means R² = 0.64, i.e. 64% of Y’s variation is explained by its linear relationship with X.

Correlation is not causation

A strong correlation only shows that two variables move together — it says nothing about which one (if either) causes the other, or whether both are driven by a third factor. This is the single most common misreading of a correlation result.

The regression line

Alongside r, this calculator fits the least-squares regression line y = slope×x + intercept — the straight line that minimizes the total squared vertical distance from every point to the line. It's the same line you'd get from Excel's SLOPE/INTERCEPT functions or a scatter plot's trendline.

How it's calculated

r = Σ(x–x̄)(y–ŷ) ÷ √(Σ(x–x̄)² × Σ(y–ŷ)²). The p-value tests the null hypothesis that the true correlation is zero, using the exact Student-t distribution with n−2 degrees of freedom (same underlying method as the t-test calculator).

Frequently asked questions

What sample size do I need for a correlation?

This calculator works from 2 pairs upward, but correlation estimates are noisy with small samples — at least 10–20 pairs is a common rule of thumb for a stable estimate.

Can r be exactly 0 with a real relationship between X and Y?

Yes — Pearson’s r only detects linear relationships. A strong curved (e.g. U-shaped) relationship can produce an r near 0 even though X and Y are clearly related; plot the data if r seems surprisingly low.

What is the difference between correlation and regression?

Correlation (r) measures how strongly two variables move together, with no assumption about which one is the cause. Regression fits a specific line predicting Y from X, which implicitly treats X as the input and Y as the output.

Related calculators

Guides & how-tos