Correlation Coefficient Calculator - Pearson r & Steps

Free Pearson correlation tool

Correlation Coefficient Calculator with Exact Steps

Calculate Pearson's correlation coefficient for matched X and Y values. Review exact r and R-squared, covariance, standard deviations, the Y-on-X regression line, a scatter plot and complete calculation steps.

Last Updated: July 27, 2026

Exact rational arithmetic Pearson r and R-squared Scatter plot and regression Private browser calculation

Online Pearson Correlation Calculator

Enter two matching numerical lists. The first X value pairs with the first Y value. Exact fraction arithmetic protects small variation beside large offsets until the displayed decimal is rounded.

Runs in your browser

Enter 2 to 200 X observations. Use commas, semicolons, tabs or new lines as separators.

Enter one Y value for every X value. Repeated or missing separators are rejected to protect pair alignment.

Precision changes displayed approximations only. Exact sums, fractions and checks remain unchanged.

Enter matching X and Y values, then calculate.

Pearson correlation coefficient

Your Pearson correlation result and calculation details will appear here.

Exact Pearson r
Decimal Pearson r
Direction and strength
Coefficient of determination (R-squared)
Sample covariance
Population covariance
Sample standard deviation of X
Sample standard deviation of Y
Y-on-X regression line
Paired observations

Exact summary values

Exact raw sums, means and centered sums
Statistic Exact value Meaning
Calculate a paired data set

Paired deviations and cross-products

Each observation pair and its centered contribution
Pair X Y X minus mean X Y minus mean Y Centered product
Calculate a paired data set

Centered values and cross-products will appear here.

Scatter plot and fitted line

Scatter plot awaiting paired data Enter matching X and Y values and calculate to draw the scatter plot.

The scatter plot will appear after a valid calculation.

Calculation steps

  1. Enter matching X and Y values, then select Calculate Correlation.

Recent calculations

  • Your last six results will appear here.

How to Use This Correlation Coefficient Calculator

  1. Enter the X observations in the first box.
  2. Enter the matching Y observations in the second box. Keep every pair in the same position.
  3. Separate values with commas, semicolons, tabs or new lines. Do not leave an empty entry between separators.
  4. Select the number of decimal places for approximate results.
  5. Select Calculate Correlation. Review Pearson r, R-squared, covariance, standard deviations, regression, the scatter plot and exact steps.

The page accepts from 2 through 200 pairs. A comma separates observations, so enter 1200 rather than 1,200. Blank lines and repeated separators are rejected instead of ignored. This prevents a missing X or Y entry from shifting every later pair.

What Is Pearson's Correlation Coefficient?

Pearson's product-moment correlation coefficient, written as r, measures the direction and strength of a linear relationship between two numerical variables. Its range is -1 through 1. Positive values indicate that larger X values tend to occur with larger Y values. Negative values indicate that larger X values tend to occur with smaller Y values.

A coefficient near either endpoint indicates that the points follow a straight-line pattern closely. A coefficient near zero indicates little linear association. It does not rule out a strong curved pattern. Pearson r is unitless, symmetric between X and Y, and unchanged when you translate a variable or multiply it by a positive scale factor.

Pearson Correlation Formula

The centered form makes the calculation easy to interpret. Subtract each variable's mean, multiply the paired deviations, and compare their cross-product total with the variation inside X and Y.

Sxx = Σ(x - x̄)²
Syy = Σ(y - ȳ)²
Sxy = Σ[(x - x̄)(y - ȳ)]

r = Sxy ÷ √(Sxx × Syy)

The denominator is positive only when both variables vary. The ratio is bounded from -1 through 1 by the Cauchy-Schwarz inequality. This calculator verifies that bound exactly before displaying a result.

Worked Correlation Example

Use X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5. Their means are 3 and 4. The exact centered sums are Sxx = 10, Syy = 6 and Sxy = 6.

r = 6 ÷ √(10 × 6)
r² = 36 ÷ 60 = 3/5
r = √(3/5) ≈ 0.7746

The result is a strong positive linear correlation under the descriptive guide used on this page. The fitted Y-on-X line has slope 3/5 and intercept 11/5, so y = (3/5)x + 11/5. The points do not fall exactly on that line, which is why r is below 1.

How to Interpret Direction and Strength

Direction comes from the sign. Magnitude comes from the absolute value. There is no universal set of strength labels across every field. This calculator uses a transparent descriptive guide: below 0.30 is very weak, 0.30 to below 0.50 is weak, 0.50 to below 0.70 is moderate, 0.70 to below 0.90 is strong, and 0.90 to below 1 is very strong. An exact magnitude of 1 is perfect.

Context still controls meaning. A correlation of 0.40 may matter in a noisy human system, while the same value may be inadequate for a precision process. Sample size, measurement reliability, study design, outliers and the range of observed values all affect interpretation.

What Does R-Squared Mean?

R-squared is r squared. It ranges from 0 through 1 and removes the direction sign. In simple linear regression with an intercept, R-squared is the share of observed Y variation accounted for by the fitted straight line in the entered sample.

For the worked example, R-squared is 3/5, or 0.60. This means the fitted line accounts for 60% of the observed variation in Y within those five points. It does not mean X causes 60% of Y, and it does not guarantee the same performance on new data.

Covariance, Standard Deviation and Regression

Covariance carries the direction of joint movement but depends on measurement units. Pearson r standardizes sample covariance by the sample standard deviations of X and Y, which removes units. The calculator shows both sample covariance, using n - 1, and population covariance, using n.

The Y-on-X regression line is different from correlation. Regression assigns X as the predictor and Y as the response. Its slope equals Sxy divided by Sxx, while the intercept positions the line through the point formed by both means. Swapping X and Y keeps r unchanged but produces a different regression equation.

Why the Scatter Plot Matters

A single coefficient cannot show the full shape of a data set. The scatter plot helps you see clusters, gaps, outliers and curves. One extreme observation may raise, lower or reverse r. A U-shaped pattern may produce r near zero even when Y is strongly related to X.

Use the plot beside the coefficient. This page normalizes exact offsets before drawing browser coordinates, so large values separated by small exact differences do not collapse merely because ordinary floating-point numbers cannot preserve the original offsets.

When Pearson r Is Undefined

Correlation needs variation in both variables. If every X value is identical, Sxx equals zero. If every Y value is identical, Syy equals zero. Either condition makes the denominator zero, so r and R-squared are undefined. The correct answer is not zero.

Two nonconstant pairs always give an absolute correlation of 1 because two distinct points determine a straight line. Treat this as a geometric fact, not strong evidence. More observations and a representative design are needed before drawing practical conclusions.

Exact Fractions, Large Offsets and Rounding

The calculator converts supported inputs to reduced fractions backed by arbitrary-size integers. Integers, terminating decimals, fractions, mixed numbers and scientific notation remain exact. Equivalent forms such as 0.5, 1/2 and 5e-1 therefore produce the same stored value.

Exact centered sums protect small spreads beside large baselines. For example, 50-digit values around 1049 that differ by 1 remain distinct. Pearson r and every verification step stay exact. BigInt fixed-point square-root arithmetic creates the displayed decimal without using Math.sqrt on the original data.

The decimal selector affects display only. A small nonzero coefficient switches to scientific notation rather than appearing as zero. A nonperfect result near -1 or 1 may show extra digits so rounding never makes it look exactly perfect. To keep the page responsive, a reduced intermediate fraction may contain no more than 4,000 combined numerator and denominator digits.

Pearson Compared with Other Methods

Choosing an association method
Method Measures Useful when Main caution
Pearson r Linear association between numerical values A straight-line pattern is meaningful Sensitive to outliers and nonlinear shapes
Spearman rank correlation Monotonic association between ranks Ranks or ordered movement matter Does not measure the original linear scale
Covariance Joint direction in original units Units and scale are part of the analysis Magnitude is not standardized
Simple regression A predictive line from X to Y Predictor and response roles are defined Direction matters and extrapolation is risky

Input Rules and Limits

  • Enter 2 to 200 X-Y pairs. Both lists must have the same number of entries.
  • The first X value pairs with the first Y value, and pairing continues by position.
  • Supported formats include integers, decimals, fractions, mixed numbers and scientific notation.
  • Each numeric part may contain up to 50 digits. Scientific exponents may range from -100 through 100.
  • Use a period as the decimal mark. Commas separate observations and cannot serve as thousands separators.
  • Do not enter labels, units, percentages, expressions, NaN, infinity or a fraction with zero denominator.
  • Duplicate pairs remain separate observations. This tool does not accept arbitrary weights or frequency counts.
  • A zero-variance variable produces an undefined coefficient with a clear explanation.

Common Correlation Mistakes

  • Misaligning pairs: verify that each X value still matches its intended Y value after sorting, filtering or deleting data.
  • Reading causation into association: r alone cannot identify a causal direction or remove confounding.
  • Ignoring the scatter plot: inspect outliers, clusters, restricted ranges and nonlinear patterns.
  • Calling rounded 1.00 perfect: only an exact magnitude of 1 means every point lies on one straight line.
  • Treating r = 0 as independence: zero Pearson correlation only rules out linear association in the sample.
  • Mixing incomparable measurements: confirm that every pair refers to the same unit of analysis and time frame.
  • Reporting significance without inference: this page does not calculate a p-value or confidence interval.

Practical Uses and Scope

Pearson correlation is used to explore relationships such as study time and test score, temperature and energy use, advertising spend and sales, or one instrument's reading against another. It is most useful as a descriptive step paired with subject knowledge, a clear sampling process and visual inspection.

The calculator describes only the values entered. It does not correct biased sampling, missing data, repeated-measure dependence, measurement error or time-series trends. It also does not provide statistical significance. Use an appropriate inferential method when you need a population claim.

Related Calculators

Frequently Asked Questions

What does a correlation coefficient measure?

Pearson's correlation coefficient measures the direction and strength of a linear relationship between two numerical variables. Its value ranges from -1 through 1.

How do I calculate Pearson's r?

Pair each X value with its matching Y value, center both variables around their means, add the cross-products, and divide by the square root of Sxx times Syy.

What do r = 1 and r = -1 mean?

A value of 1 means every point lies on a straight line with positive slope. A value of -1 means every point lies on a straight line with negative slope.

Does r = 0 mean there is no relationship?

No. It means there is no linear correlation in the entered sample. A curved or other nonlinear relationship may still be strong.

When is Pearson correlation undefined?

Pearson r is undefined when fewer than two pairs are entered or when every X value or every Y value is the same, because a required standard deviation is zero.

What is R-squared in this calculator?

R-squared is r squared. For simple linear regression with an intercept, it is the proportion of observed Y variation accounted for by the fitted straight line in the sample.

Does correlation prove causation?

No. Correlation alone does not show that changing one variable causes the other to change. Confounding, selection, time trends and reverse direction may explain an association.

Can I enter fractions and scientific notation?

Yes. Both lists accept integers, decimals, fractions, mixed numbers and scientific notation. Equivalent forms such as 0.5, 1/2 and 5e-1 are treated exactly alike.

Why must X and Y have the same number of entries?

Correlation uses ordered pairs. The first X value matches the first Y value, the second matches the second, and so on. A missing entry changes every later pairing.

Is Pearson correlation affected by units?

No. Translating a variable or multiplying it by a positive constant leaves r unchanged. Multiplying one variable by a negative constant reverses the sign.

What is the difference between correlation and regression?

Correlation is symmetric and unitless. Y-on-X regression assigns predictor and response roles and produces a line with units, slope and intercept.

Should I use Pearson or Spearman correlation?

Use Pearson for linear association between numerical variables. Spearman is often preferred for monotonic rank relationships, ordinal data or cases where ranks are more meaningful.

This calculator is an educational descriptive-statistics tool. Check pair alignment, data quality, study design and the scatter plot before relying on a result. Correlation does not establish causation and this page does not provide statistical significance.

Post a Comment

0Comments

Post a Comment (0)