Correlation Calculator - Pearson, Spearman, and Kendall

Correlation calculator that returns Pearson r, Spearman rho, or Kendall tau with p-value, r-squared, t-statistic, and a strength interpretation band.

Updated: June 20, 2026 • Free Tool

Correlation Calculator

Enter the first paired sample. Numbers, decimals, negatives, and duplicates are all accepted.

The second paired sample. Each value should pair with the value at the same position in Dataset X.

Pick Pearson for linear relationships, Spearman for monotonic or non-normal data, and Kendall for small samples with ties.

Threshold used to label the p-value as significant. Enter the probability as a decimal (0.05 means 5%).

Results

Correlation Coefficient
0
Coefficient Symbol 0
P-Value (two-tailed) 0
T-Statistic 0
R-Squared 0%
Sample Size (n) 0
Degrees of Freedom 0
Strength Band 0

What Is a Correlation Calculator?

A correlation calculator turns two paired columns of numbers into a single strength-and-direction score, so you can see at a glance whether one variable moves with another. This correlation calculator supports Pearson, Spearman, and Kendall tau-b, returns a two-tailed p-value, an r-squared share, and a plain-language strength band, and accepts comma, space, or newline separated inputs.

  • Coursework and lab reports: Quantify the link between study hours and exam scores, attendance and final grade, or temperature and reaction rate in a chemistry lab.
  • Survey and psychology data: Check whether Likert-scale responses on stress and sleep move together, or whether personality scores correlate with task completion time.
  • Finance and operations: Compare ad spend with revenue, weekday traffic with sales, or production runs with defect rates without writing code.
  • Pre-analysis for regression: Run a correlation check before fitting a line, so you know whether a linear or monotonic model is the better starting point.

Correlation does not imply causation, so treat the result as a screening tool, not a final conclusion. A high r value tells you two variables move together; it does not tell you why.

For a wider descriptive summary that includes mean, median, and spread before checking association, the Statistics Calculator gives the same kind of read on a single dataset.

How This Correlation Calculator Works

The calculator parses the two datasets into matched pairs and then runs the chosen method. Pearson uses the computational form that avoids subtracting the mean from every observation. Spearman ranks the data first and applies the same formula on ranks. Kendall tau-b counts concordant and discordant pairs, then corrects for ties in either variable.

r = [n·Σxy − (Σx)(Σy)] / sqrt([n·Σx² − (Σx)²] · [n·Σy² − (Σy)²])
  • n: Number of complete pairs after parsing.
  • Σx, Σy: Sum of the X and Y values.
  • Σxy: Sum of the product of each matched pair.
  • Σx², Σy²: Sum of the squared X and Y values.

Once r is known, the calculator reports r² (the share of variance the linear fit would explain), t = r·sqrt((n−2)/(1−r²)) and a two-tailed p-value from the Student t distribution with n − 2 degrees of freedom. For Kendall, the calculator uses the normal approximation Z = 3·tau·sqrt(n(n−1)) / sqrt(2(2n+5)), which is the textbook large-sample approximation in the absence of ties.

Worked example: 10 paired values

Dataset X: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10; Dataset Y: 2, 4, 5, 4, 5, 7, 8, 9, 10, 11; Method: Pearson.

n = 10, Σx = 55, Σy = 65, Σxy = 436, Σx² = 385, Σy² = 501. Plug into the computational formula.

r = (10·436 − 55·65) / sqrt((10·385 − 55²)(10·501 − 65²)) = 785 / sqrt(825 · 785) ≈ 0.9755.

A very strong positive linear relationship; with n − 2 = 8 degrees of freedom, the t-statistic is about 12.53 and p < 0.0001.

According to NIST/SEMATECH e-Handbook of Statistical Methods, the computational form of Pearson's correlation coefficient is r = [n·Σxy − (Σx)(Σy)] / sqrt([n·Σx² − (Σx)²] · [n·Σy² − (Σy)²]).

If you only need the linear case with an extended t-test and scatter plot output, the focused Pearson Correlation Calculator in Math & Conversion does that one job well.

Key Concepts Explained

Four ideas show up every time someone interprets a correlation. Knowing them prevents the two most common mistakes: confusing strength with importance, and mistaking rank-based methods for the linear-only Pearson.

Pearson r

Measures the strength and direction of a linear relationship between two continuous variables. It is sensitive to outliers and assumes both variables are roughly normal. Values range from −1 (perfect negative slope) to +1 (perfect positive slope).

Spearman rho

Pearson's formula applied to the rank-transformed data. It captures monotonic relationships (any curve that only goes up or only goes down) and is robust to outliers. With no ties it reduces to 1 − 6·Σd² / (n(n² − 1)).

Kendall tau-b

Counts the share of pairs that move in the same direction minus the share that move in opposite directions, with a correction for ties in either variable. It is the most reliable choice for small samples and ordinal data.

P-value and significance

The two-tailed p-value answers: if the true correlation were zero, what is the chance of seeing a coefficient this large or larger? A p-value below your chosen alpha (often 0.05) means the result is unlikely under the null hypothesis of no relationship.

The p-value reported here is the same t-based two-tailed test you would run on a slope, and the T-Test Calculator walks through the t-statistic logic for a mean difference.

How to Use This Correlation Calculator

Enter the two samples, pick a method, set your significance threshold, and read off the result. The calculator updates as you type.

  1. 1 Collect paired observations: Make sure each X value has a matching Y value at the same position. Different lengths trigger a validation error.
  2. 2 Paste the values into X and Y: Use commas, spaces, tabs, or newlines as separators. Decimals, negatives, and repeated values are all accepted.
  3. 3 Choose a method: Use Pearson for roughly normal continuous data, Spearman for ranks or skewed data, and Kendall for small samples or ordinal ratings.
  4. 4 Set the significance level: 0.05 is the standard choice. Lower it (0.01) for stricter evidence; raise it (0.10) for exploratory work.
  5. 5 Read the result and the band: The coefficient sits in the centre, with r², the t-statistic, and the p-value underneath. The strength band gives a plain-language read on |r|.
  6. 6 Compare with a regression check: If r is large but the scatter looks curved, switch to Spearman or move to a non-linear model before quoting the result.

A student wants to know whether hours studied predict exam score. They paste 10 paired observations, leave the method on Pearson, and set alpha to 0.05. The calculator returns r = 0.84, r² = 70.6%, p < 0.0001, with the band reading 'Very strong positive relationship (statistically significant at alpha = 0.05)'. That is enough to justify quoting the relationship in the write-up, with a clear caveat that correlation is not causation.

Before quoting a correlation in a report, the Sample Size Calculator helps you confirm that the dataset is large enough to detect the effect size you care about.

Benefits of Using This Correlation Calculator

A correlation calculator removes the manual spreadsheet work and gives you three different methods, a significance test, and a plain-language band in a single screen.

  • Three methods in one tool: Switch between Pearson, Spearman, and Kendall without re-entering the data, so you can test how robust the relationship is to rank-based or tie-aware methods.
  • P-value and r-squared included: You get a two-tailed significance test and the share of variance explained, which is what most textbooks and reporting templates expect.
  • Handles real-world data quirks: Ties, decimals, negatives, and uneven spacing in pasted lists are all accepted. The parser strips stray tokens and reports the count.
  • Plain-language strength band: The interpretation card maps the absolute coefficient to a band (very weak to very strong) so non-statisticians can read the result at a glance.
  • Pairs with the rest of your analysis: Use it as a front end for a regression run, a t-test, or a sample size check, all of which already live on this site.
  • Educational reference: The worked example and formula box make it useful for AP Statistics, undergraduate methods, and psychology research methods courses.

When the correlation band reads 'very strong', the natural next step is fitting the line itself, and the Linear Regression Calculator takes the same X and Y inputs and returns slope and intercept.

Factors That Affect Your Results

Five things drive the size and sign of a correlation coefficient. Knowing them up front prevents the two recurring traps: over-reading a small sample and missing non-linearity.

Sample size

Small samples produce wide confidence intervals and unstable coefficients. As a rule of thumb, you need at least 10 to 20 pairs to trust a Pearson or Spearman value, and 30+ for a stable Kendall tau-b.

Outliers and skew

A single extreme value can pull Pearson r toward zero or ±1, which is why Spearman or Kendall are safer for skewed or outlier-prone data. Always plot the data first.

Linearity vs monotonicity

Pearson only catches straight-line relationships. A perfect U-shape can produce r close to 0 even though the variables are tightly linked. Use Spearman or Kendall when the shape is curved but consistent.

Ties in ranks

Many identical values (for example, 'strongly agree' answers in a survey) make the simple 1 − 6·Σd² / (n(n² − 1)) form of Spearman inaccurate. The calculator uses the Pearson-on-ranks form, which is the correct tie-aware version.

Range restriction

If you only sample a narrow slice of one variable, the correlation shrinks. Studying the link between age and income inside a single job title will understate the relationship you would see across the full workforce.

  • Correlation does not imply causation: a high r can come from a third lurking variable that drives both X and Y, not from a direct effect.
  • P-values assume the chosen method's assumptions. A 'significant' Spearman rho on heavily tied ordinal data may not be reliable, so report the sample size and tie structure alongside the result.
  • The p-value is a large-sample approximation. With very small n (under 10), prefer exact permutation tests for Kendall tau-b, which this calculator does not implement.

According to SciPy Reference Guide (scipy.stats.spearmanr), the Spearman rank-order correlation coefficient is the Pearson correlation coefficient computed on the rank-transformed values, which is why it reduces to the closed-form expression 1 − 6·Σd² / (n(n² − 1)) once the average ranks are used and there are no ties.

According to SciPy Reference Guide (scipy.stats.kendalltau), Kendall's tau-b is defined as tau-b = (P − Q) / sqrt((P + Q + T)·(P + Q + U)), where P counts concordant pairs, Q counts discordant pairs, and T and U count pairs tied only in x or only in y, and ties in both columns are excluded from both corrections.

Because Pearson assumes approximately normal data, checking a few standardized values with the Z-Score Calculator is a quick way to spot the heavy tails that should push you toward Spearman instead.

Correlation calculator computing Pearson, Spearman, and Kendall coefficients with p-value and interpretation band
Correlation calculator computing Pearson, Spearman, and Kendall coefficients with p-value and interpretation band

Frequently Asked Questions

Q: What does a correlation calculator actually compute?

A: It takes two paired lists of numbers and returns a coefficient between -1 and +1 that measures how tightly the two variables move together. This calculator adds a p-value, r-squared, t-statistic, and a plain-language strength band so the result is usable for homework, lab reports, or a quick business check.

Q: What is the difference between Pearson, Spearman, and Kendall correlation?

A: Pearson r measures straight-line (linear) relationships and assumes roughly normal data. Spearman rho is Pearson applied to ranks, so it captures any monotonic trend and resists outliers. Kendall tau-b counts concordant versus discordant pairs with a tie correction; it is the most reliable for small samples and ordinal ratings.

Q: How do I interpret a correlation coefficient between -1 and 1?

A: The sign tells you the direction: positive means both variables go up together, negative means one goes up as the other goes down. The absolute value tells you the strength: roughly 0.0 to 0.2 is very weak, 0.2 to 0.4 weak, 0.4 to 0.6 moderate, 0.6 to 0.8 strong, and 0.8 and above is very strong. These are guidelines, not hard rules.

Q: What sample size do I need for a significant correlation?

A: There is no fixed minimum, but a Pearson r needs a larger n to reach a given p-value than a Kendall tau-b for the same effect size. As a rule of thumb, plan for at least 10 to 20 pairs to trust a Pearson result, and 30 or more for a tight confidence interval around Spearman or Kendall.

Q: Can the correlation calculator return a value outside the range -1 to 1?

A: No. The mathematical bounds of Pearson, Spearman, and Kendall tau-b are all [-1, +1]. A coefficient of +1 is a perfect positive relationship, -1 is a perfect negative relationship, and 0 means no linear or monotonic association. A result outside that range would mean a bug in the code, not a statistical finding.

Q: Does correlation imply causation?

A: No. Correlation only shows that two variables move together in a predictable way. A third lurking variable, coincidence in the sample, or reverse causation can all create a high r. Treat the result as a screening tool and design a controlled study or natural experiment before claiming a causal effect.