Correlation Coefficient Calculator

Calculate Pearson r, R², regression line and scatter plot instantly.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

The correlation coefficient calculator computes Pearson r — the most widely used measure of linear association — along with , a scatter plot with the least-squares regression line, and full step-by-step working. It accepts any number of X/Y data pairs entered manually or pasted as CSV or tab-separated text. Everything runs inside your browser; no data ever leaves your device.

How it works

The calculator implements the one-pass summation form of Pearson’s product-moment correlation coefficient:

r = [n · ΣXY − ΣX · ΣY] ÷ √([n·ΣX² − (ΣX)²] · [n·ΣY² − (ΣY)²])

where n is the number of data pairs and all sums run over every pair. This formula is exactly equivalent to the z-score definition but computes all five sums (ΣX, ΣY, ΣXY, ΣX², ΣY²) in a single pass through the data, making it efficient and numerically well-conditioned.

The coefficient of determination R² is simply r², expressing as a percentage how much of the variance in Y is explained by the linear model fitted to X. The regression line y = slope · x + intercept is derived from the same five sums: slope = (n·ΣXY − ΣX·ΣY) / (n·ΣX² − (ΣX)²) and intercept = (ΣY − slope·ΣX) / n. These are the standard ordinary least-squares (OLS) estimates that minimise the sum of squared vertical residuals.

The scatter plot is drawn on an HTML canvas element — no chart library required, no bundle overhead. Orange circles are your data points; the purple dashed line is the fitted regression line, extended slightly beyond the data range to make its slope visible.

The strength label follows Cohen’s (1988) widely cited benchmarks: negligible (|r| below 0.1), weak (0.1–0.3), moderate (0.3–0.5), strong (0.5–0.7), very strong (0.7–0.9) and near-perfect (above 0.9). Direction (positive / negative) is indicated both by the sign of r and by the colour of the result badge.

Worked example

A sports scientist collects resting heart rate (X, beats per minute) and VO₂ max (Y, mL/kg/min) for eight recreational runners:

PairX (HR)Y (VO₂)
15258
25556
36052
46349
56845
67142
77539
88034

Entering these values gives:

  • r = −0.9985 (near-perfect negative correlation)
  • R² = 0.9970 (99.7% of variance in VO₂ explained by resting HR)
  • Regression line: VO₂ = −1.0714 · HR + 113.64

This means that for every 1 bpm rise in resting heart rate, VO₂ max falls by about 1.07 mL/kg/min on average. The near-unity R² shows the relationship is strongly linear across this particular sample — though with only 8 points we should be cautious about generalising.

Formula note

Pearson r assumes both variables are measured on a continuous (or at least interval) scale with no severe outliers, and that the relationship is approximately linear. For ranked or ordinal data use Spearman’s ρ (rank the data, then apply the same Pearson formula to the ranks). For two binary variables use the phi coefficient (which is numerically identical to Pearson r on 0/1 data). For one continuous and one binary variable the point-biserial correlation applies — and it too is a special case of Pearson r. In all these special cases you can still enter the numerical codes in this calculator and obtain the correct r.

Ad placeholder (rectangle)