Home / Statistics & Probability / Descriptive Statistics / Pearson Correlation Coefficient

Formula & Calculator

Pearson Correlation Coefficient

The Pearson correlation coefficient (r) measures the strength and direction of a linear relationship between two variables. It ranges from −1 (perfect negative relationship) through 0 (no linear relationship) to +1 (perfect positive relationship). For example, hours studied and exam scores typically have a positive correlation. Correlation does not imply causation: just because two things move together does not mean one causes the other. It is one of the most widely used statistics in science and business.

Statistics Descriptive Statistics Relationships
VORZEP · STATISTICS & CORRELATION TOOLS

Pearson Correlation Coefficient Calculator

Compute Pearson's r using r = Cov / (σX · σY). Solve for r, covariance, or either standard deviation. Includes step-by-step math, a live scatter plot schematic with the best-fit line, and companion metrics including R², significance test, confidence interval, and strength interpretation.

r = Cov / ( σX · σY )
Solve for
Covariance (Cov) The covariance between X and Y, Cov(X, Y) = Σ(xᵢ−x̄)(yᵢ−ȳ) / n. Measures how X and Y vary together, but depends on the units of X and Y. Can be positive (variables move together), negative (opposite directions), or zero (no linear association). Typical: −10,000 to +10,000 depending on units and sample size.
Cov
Covariance must be a valid number.
Cov = 40.00 · Positive → positive association
Std. Dev. of X (σX) The standard deviation of the X variable. Must be greater than zero — otherwise correlation is undefined. The product σX · σY is the maximum possible value of |Cov|; dividing by it produces a unit-free number between −1 and +1. Typical: 0.1 to 1,000 depending on the variable being measured.
σX
Std dev of X must be greater than zero.
σX = 20.00 · σX² = 400.00
Std. Dev. of Y (σY) The standard deviation of the Y variable. Must be greater than zero. Together with σX, forms the normalizing denominator of Pearson's r. This normalization is what makes r scale-free — changing the units of X or Y does not change r, only Cov changes. Typical: 0.1 to 1,000 depending on the variable being measured.
σY
Std dev of Y must be greater than zero.
σY = 20.00 · σY² = 400.00
PEARSON CORRELATION (r)
0.100
r = 40 / (20 × 20) = 0.100
WEAK POSITIVE CORRELATION
r = Cov / ( σX · σY )
Step-by-step solution
Correlation vs. covariance
r(Cov) at fixed σX, σY Current point
Scatter plot at current r
Data points Best-fit line Mean point
Sensitivity
Companion correlation metrics
Correlation strength schematic — live
PEARSON CORRELATION · r = Cov / (σX · σY) r = −1 r = −0.5 r = 0 r = +1 CURRENT CORRELATION r = Cov / (σX · σY) = 40 / (20 × 20) = 0.100
Perfect positive (r = +1) Moderate correlation Perfect negative (r = −1) Current best-fit line
What Pearson's correlation coefficient really measures
rcorrelation
=
Covcovariance
÷
σX · σYstd devs product

r is normalized covariance

Pearson's r is simply the covariance rescaled by the product of the two standard deviations. This normalization makes r a unit-free quantity bounded between −1 and +1. By Cauchy-Schwarz, |Cov| ≤ σX · σY always, so |r| ≤ 1. When |r| = 1, the two variables have a perfect linear relationship — every point lies exactly on a straight line. When r = 0, there is no linear association. Values in between describe degrees of linear strength.

r is scale-invariant

Changing the units of X or Y does not change Pearson's r. If you multiply every x by 100 (converting meters to centimeters, say), both Cov and σX get multiplied by 100, but their ratio stays the same. This makes r ideal for comparing strengths of linear relationships across datasets with different units or scales — unlike covariance, whose magnitude is only meaningful within its original context. This invariance is why correlation is the preferred measure of linear association in practice.

r equals slope of standardized regression

If you standardize both X and Y (subtract the mean, divide by the standard deviation), then the OLS regression slope of standardized Y on standardized X equals r. This is why r is often called the "standardized slope." The unstandardized slope is b = r · (σY / σX), and R² = r² tells you the fraction of variance in Y explained by X. These relationships make r fundamental to regression analysis — the same number answers "how correlated?" and "how much does Y change per unit change in X (after standardization)?"

r measures only linear association

Pearson's r captures only the linear component of a relationship. If X and Y follow a perfect U-shape (Y = X²), r could be near zero even though Y is completely determined by X. Similarly, r is sensitive to outliers — a single extreme point can push r from 0.1 to 0.9 or vice versa. And r says nothing about causation: a high |r| between two variables means they covary linearly, not that one causes the other. Always inspect a scatter plot before trusting r, and use Spearman's ρ or Kendall's τ when the relationship may be monotonic but nonlinear.

How to Use This Calculator

Pearson's correlation formula links covariance and the two standard deviations. Pick what you want to compute, and the calculator solves for the remaining quantity.

1. Choose what to solve for

Pick r, Cov, or σX from the toggle. The calculator rearranges r = Cov / (σX · σY) for whichever variable you choose.

2. Use realistic presets

Presets cover covariance from −50 to 100 and standard deviations from 1 to 100. The default (Cov = 40, σX = 20, σY = 20) gives r = 0.10, a weak positive correlation.

3. Match units consistently

Cov has units of X·Y, σX has units of X, σY has units of Y. The units cancel in the ratio, producing a dimensionless r. No unit conversion is needed as long as the values are internally consistent.

4. Read the result and verdict

The result card shows r with a sign and magnitude. A colour-coded verdict classifies strength from negligible (|r| below 0.1) through weak, moderate, strong, and very strong, in either direction.

5. Check the schematic and chart

The schematic shows four reference scatter plots (−1, −0.5, 0, +1) plus a live scatter of the current correlation. The chart plots r vs. Cov at fixed standard deviations.

6. Switch to Advanced for depth

Advanced mode adds a detailed scatter plot with the current best-fit line, a sensitivity check, and companion metrics including R², the OLS slope, the t-statistic for significance, and the 95% confidence interval.

What This Tool Offers

Built around the standard Pearson correlation formula r = Cov / (σX · σY), the most widely used measure of linear association between two variables.

Three-way solving

Solve for correlation, covariance, or standard deviation of X. The calculator rearranges the formula for whichever variable you choose.

Reference scatter panels

Four reference scatter plots showing perfect negative, moderate negative, no correlation, and perfect positive, plus a live panel with the current best-fit line.

Correlation verdict

Each result is classified from negligible (|r| below 0.1) through weak, moderate, strong, and very strong, with direction (positive/negative).

Companion correlation metrics

Coefficient of determination R², OLS regression slope, t-statistic for significance, degrees of freedom, and the 95% confidence interval.

Dual comparison charts

Correlation vs. covariance at fixed standard deviations, plus an advanced live scatter plot with the current best-fit line.

Reference tables

Correlation strength thresholds, comparison with Spearman and Kendall, and typical correlations by field.

Reference Tables & Conversions

Correlation strength thresholds, comparison with related coefficients, and typical values by field.

Correlation strength thresholds

|r|
note
|r|
note
|r|
note
|r|
note
|r|
note
|r|
note
r ranges from −1 (perfect negative) to +1 (perfect positive) · R² = r² gives fraction of variance explained · These thresholds are guidelines, not rigid rules

Comparison of Correlation Coefficients

Pearson's r is one of several correlation measures. Different coefficients suit different data characteristics.

CoefficientSymbolMeasuresRangeBest for
PearsonrLinear association−1 to +1Continuous, roughly linear data
SpearmanρsMonotonic association (ranks)−1 to +1Ordinal data, nonlinear monotonic
KendallτConcordance of pairs−1 to +1Small samples, many ties
Point-biserialrpbContinuous vs. binary−1 to +1One dichotomous variable
Phi coefficientφAssociation between two binaries−1 to +12×2 contingency tables
Cramér's VVAssociation (any categories)0 to 1Larger contingency tables

Typical Pearson Correlations by Field

Representative strengths of linear association in various domains. Effect sizes vary widely — always interpret in context.

RelationshipTypical rStrengthNotes

Variable Reference

SymbolMeaningTypical rangeNotes
rPearson correlation coefficient−1 to +1Dimensionless, scale-invariant
CovCovarianceAny realDepends on units of X and Y
σXStandard deviation of X> 0Same units as X
σYStandard deviation of Y> 0Same units as Y
R²Coefficient of determination0 to 1r², fraction of variance explained
nSample size≥ 3Needed for inference (t-test, CI)
tTest statistic for rany realt = r√(n−2) / √(1−r²)

What Does r = Cov / (σX · σY) Measure?

Pearson's correlation coefficient r measures the strength and direction of the linear relationship between two continuous variables. By normalizing covariance by the product of the two standard deviations, r produces a unit-free measure bounded between −1 and +1 — a value of +1 means the two variables lie exactly on an upward-sloping line, −1 means an exactly downward-sloping line, and 0 means no linear association. Because of its scale invariance and interpretability, r is the most widely reported measure of linear association across the physical, biological, and social sciences.

Pearson Correlation Formula

The defining relationship is:

r = Cov(X, Y) / (σX · σY)

Expanded in terms of raw data:

r = Σ(xᵢ−x̄)(yᵢ−ȳ) / √[ Σ(xᵢ−x̄)² · Σ(yᵢ−ȳ)² ]

Rearranged to solve for the other two quantities:

Cov = r · σX · σY
σX = Cov / (r · σY)

The coefficient of determination is r squared:

R² = r²

For inference about r, the test statistic is:

t = r · √(n − 2) / √(1 − r²)   (df = n − 2)

Pearson Correlation Variables

SymbolMeaningNotes
rPearson correlation coefficientUnit-free; ranges from −1 to +1
CovCovariance between X and YDepends on units of X and Y
σXStandard deviation of XMust be > 0
σYStandard deviation of YMust be > 0
R²Coefficient of determinationFraction of Y's variance explained by X
nSample sizeUsed for significance testing

How Each Variable Affects Correlation

Pearson's r increases linearly with covariance and decreases inversely with each standard deviation. Doubling the covariance doubles r (as long as |r| ≤ 1); doubling σX or σY halves r. This ratio relationship is what makes r scale-invariant: if you change the units of X (multiplying both Cov and σX by the same factor), the ratio stays the same. This is why you can compare the strength of a relationship between income and happiness with the strength of a relationship between height and weight, even though the units are completely different.

The value of r is bounded by Cauchy-Schwarz: |Cov| ≤ σX · σY, so |r| ≤ 1 always. Equality occurs only when one variable is a perfect linear function of the other (Y = a + bX for some constants a and b). The sign of r matches the sign of the slope b: positive r means Y tends to increase with X, negative r means Y tends to decrease with X. Values near zero indicate weak or no linear association — but as noted above, r = 0 does not rule out a strong nonlinear relationship.

Pearson Correlation Calculation Examples

Given: Cov = 40, σX = 20, σY = 20 — solve for r
r = 40 / (20 × 20) = 40 / 400 = 0.10 (weak positive)
Given: r = 0.75, σX = 10, σY = 5 — solve for Cov
Cov = 0.75 × 10 × 5 = 37.5
Given: r = 0.60, Cov = 90, σY = 15 — solve for σX
σX = 90 / (0.60 × 15) = 90 / 9 = 10
Given: r = 0.80, n = 30 — solve for t-statistic
t = 0.80 × √(30 − 2) / √(1 − 0.64) = 0.80 × √28 / √0.36
t = 0.80 × 5.29 / 0.60 = 7.05 (df = 28)
Highly significant (p < 0.001)

Frequently Asked Questions

Covariance measures how two variables vary together, but its magnitude depends on the units of both variables. Change X from meters to centimeters and covariance increases by 100×, with no change in the actual relationship. Pearson's correlation r normalizes covariance by the product of the two standard deviations: r = Cov / (σX · σY). This produces a unit-free number between −1 and +1 whose magnitude has a consistent interpretation: ±1 is perfect linear association, 0 is no linear association. When you want to compare the strength of a linear relationship across different datasets or variables, use correlation. When you need to preserve scale for downstream calculations (like regression slopes or portfolio variance), covariance is the right tool.

r = 0 means there is no linear association between the two variables — knowing X tells you nothing about Y in a linear sense. However, r = 0 does not mean the variables are unrelated. They could have a strong nonlinear relationship (e.g., Y = X² gives r = 0 for symmetric X) or a non-monotonic relationship (e.g., a U-shape). Always plot the data before concluding the variables are independent. Additionally, r = 0 does not mean the variables are statistically independent — independence is stronger than zero correlation. Two variables can be dependent with r = 0, but if they are independent, r must be 0.

It depends entirely on context. In physics, correlations above 0.99 are common for well-controlled measurements. In psychology and social science, correlations of 0.3–0.5 are considered meaningful; 0.5–0.7 is strong. In medicine, even 0.2 between a biomarker and disease risk can be clinically important at population scale. In finance, correlations between 0.3 and 0.7 between asset returns are typical. A useful guideline (Cohen's conventions): |r| < 0.1 negligible, 0.1–0.3 weak, 0.3–0.5 moderate, 0.5–0.7 strong, > 0.7 very strong. But these thresholds are conventions, not laws — always interpret r alongside the scatter plot, sample size, and domain knowledge.

No. Correlation measures statistical association, not causal effect. A high |r| between X and Y could mean X causes Y, Y causes X, or a third variable Z causes both. Classic example: ice cream sales and drowning deaths are positively correlated because both are driven by warm weather — but ice cream doesn't cause drowning. Establishing causation requires experimental design (randomized controlled trials), instrumental variables, natural experiments, or other causal-inference methods. Pearson's r alone is a descriptive statistic, not evidence of causation. The famous phrase "correlation does not imply causation" is one of the most important caveats in all of statistics.

Small sample sizes produce unstable r estimates with wide confidence intervals. A correlation of 0.30 based on n = 5 is not significantly different from zero, whereas the same r = 0.30 with n = 100 is highly significant (p < 0.01). The t-statistic for testing r = 0 is t = r·√(n−2)/√(1−r²), with df = n − 2. For r = 0.30 and n = 5, t = 0.55 (p ≈ 0.62). For r = 0.30 and n = 100, t = 3.08 (p ≈ 0.003). Always report both r and n (or the confidence interval), never r alone. A very high r from a tiny sample should not be treated as reliable evidence of a strong association.

Spearman's ρ (rho) is a rank-based correlation that measures monotonic association — whether Y tends to increase as X increases (not necessarily linearly). Use Spearman's ρ when: (1) the relationship is monotonic but nonlinear (e.g., logarithmic); (2) the data are ordinal (ranks, categories with order); (3) the data contain outliers that could distort Pearson's r; (4) the distributions are heavily skewed; (5) both variables are continuous but you want a robust measure. For roughly linear relationships with no strong outliers, Pearson's r and Spearman's ρ give similar answers. When they disagree substantially, it usually means the relationship is monotonic but nonlinear, and Spearman's ρ is more appropriate.

R² (the coefficient of determination) is simply r squared. It represents the fraction of variance in Y that is explained by the linear relationship with X. For example, r = 0.80 gives R² = 0.64, meaning 64% of the variance in Y is explained by X, and 36% is unexplained. Note that R² is always between 0 and 1 (because r² is), so it loses the sign information — a strong negative correlation and a strong positive correlation give the same R². When interpreting, remember that "explained variance" is a statistical decomposition, not a causal claim. Even a high R² can arise from confounding, and low R² does not necessarily mean a weak relationship if the relationship is nonlinear.

Calculating...

Variables

Symbol Quantity Unit
r Pearson correlation coefficient
Cov(X,Y) Covariance of X and Y
σX Standard deviation of X
σY Standard deviation of Y

What it means

The Pearson correlation coefficient (r) is a standardised measure of the strength and direction of the linear relationship between two variables. It ranges from −1 (perfect negative linear) to +1 (perfect positive linear), with 0 indicating no linear correlation. It is the covariance divided by the product of the standard deviations. Correlation is widely used in data analysis, in finance (diversification), in medicine (association between risk factors), and in psychology. However, correlation does not imply causation. It is also sensitive to outliers. Understanding r is crucial for interpreting scatterplots and for building regression models. The square of r, R², represents the proportion of variance explained.

Worked example

Pearson Correlation – Two Examples

Real‑World
Scenario: Cov(X,Y)=15, σX=5, σY=4. Compute r.
ParameterValue
Cov15
σX5
σY4
1r = 15 / (5×4) = 15/20 = 0.75
Result 0.75 ✓ Strong positive correlation
Scenario: Cov=−10, σX=3, σY=4. Find r.
ParameterValue
Cov-10
σX3
σY4
1r = −10 / (3×4) = −10/12 = −0.8333
Result -0.8333 ✓ Strong negative correlation
Insight: Correlation coefficient r is unit‑less and ranges from −1 to +1. It measures strength and direction of linear relationship.

Common mistakes

  • Correlation coefficient r: Measures the strength and direction of a linear relationship.
  • Range: r is between −1 and +1 inclusive.
  • Units: r is dimensionless.
  • Causation: Correlation does not imply causation.
  • Outliers: Outliers can greatly affect the correlation coefficient.

Applications

The Pearson correlation coefficient (r) measures the strength and direction of a linear relationship between two variables, ranging from −1 to +1. It is one of the most used statistics in all disciplines. Engineers use it to validate simulation models, to assess relationships between input and output variables, and to design experiments. In finance, it diversifies portfolios. In medicine, it correlates risk factors with outcomes. By calculating r, professionals can quantify the degree of association, test hypotheses about relationships, and identify redundant predictors. The correlation coefficient is scale‑independent, making it interpretable across different units. It is a cornerstone of exploratory data analysis and predictive modelling.

  • Exploratory data analysis – identifying variable relationships
  • Model validation – comparing simulated and measured data
  • Finance – diversification and asset correlation
  • Medical research – linking risk factors to diseases
  • Quality control – process input‑output correlation