Correlation Coefficient Calculator — Pearson, Spearman & Kendall

Correlation Coefficient Calculator

Measure how strongly two variables move together. Get Pearson's r, Spearman's ρ, and Kendall's τ with the p-value, confidence interval, regression line, and a scatter plot of your data.

Paste paired data, up to 2,000 pairs

Each x must go with its own y—two measurements of the same person, day, or item. Paste two columns from a spreadsheet, or enter the x list and y list separately in the same order.

Correlation method

Data format

0 pairs

How to Use This Calculator

  1. Pick the method: Pearson for a straight-line relationship between measured values, Spearman or Kendall for ranks, ordered categories, curved but steady trends, or data with outliers.
  2. Paste x and y as two columns, or switch to Two lists and enter them separately. You need at least 3 pairs; 10 or more gives a more meaningful result.
  3. Choose the significance level and press Calculate Correlation.
  4. Read the coefficient and its strength, check the p-value and confidence interval, and look at the scatter plot before drawing conclusions.

What Is a Correlation Coefficient?

A correlation coefficient calculator measures the strength and direction of the relationship between two variables. Pearson’s correlation coefficient ranges from -1 to 1. A value near 1 indicates a strong positive correlation, a value near -1 indicates a strong negative correlation, and a value near 0 indicates little or no linear correlation.

The coefficient is a single number that describes how closely two variables move together. The sign gives the direction: positive when both rise together, negative when one rises as the other falls. The size gives the strength: close to ±1 means the points lie near a line or steady trend, close to 0 means there is no consistent pattern.

+1

Perfect positive: all points on a rising line.

0

No linear (or monotonic) relationship.

−1

Perfect negative: all points on a falling line.

The coefficient does not tell you how steep the relationship is. A perfect r = 1 can come from a line that rises by 0.01 per unit or by 1,000 per unit; the slope of the regression line gives that information.

Assumptions reference: Laerd Statistics — Pearson Product-Moment Correlation.

Correlation Coefficient Formulas

Pearson r

r = Sxy ÷ √(Sxx · Syy)

Sxy = Σ(x − x̄)(y − ȳ), Sxx = Σ(x − x̄)², Syy = Σ(y − ȳ)²

Spearman ρ

ρ = Pearson r of the ranks

Without ties: ρ = 1 − 6Σd² ÷ (n(n² − 1)), d = rank difference

Kendall τ-b

τ = (C − D) ÷ √((n₀ − n₁)(n₀ − n₂))

C, D = concordant and discordant pairs; n₁, n₂ adjust for ties

Significance test

t = r √(n − 2) ÷ √(1 − r²)

Compared with a t distribution with n − 2 degrees of freedom.

Confidence interval

tanh(atanh r ± z ÷ √(n − 3))

Fisher's z-transformation; z = 1.96 for 95%.

Regression line

ŷ = a + bx, b = Sxy ÷ Sxx

a = ȳ − b x̄; also b = r · (sy ÷ sx).

Method reference: The BMJ — Statistics at Square One: Correlation and Regression.

Worked Example: Study Hours and Exam Scores

Eight students recorded study hours (x) and exam scores (y): (2, 55), (3, 60), (5, 62), (6, 70), (8, 75), (9, 78), (10, 85), (12, 90).

  • Means: x̄ = 6.875 hours, ȳ = 71.875 points.
  • Sums: Sxx = 84.875, Syy = 1,074.875, Sxy = 298.875.
  • Pearson r = 298.875 ÷ √(84.875 × 1,074.875) = 0.9895—very strong and positive. r² = 0.979, so study time accounts for about 98% of the variation in scores in this sample.
  • Significance: t = 16.78 with 6 degrees of freedom, p < 0.0001. 95% CI for r: 0.941 to 0.998.
  • Regression line: score ≈ 47.7 + 3.52 × hours. Spearman ρ and Kendall τ are both exactly 1, because a higher x always comes with a higher y.

Pearson vs. Spearman vs. Kendall

All three range from −1 to +1. They differ in what kind of relationship they detect and how they react to outliers.

FeaturePearson rSpearman ρKendall τ
MeasuresLinear relationshipMonotonic relationship (ranks)Agreement in ordering of pairs
DataInterval or ratio valuesOrdinal or continuousOrdinal or continuous
OutliersSensitiveResistantResistant
Typical size—Close to Pearson for linear dataUsually smaller in magnitude than ρ
Best forMeasured variables in a roughly straight-line cloudRankings, Likert scales, curved but steady trendsSmall samples, many ties

A useful check is to compute all three. If Pearson is much stronger than Spearman, a few extreme points are probably driving it. If Spearman is much stronger than Pearson, the relationship is consistent but curved.

How Big Must r Be to Be Significant?

With small samples, even a fairly large r can arise by chance. These are the smallest |r| values that reach p < 0.05 (two-tailed).

Pairs (n)510203050100
Critical |r|0.8780.6320.4440.3610.2790.197

The reverse also holds: with thousands of pairs, an r of 0.05 can be "significant" while explaining only 0.25% of the variation. Report r with its confidence interval, not just the p-value.

Common Pitfalls

Correlation is not causation

Two series can move together because a third factor drives both—or simply because both trend over time. Ice-cream sales and drowning rates both rise in summer.

Always plot the data

Very different patterns—a curve, a single outlier, two separate clusters—can produce the same r. The scatter plot shows which one you have.

r = 0 does not mean unrelated

A perfect U-shape, such as y = x² for x from −5 to 5, has r = 0. Pearson only detects straight-line patterns.

Restricted range weakens r

Looking only at top students, or only at one price band, shrinks the spread of x and usually pulls r toward zero even when the full relationship is strong.

Examples of misleading correlations: Tyler Vigen — Spurious Correlations.

Frequently Asked Questions

What is a good correlation coefficient?

It depends on the field. In physics or calibration work, anything below 0.99 can signal a problem. In psychology or medicine, 0.3 is often considered a meaningful association. The scale shown in the results (very weak to very strong) is a common general guide to strength and direction, not a strict rule.

What is the difference between r and r²?

r shows direction and strength. r² (the coefficient of determination) shows the share of the variance in y that a straight line in x accounts for. r = 0.7 sounds strong, but r² = 0.49 means more than half of the variation is left unexplained.

Does it matter which variable is x and which is y?

Not for the correlation coefficient—swapping each x-value with its y-value gives the same r, ρ, and τ. It does matter for the regression line: predicting y from x gives a different line than predicting x from y unless the correlation is perfect.

What does the p-value tell me?

It is the probability of seeing a correlation at least this strong if there were truly no relationship in the wider population. A p-value below your significance level (usually 0.05) means the correlation in your sample is unlikely to be due to chance alone. It says nothing about how large or important the relationship is.

How many data points do I need?

The calculator needs at least 3 data pairs, and 4 for a confidence interval. In practice, fewer than about 10 pairs gives a very wide interval; 30 or more observations is a common minimum for a stable estimate. Whatever the size of your dataset, check the scatter plot for outliers and an overall trend first.

How does the calculator handle tied values?

For Spearman correlation, tied values get the average of the ranks they span, and ρ is computed as Pearson's r on those ranks, which is exact with ties. For Kendall, the tie-corrected τ-b is used, the same version reported by most statistics software.

Why is the result "undefined"?

Pearson correlation is the covariance of x and y divided by the product of their standard deviations. If every x value (or every y value) is the same, that standard deviation is zero, so the denominator of the formula is zero while the numerator is also zero. With no variation there is nothing to compare. Add data that varies, or check that the columns were pasted correctly as input.

How do I calculate correlation in Excel or Google Sheets?

Use =CORREL(A2:A20, B2:B20) or =PEARSON(…) for Pearson's r, and =RSQ(…) for r². Spreadsheets have no built-in Spearman function; rank both columns with RANK.AVG and apply CORREL to the ranks. The output should match this calculator. Keep in mind that a high r confirms a linear relationship, not that one variable causes the other.

Other Useful Calculators

Disclaimer: This calculator provides descriptive and inferential statistics for educational, informational, and preliminary analytical use. Correlation measures association, not causation. P-values and confidence intervals assume independent observations; the Pearson tests additionally assume an approximately linear relationship and roughly normal data, and the Spearman and Kendall p-values use large-sample approximations that may be less accurate for very small samples. Results depend entirely on the data entered. For research, medical, financial, or other consequential conclusions, review the data and assumptions and consult a qualified statistician.

Last updated: October 5, 2026