Skip to content
TheCalcUniverse

Correlation Calculator — Pearson Correlation Coefficient r

Calculate the Pearson correlation coefficient between two variables. Shows r, r², strength, and direction with step-by-step work.

✓ Tested formula & cited sources Formula verified 2026-01-15 Runs in your browser — inputs never sent anywhere

See it worked out

Example — X Values 1, 2, 3, 4, 5, Y Values 2, 4, 5, 4, 5:

Pearson Correlation Coefficient (r)

0.7746

Coefficient of Determination (r²)

0.6

Strength

Strong

Direction

Positive

Mean of X

3

Mean of Y

4

Covariance

1.2

Sample Size (n)

5

Formula Applied

r = (5×66 − 15×20) / √((5×55 − 15²)(5×86 − 20²)) = 0.7746

The formula

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

n
Sample Size
∑xy
Sum of Cross-Products
∑x, ∑y
Sum of X and Sum of Y
∑x², ∑y²
Sum of Squares
r
Pearson Correlation Coefficient

Worked example — X Values 1, 2, 3, 4, 5, Y Values 2, 4, 5, 4, 5

Pearson Correlation Coefficient (r) = 0.7746

Full explanation ↓

How Correlation Works

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

Pearson's correlation coefficient r measures the strength and direction of a linear relationship between two continuous variables. The value of r always falls between −1 and +1, where r = +1 indicates a perfect positive linear relationship, r = −1 indicates a perfect negative linear relationship, and r = 0 indicates no linear relationship. The coefficient is scale-invariant, meaning it does not depend on the units of measurement used for either variable.

n
Sample SizeThe number of paired observations in the dataset. Must be at least 3 for a meaningful correlation calculation.
∑xy
Sum of Cross-ProductsThe sum of each x value multiplied by its corresponding y value. Represents the joint variability between the two variables.
∑x, ∑y
Sum of X and Sum of YThe sums of all x values and all y values respectively. Used to compute means and in the covariance numerator.
∑x², ∑y²
Sum of SquaresThe sum of each x value squared and each y value squared. Used in the denominator to normalize the correlation coefficient.
r
Pearson Correlation CoefficientA standardized measure of linear correlation ranging from −1 (perfect negative) through 0 (no correlation) to +1 (perfect positive).
Scatter plot demonstrating a strong positive linear correlation (r ≈ 0.9)

How to Use

  1. Enter paired X and Y values in the two text areas, separating numbers by commas, semicolons, spaces, or line breaks.
  2. Each dataset must contain at least 3 values, and both datasets must have the same number of values.
  3. The calculator computes the Pearson correlation coefficient r, along with r², covariance, and the means of both variables.
  4. Read the strength (Very strong, Strong, Moderate, Weak, or Very weak) and direction (Positive or Negative) of the relationship.
  5. Use the formula breakdown to verify each step of the calculation for learning or teaching purposes.

Quick Reference

r = +1.0Perfect positive linear relationship
r = +0.7Strong positive correlation
r = 0.0No linear correlation
r = −0.7Strong negative correlation

Common Uses

  • Analyzing the relationship between study hours and exam scores in educational research
  • Measuring the correlation between advertising spend and sales revenue in marketing analytics
  • Evaluating the relationship between temperature and energy consumption in utility forecasting
  • Assessing test-retest reliability in psychological and medical measurements
  • Investigating correlations between economic indicators such as GDP growth and unemployment rates

Understanding the Result

The Pearson correlation coefficient, denoted as r, is the most widely used measure of linear association between two continuous variables. Developed by Karl Pearson in the late 19th century, it is computed as the covariance of the two variables divided by the product of their standard deviations. This normalization ensures that r is always between −1 and +1, regardless of the scales of the original variables. The square of r, called the coefficient of determination (r²), represents the proportion of variance in one variable that is predictable from the other variable. For example, an r of 0.8 means that 64% (0.8² = 0.64) of the variability in Y can be explained by X. It is crucial to note that correlation does not imply causation — a high correlation between two variables may be due to a confounding third variable, coincidence, or reverse causation. Additionally, Pearson r only captures linear relationships; variables with a strong nonlinear relationship (such as a U-shaped curve) may have an r close to zero even though they are clearly related. Always visualize your data with a scatter plot before interpreting correlation coefficients.

Frequently Asked Questions

What is the difference between correlation and causation?
Correlation measures the strength and direction of a statistical relationship between two variables, but it does not prove that one variable causes the other. A high correlation could be due to a hidden third variable (confounder), pure coincidence, or reverse causation. For example, ice cream sales and drowning incidents are highly correlated, but ice cream does not cause drowning — both are driven by hot weather (the confounder).
What does an r value of 0 mean?
An r value of 0 means there is no linear correlation between the two variables. However, the variables could still have a nonlinear relationship (e.g., a parabolic or sinusoidal pattern). Always examine a scatter plot alongside the correlation coefficient to detect nonlinear patterns.
How many data points do I need for a reliable correlation?
While the minimum is 3 data points, reliable correlation estimates typically require at least 10–30 paired observations. With very small samples, the correlation coefficient can be heavily influenced by individual data points (outliers). Statistical significance testing (p-value) should also be considered for small samples.
What is the difference between Pearson and Spearman correlation?
Pearson correlation measures linear relationships and requires continuous, normally distributed data. Spearman correlation is a rank-based measure that captures monotonic relationships (linear or nonlinear) and works with ordinal data or data that violates normality assumptions. Spearman is less sensitive to outliers than Pearson.
Can r be greater than 1 or less than −1?
No. The Pearson correlation coefficient is mathematically bounded between −1 and +1 inclusive. Values outside this range indicate a calculation error. If you compute r manually, double-check that the denominator (the product of standard deviations) is positive and correctly computed.
Was this calculator helpful?
Cite this calculator

TheCalcUniverse. "Correlation Calculator — Pearson Correlation Coefficient r." TheCalcUniverse, 2026, https://thecalcuniverse.com/math/correlation-calculator/. Accessed July 24, 2026.

Embed this calculator on your site

Free to embed. Paste this into any HTML page — it stays up to date automatically.

Open embed ↗

You may also like

Guides that use this calculator