ProMathTools
ProMathTools

Correlation Coefficient Calculator – Pearson r With Steps

Pearson's r and R² from paired X and Y lists or pasted columns — with strength wording, a t-test of H0: ρ = 0, a scatter plot, and a step-by-step deviation table.

Comma, space, tab, or newline separated

Must match the length of X

How it works

Pearson's product-moment correlation coefficient r summarizes how strongly two quantitative variables move together along a straight line. Enter equal-length X and Y lists (or paste two columns), and this calculator returns r, the coefficient of determination R² = r², a plain-language strength and direction label, sample size n, and a two-sided t-test of the null hypothesis that the population correlation ρ equals zero. An inline SVG scatter plot shows the paired points so you can spot nonlinearity, outliers, or clusters that a single number cannot capture. Under the hood, the tool centers each variable, accumulates the sums of squares and cross-products Sxx, Syy, and Sxy, then forms r = Sxy / √(Sxx · Syy). When either variable has zero variance, correlation is undefined and you get a clear error instead of NaN or Infinity.

Required Inputs & Typical Use Cases

Use this calculator for AP Stats or college homework that asks for Pearson r with working, exploratory data analysis before fitting a line, checking whether study hours associate with exam scores, comparing sensor readings, or verifying spreadsheet CORREL / PEARSON results. Paste two columns from a CSV or spreadsheet when you already have (x, y) pairs; use separate lists when X and Y come from different fields. Pair it with linear regression when you need a slope and intercept, or with covariance when you want the unstandardized association measure.


The Formula

r = Sxy / √(Sxx · Syy)
Sxx = Σ(xᵢ − x̄)²,  Syy = Σ(yᵢ − ȳ)²,  Sxy = Σ(xᵢ − x̄)(yᵢ − ȳ)
R² = r²
t = r √((n − 2)/(1 − r²)),  df = n − 2
two-sided p = 2 · (1 − F_t(|t|; df)) for H0: ρ = 0
  • r

    Pearson's sample correlation (−1 to +1)

  • R²

    Coefficient of determination (r squared)

  • x̄, ȳ

    Sample means of X and Y

  • Sxx, Syy, Sxy

    Sums of squared deviations and cross-products

  • t, df

    Test statistic and degrees of freedom n − 2

  • ρ

    Population correlation under the null (tested as 0)


Worked Example

  1. X = 1…5, Y = 2, 4, 5, 4, 5

    n = 5, x̄ = 3, ȳ = 4. Sxx = 10, Syy = 6, Sxy = 6. Then r = 6/√(10·6) ≈ 0.774597, R² = 0.6 (exactly 3/5). Strength: strong positive linear association. t ≈ 2.12132 with df = 3; two-sided p ≈ 0.124035 — not significant at α = 0.05 with this small sample.


Tips, Assumptions & Limitations

  • Need ≥ 3 paired observations; X and Y must be the same length.
  • r near ±1 means a tight linear pattern; r near 0 means little linear association (a curve can still exist).
  • Always look at the scatter plot — outliers and nonlinear shapes can inflate or hide |r|.
  • Correlation is not causation; a significant p-value does not prove X causes Y.
  • Common mistake: correlating mismatched lengths or mixing summary stats with raw pairs.
  • If all X or all Y values are identical, variance is zero and r is undefined.

Pearson's r measures the strength and direction of a linear relationship between paired X and Y values. It ranges from −1 (perfect negative) to +1 (perfect positive), with 0 meaning no linear association.

R² is simply r squared. It is the proportion of variance in Y that is linearly associated with X (and vice versa) under a simple linear model. For example, r ≈ 0.775 gives R² = 0.6, so about 60% of the variance is linearly shared.

You need at least three paired observations to compute r and run the two-sided t-test of H0: ρ = 0. X and Y must have the same length; unequal lists are rejected with a clear error.

Under normality assumptions, t = r √((n − 2)/(1 − r²)) with df = n − 2. The two-sided p-value is 2 × (1 − F_t(|t|; df)), where F_t is the Student-t CDF. Small p-values suggest evidence against zero correlation.

No. Correlation only describes linear association in the sample. Confounding variables, selection bias, or nonlinear patterns can produce a large |r| without a causal link. Always plot the data and consider the study design.

Then the sample variance of that variable is zero and Pearson r is undefined. The calculator reports a friendly error instead of showing NaN or Infinity.

Related Calculators

Linear RegressionCovariance CalculatorT-Test CalculatorSample Size CalculatorStandard DeviationConfidence IntervalZ-Score CalculatorMeanMedian ModeVarianceNormal Distribution
About UsBlogChrome ExtensionFAQsTerms and ConditionsPrivacy PolicySitemap
EmailLinkedInFacebook

© 2025-2026 PromathTools. All rights reserved.

Built by KruskalCode – SaaS & Automation Experts · EverydayDevTools