Tools / Correlation calculator
Correlation Coefficient Calculator
Paste two columns of numbers to get the Pearson and Spearman correlation, R², the p-value, a regression line and a scatter plot.
Free, no sign-up. Calculations run in your browser; your data is never uploaded.
Scatter plot
How to interpret the correlation coefficient
A correlation coefficient runs from −1 to 1. Positive values mean the two variables rise together; negative values mean one falls as the other rises; 0 means no linear relationship. As a rough guide for the size of r:
| |r| | Usually described as |
|---|---|
| 0.0 to 0.1 | Negligible |
| 0.1 to 0.3 | Weak |
| 0.3 to 0.5 | Moderate |
| 0.5 to 0.7 | Strong |
| 0.7 to 1.0 | Very strong |
What counts as strong depends on the field: 0.3 can be meaningful in social science and weak in physics.
Pearson or Spearman?
- Pearson’s r measures how close the points are to a straight line. It’s sensitive to outliers: one extreme point can create or hide a correlation.
- Spearman’s ρ (rho) correlates the ranks instead of the values, so it measures any steadily increasing or decreasing relationship, curved or not, and is much less affected by outliers.
If the two disagree a lot, look at the scatter plot. A big gap usually means an outlier or a curved relationship.
Correlation is not causation
A strong correlation shows that two variables move together, not that one causes the other. Ice cream sales and drowning rates are correlated because both rise in summer. To judge cause and effect you need an experiment, or careful analysis that accounts for other factors.
Calculate correlation in Python
import pandas as pd
from scipy import stats
df = pd.read_csv("data.csv")
print(df["x"].corr(df["y"])) # Pearson
print(df["x"].corr(df["y"], method="spearman")) # Spearman
print(stats.pearsonr(df["x"], df["y"])) # r and p-value
print(df.corr(numeric_only=True)) # every pair of columnsOur exploratory data analysis tutorial shows how to build a correlation heatmap for a whole dataset, and linear regression explained goes beyond the fitted line shown here.
FAQ
What does the p-value tell me?
It’s the probability of seeing a correlation at least this strong if there were really no relationship. A p-value below 0.05 is the usual threshold for calling a correlation statistically significant. With large samples, even tiny correlations become significant, so look at the size of r too.
What is R²?
For a straight-line fit, R² is Pearson’s r squared: the share of the variation in Y explained by X. An r of 0.8 gives an R² of 0.64, so X explains 64% of the variation in Y.
How many pairs do I need?
At least three, but correlations from fewer than about 20 pairs are unreliable. Check the confidence interval: if it’s wide, the true correlation could be very different.
