Correlation Calculator

Free Pearson correlation calculator: paste paired data to get the correlation coefficient r, r-squared, the t-statistic, a p-value and a scatter plot — all in your browser.

Paste two columns of paired data and get the Pearson correlation coefficient, its significance and a scatter plot. Enter the same number of values in each box; the calculation runs entirely in your browser.

▶ Watch: correlation in Rcor.test() with a confidence interval, Pearson vs Spearman, and a scatter plot.

Download the R script  ·  ▶ Practice in the playground

The R code from the video, ready to copy:

# Correlation - Pearson vs Spearman
# Built-in mtcars: weight vs fuel efficiency
cor(mtcars$wt, mtcars$mpg)

# Pearson correlation with a test and 95% CI
cor.test(mtcars$wt, mtcars$mpg)

# Spearman - rank based, for non-linear or non-normal data
cor.test(mtcars$wt, mtcars$mpg, method = "spearman")

# See the relationship
plot(mtcars$wt, mtcars$mpg, pch = 19, col = "#17a2b8", xlab = "Weight", ylab = "MPG")

How to use it

Reading the result

Pearson’s r ranges from −1 to +1 and measures the strength and direction of a linear relationship: near ±1 is a tight straight-line association, near 0 is none. is the share of variance in one variable explained by the other. The p-value tests whether the correlation differs from zero.

Two cautions that a coefficient alone won’t tell you — always look at the scatter plot above:

  • Pearson’s r only captures linear relationships. A strong curved pattern can produce r ≈ 0.
  • A single outlier can create or destroy a correlation. If your data isn’t roughly linear or has outliers, consider Spearman’s rank correlation instead — see Pearson vs Spearman.

And the eternal reminder: correlation is not causation.

Do it in R

cor.test(x, y)                       # Pearson r, t, p, CI
cor.test(x, y, method = "spearman")  # rank-based alternative

FAQ

Frequently asked questions

Pearson or Spearman?

Use Pearson for linear relationships with roughly normal data; use Spearman (rank-based) when the relationship is monotonic but not linear, or when outliers or non-normality are a concern.

Does a significant correlation mean one variable causes the other?

No. Correlation quantifies association only. Causation requires a design that rules out confounding and reverse causation.


Correlation is often the first question, not the last. When you need regression, adjustment for confounders and a proper write-up, that’s our work.