Correlation Coefficient Calculator

Calculate the Pearson correlation coefficient for two equal-length numeric datasets.

← Math Tools

Calculate the Pearson correlation coefficient for two equal-length numeric datasets.

Result: Enter matching X and Y values.

How to calculate Pearson correlation

  1. Enter observations for one variable in X and the matching observations in Y. The first X value pairs with the first Y value; keep the original order.
  2. Separate values with spaces, new lines, commas or semicolons. Use a decimal point, not a decimal comma. Do not include thousands separators, column headers or empty comma-separated cells.
  3. Select Calculate Correlation. Check the number of pairs before interpreting the result.

Each list accepts up to 10,000 values and 100,000 characters. Scientific notation such as 1e3 is accepted. Missing observations are not automatically removed: clean both lists together so that pairs remain aligned.

Worked example

For X = 1, 2, 3, 4 and Y = 2, 4, 5, 8, the means are 2.5 and 4.75. The sum of paired deviation products is 9.5, and the two sums of squared deviations are 5 and 18.75. Therefore r = 9.5 / √(5 × 18.75) ≈ 0.981156. This describes a strong positive linear association in these four observations; it does not establish a cause or a reliable population estimate.

Formula and interpretation

r = Σ[(x − x̄)(y − ȳ)] / √[Σ(x − x̄)² × Σ(y − ȳ)²]. A positive result indicates that larger X values tend to accompany larger Y values; a negative result indicates the opposite direction. Values near zero describe little linear association, but a curved relationship may still exist. Interpret the size in the context of your data rather than applying a universal cutoff.

The implementation rescales and centers each list before calculating the normalized dot product to reduce overflow with very large numbers. Browser floating-point precision still applies; differences smaller than the representable precision cannot be recovered.

Common questions

Why is the result undefined for a constant list?

A constant variable has no spread, making the denominator zero. The calculator reports this instead of displaying a misleading coefficient.

Does a high correlation prove causation or significance?

No. Confounding factors, outliers and small samples can produce a large coefficient. With only two nonconstant pairs, r is always +1 or −1. This tool does not calculate a p-value, confidence interval, Spearman rank correlation or regression model.

What should I check before using r?

Plot the paired observations to look for outliers and curves. Confirm that each pair refers to the same observation and that missing values have not shifted either list. Changing a variable from meters to centimeters does not change r; independently sorting a list can change the pairing and invalidate the result.

Explore related calculations in Math Tools. Formula reference: NIST correlation documentation.

Method

This tool calculates Pearson’s r using deviations from each dataset mean. Values can be separated by commas, spaces or line breaks.

Statistical limitation

Correlation measures linear association, not causation. Outliers, nonlinear relationships and small samples can make r misleading.

Related tools