Skip to content

Correlation Coefficient Calculator

Calculate correlation coefficient with instant, accurate results and clear step-by-step output.

By CalcGenius Editorial TeamLast reviewed August 28, 20253 min read
Pearson Correlation Coefficient Calculator

Independent variable values. At least 2 values, ideally 30+.

Dependent variable values. Must have the same number as X.

📊
Enter your values and click Calculate
Correlation ≠ causation
A correlation of r = 1.0000 (extremely high positive linear correlation) does NOT mean X causes Y. Three possibilities: X causes Y, Y causes X, or a third variable (confounder) causes both. Ice cream sales and drowning deaths correlate r ≈ 0.8, but ice cream doesn't cause drowning — temperature is the confounder. To establish causation, you need a controlled experiment with random assignment.

About

The Pearson correlation coefficient (r) measures the strength and direction of the linear relationship between two quantitative variables. It ranges from −1 (perfect negative linear correlation) through 0 (no linear correlation) to +1 (perfect positive linear correlation). The formula is r = Σ((xᵢ − x̄)(yᵢ − ȳ)) / √(Σ(xᵢ − x̄)² × Σ(yᵢ − ȳ)²), where x̄ and ȳ are the sample means. The result is always between −1 and +1 by the Cauchy-Schwarz inequality.

A positive r means that as X increases, Y tends to increase (height and weight in adults, r ≈ 0.7–0.8). A negative r means that as X increases, Y tends to decrease (age and running speed, r ≈ −0.5). An r near 0 means no linear relationship — but be careful, that doesn't mean no relationship at all. A perfect quadratic relationship like y = x² has r = 0, even though X and Y are perfectly predictable from each other. Always plot your data before computing r — Anscombe's quartet shows four datasets with identical r = 0.816 but very different shapes.

The coefficient of determination R² = r² measures the fraction of variance in Y explained by the linear relationship with X. For r = 0.8, R² = 0.64 — 64% of the variance in Y is explained by X (and 36% is unexplained, due to other factors or noise). R² is always non-negative, even when r is negative — it captures the strength of the relationship but not the direction. Both are useful: r for direction and strength, R² for explanatory power. In simple linear regression, R² is exactly r².

Pearson r assumes a linear relationship, no significant outliers, approximately normal distributions (for hypothesis testing), continuous variables, and independent observations. If these assumptions are violated, consider alternatives: Spearman's rank correlation (ρ, for monotonic non-linear relationships or ordinal data), Kendall's tau (τ, for small samples with ties), or non-parametric regression. Always interpret r as descriptive, not causal — to establish causation, you need a controlled experiment with random assignment, a plausible mechanism, and reproducibility.

Sample size matters enormously. With n = 5 and r = 0.7, the 95% confidence interval is roughly [−0.05, 0.96] (very wide). As a rule, n = 30 is the bare minimum for any meaningful correlation claim, n = 100+ for publication. The standard error of r is approximately (1 − r²) / √(n − 2), so larger n gives more precise estimates. Always report n alongside r, and compute the confidence interval, not just the point estimate. A high r with a small n is statistically fragile; a moderate r with a large n is much more convincing.

How to Use

  1. 1
    Enter the X data
    Type your X data values in the X data input, separated by commas, spaces, or semicolons. Example: 1, 2, 3, 4, 5. You need at least 2 values, but realistically 10+ for meaningful results.
  2. 2
    Enter the Y data
    Type your Y data values in the Y data input. The number of Y values must match the number of X values. Example: 2, 4, 5, 4, 5 — five Y values matching five X values.
  3. 3
    Read the correlation coefficient r
    The hero block shows the Pearson correlation coefficient r, ranging from −1 (perfect negative) through 0 (no linear) to +1 (perfect positive). The calculator auto-updates as you type.
  4. 4
    Check R² and the interpretation
    Below the hero, R² shows the fraction of variance in Y explained by the linear model. The interpretation row labels the correlation as negligible / small / moderate / high / very high / extremely high, with direction (positive or negative).
  5. 5
    Review the statistics breakdown
    The breakdown shows n (sample size), mean of X, mean of Y, standard deviations, and the intermediate sums used in the formula. Verify these match your data before publishing any correlation claim.
  6. 6
    Reset and try another dataset
    Click Reset to restore the default sample (heights and weights of 6 adults). Switch to your own data — but remember to scatter-plot it first to verify the relationship looks linear before trusting r.

Formula

Pearson correlation coefficient:

r = Σ((xᵢ − x̄)(yᵢ − ȳ)) / √(Σ(xᵢ − x̄)² × Σ(yᵢ − ȳ)²)

Computational form (avoids computing means first):

r = (n × Σxy − Σx × Σy) / √((n × Σx² − (Σx)²) × (n × Σy² − (Σy)²))

Covariance and standard deviations form:

r = cov(X, Y) / (s_x × s_y)

Where:

  • cov(X, Y) = Σ(xᵢ − x̄)(yᵢ − ȳ) / (n − 1) — sample covariance
  • s_x = √(Σ(xᵢ − x̄)² / (n − 1)) — sample std dev of X
  • s_y = √(Σ(yᵢ − ȳ)² / (n − 1)) — sample std dev of Y
  • x̄ = Σx / n — sample mean of X
  • ȳ = Σy / n — sample mean of Y

Coefficient of determination:

R² = r² (fraction of variance explained)

Range and properties:

  • −1 ≤ r ≤ +1 (Cauchy-Schwarz inequality)
  • r = +1: perfect positive linear correlation
  • r = −1: perfect negative linear correlation
  • r = 0: no linear correlation (but may be related non-linearly)
  • r(X, Y) = r(Y, X) — symmetric
  • r is invariant under linear rescaling: r(aX+b, cY+d) = r(X,Y)

Worked Example

Example — Heights (X, cm) and weights (Y, kg) of 6 adults. Find r.

  • X = [170, 175, 180, 165, 185, 178] cm
  • Y = [70, 75, 80, 65, 85, 78] kg
  • n = 6
  • x̄ = 1053 / 6 = 175.5 cm; ȳ = 453 / 6 = 75.5 kg
  • Note: Y = X − 100, so r should be +1.0 (perfect positive linear)
  • (xᵢ − x̄) = [−5.5, −0.5, 4.5, −10.5, 9.5, 2.5]
  • (yᵢ − ȳ) = [−5.5, −0.5, 4.5, −10.5, 9.5, 2.5] (identical to X)
  • Σ(xᵢ − x̄)(yᵢ − ȳ) = 30.25 + 0.25 + 20.25 + 110.25 + 90.25 + 6.25 = 257.5
  • Σ(xᵢ − x̄)² = 257.5; Σ(yᵢ − ȳ)² = 257.5
  • r = 257.5 / √(257.5 × 257.5) = 257.5 / 257.5 = 1.0000 ✓
  • R² = 1.0000 — 100% of variance in Y explained by X
  • Interpretation: extremely high positive linear correlation

Tips

  • Always plot your data before computing r — Anscombe's quartet shows four datasets with identical r = 0.816 but completely different shapes (linear, curved, outlier-driven, vertical).
  • Sample size matters: small samples give unstable r. With n = 5 and r = 0.7, the 95% confidence interval is roughly [−0.05, 0.96]. Aim for n ≥ 30 for any meaningful correlation claim, n ≥ 100 for publication.
  • Outliers inflate or deflate r dramatically. A single outlier can move r from 0.0 to 0.8 or vice versa. Use robust correlation (Spearman, Kendall) or remove outliers with documented justification.
  • r only captures linear correlation. For monotonic non-linear relationships (e.g., y = √x), use Spearman's ρ. For non-monotonic (e.g., y = x²), no correlation coefficient works — use regression with a polynomial or non-linear model.
  • Correlation does NOT imply causation. Ice cream sales and drowning deaths correlate r ≈ 0.8, but ice cream doesn't cause drowning — temperature is the confounder. To establish causation, you need a controlled experiment with random assignment.

Common Mistakes

Common mistakes
  • Confusing correlation with causation — a high r only means X and Y move together; it doesn't mean one causes the other. Confounders are everywhere.
  • Computing r without plotting the data first — Anscombe's quartet shows four datasets with identical r = 0.816 but completely different shapes (linear, curved, outlier-driven, vertical).
  • Ignoring outliers — a single outlier can move r from 0.0 to 0.8 or vice versa. Always plot and consider robust alternatives (Spearman, Kendall) if outliers are present.
  • Assuming r = 0 means no relationship — it only means no linear relationship. A perfect quadratic (y = x²) has r = 0 even though X and Y are perfectly predictable.
  • Trusting r from a small sample — n = 5 with r = 0.7 is statistically fragile (95% CI: roughly [−0.05, 0.96]). Aim for n ≥ 30 for any meaningful claim.

Frequently Asked Questions

What is the Pearson correlation coefficient (r)?
The Pearson correlation coefficient (r) measures the strength and direction of the linear relationship between two quantitative variables. It ranges from −1 (perfect negative linear correlation) through 0 (no linear correlation) to +1 (perfect positive linear correlation). The formula is r = Σ((xᵢ − x̄)(yᵢ − ȳ)) / √(Σ(xᵢ − x̄)² × Σ(yᵢ − ȳ)²), where x̄ and ȳ are the sample means. A positive r means as x increases, y tends to increase; a negative r means as x increases, y tends to decrease; r near 0 means no linear relationship. Crucially, r only captures linear correlation — a perfect quadratic relationship like y = x² has r = 0.
How do I interpret the value of r?
Common interpretation rules of thumb: |r| < 0.1 → negligible, 0.1–0.3 → small, 0.3–0.5 → moderate, 0.5–0.7 → high, 0.7–0.9 → very high, > 0.9 → extremely high. The sign of r indicates direction: positive = same direction, negative = opposite direction. So r = 0.85 is a very high positive correlation (height and weight in adults); r = −0.45 is a moderate negative correlation (gas price and miles driven); r = 0.05 is essentially no linear correlation. R² (the coefficient of determination, r²) tells you the fraction of variance in y explained by the linear model: r = 0.7 gives R² = 0.49 (49% of variance explained).
What is the difference between r and R²?
r is the Pearson correlation coefficient, a number between −1 and +1 indicating the strength and direction of linear correlation. R² (the coefficient of determination) is r squared, a number between 0 and 1 indicating the fraction of variance in y explained by the linear model. R² = r² because in simple linear regression, the correlation coefficient squared equals R². For r = 0.8, R² = 0.64 — meaning 64% of the variance in y is explained by the linear relationship with x. R² is always non-negative, even when r is negative — it captures the strength of the relationship but not the direction. Both are useful: r for direction and strength, R² for explanatory power.
Why does correlation not imply causation?
A high correlation between x and y does not mean x causes y. There are three possibilities: (1) x causes y, (2) y causes x, or (3) some third variable (a confounder) causes both. Ice cream sales and drowning deaths are highly correlated — but ice cream doesn't cause drowning; both increase in summer (temperature is the confounder). Spurious correlations are common in large datasets. To establish causation, you need a controlled experiment (random assignment), a plausible mechanism, and reproducibility. Observational studies can show correlation, but only experiments can show causation. Always interpret correlation as descriptive, not causal, unless you have a strong theoretical basis and experimental evidence.
What are the assumptions for Pearson correlation?
Pearson r assumes: (1) both variables are continuous (interval or ratio), (2) the relationship is linear (verify with a scatter plot — curved relationships give misleading r), (3) no significant outliers (outliers can inflate or deflate r dramatically), (4) the variables are approximately normally distributed (for hypothesis testing on r), and (5) the observations are independent. If any of these are violated, consider alternatives: Spearman's rank correlation (ρ, for monotonic non-linear relationships or ordinal data), Kendall's tau (τ, for small samples with ties), or non-parametric regression. Always plot your data before computing r — Anscombe's quartet shows four datasets with identical r = 0.82 but very different shapes.
How many data points do I need for a meaningful correlation?
Technically, you need at least 3 points to compute r (with 2 points, r is always ±1 trivially). But for a statistically meaningful correlation, you need many more — at least 10–15 for a rough estimate, 30+ for confidence, and 100+ for high confidence. With small samples, r is highly variable: a sample of n = 5 with r = 0.7 has a 95% confidence interval of about −0.05 to 0.96 (very wide). The standard error of r is approximately (1 − r²) / √(n − 2), so larger n gives more precise estimates. As a rule, n = 30 is the bare minimum for any meaningful claim about correlation; n = 100+ is preferred for publication.

Pearson r formula

The Pearson correlation coefficient r = Σ((xᵢ − x̄)(yᵢ − ȳ)) / √(Σ(xᵢ − x̄)² × Σ(yᵢ − ȳ)²). The numerator is the covariance of X and Y (unnormalized by n); the denominator is the product of the standard deviations (also unnormalized — the n's cancel). The formula can also be written as r = cov(X, Y) / (σ_X × σ_Y), where cov is the covariance and σ is the standard deviation. The result is always between −1 and +1 by the Cauchy-Schwarz inequality. The formula is symmetric: r(X, Y) = r(Y, X).

r, R², and variance explained

The coefficient of determination R² = r² is the fraction of variance in Y explained by the linear relationship with X. For r = 0.8, R² = 0.64 — 64% of the variance in Y is explained by X (and 36% is unexplained, due to other factors or noise). R² is always between 0 and 1, even when r is negative. R² is what statisticians use to compare model fits; r is what's reported in correlation studies because it preserves the sign (direction). In simple linear regression (one X), R² is exactly r²; in multiple regression, R² can exceed r² due to multiple predictors combining.

Interpreting r values

Common interpretation guidelines: |r| < 0.1 = negligible; 0.1–0.3 = small; 0.3–0.5 = moderate; 0.5–0.7 = high; 0.7–0.9 = very high; > 0.9 = extremely high. Sign indicates direction: positive = same direction (height and weight), negative = opposite direction (age and running speed). Real-world reference points: smoking and lung cancer r ≈ 0.7 (very high); height and weight in adults r ≈ 0.7–0.8; SAT score and college GPA r ≈ 0.4–0.5; daily temperature and ice cream sales r ≈ 0.5–0.7. A high r doesn't mean causation — it just means the variables move together linearly.

Anscombe&apos;s quartet warning

Anscombe's quartet (1973) is a famous statistics teaching example: four datasets of 11 points each, all with identical r = 0.816 and identical means and standard deviations, but completely different shapes. One is a clean linear pattern; one is curved (a parabola); one has a single outlier that creates the apparent correlation; one has a vertical column of points with one outlier. The lesson: ALWAYS plot your data before computing r. A high r might be hiding a non-linear pattern, an outlier, or a clustered structure. Modern extensions like the Datasaurus Dozen show even more dramatic cases where r is identical but the data looks completely different.

Interpretation guidelines for Pearson r, with R² and real-world reference values.
r valueStrengthR²Variance explainedReal-world example
1.00Perfect positive1.0000100%Height vs same height
0.80Very high positive0.640064%Height vs weight (adults)
0.50High positive0.250025%SAT vs first-year GPA
0.30Moderate positive0.09009%Hours of sleep vs GPA
0.00No linear correlation0.00000%Shoe size vs IQ
−0.30Moderate negative0.09009%Age vs running speed
−0.50High negative0.250025%Miles driven vs gas price
−0.80Very high negative0.640064%Smoking vs life expectancy
−1.00Perfect negative1.0000100%Temp (°C) vs temp (°F inverted)
Use r alongside scatter plots and regression
Always plot your data before computing r — Anscombe's quartet proves that identical r values can hide wildly different patterns. Use r alongside a scatter plot, a regression line, and the residual plot. For non-linear or ordinal data, consider Spearman's ρ or Kendall's τ. For multiple predictors, use multiple regression and adjusted R². And always remember: correlation is descriptive; causation requires experimental design with random assignment.

Authoritative References

  • Wikipedia — Pearson correlation coefficient— Wikipedia
    Comprehensive article on the Pearson r, including formula derivation, properties, hypothesis testing, and relations to other correlation measures (Spearman, Kendall).
  • Khan Academy — Correlation— Khan Academy
    Free video lessons on correlation, scatter plots, the correlation coefficient, and the difference between correlation and causation.
  • NIST/SEMATECH — e-Handbook of Statistics— NIST
    NIST engineering statistics handbook covering correlation, regression, and the proper interpretation of correlation coefficients in scientific work.
  • Anscombe&apos;s quartet — Wikipedia— Wikipedia
    The famous teaching example of four datasets with identical r = 0.816 but very different shapes — illustrating why you must plot your data.

Try our other free calculators

CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.

Calculate Correlation Coefficient — Accurate Results & Step