Correlation Matrix Calculator
Paste a table of numbers and get every pairwise correlation, with sample sizes, p-values, a heat-coloured matrix and a scatter plot for any pair. Pearson or Spearman. It runs in your browser, so your data is never uploaded.
3. Correlation matrix (click any cell to plot that pair)
Each cell: r, then n pairs used. Stars: * p<.05, ** p<.01, *** p<.001 (two-tailed). Teal = positive, orange = negative.
Strongest relationships
Scatter plot
What a correlation matrix tells you
A correlation matrix lists the correlation coefficient for every pair of numeric variables in a dataset. Each value runs from −1 (as one variable rises, the other falls in a perfectly straight-line pattern) through 0 (no linear pattern) to +1 (they rise together in a perfectly straight line). The matrix is symmetric, and the diagonal is always 1 because a variable matches itself exactly.
It is usually the first thing to look at in exploratory analysis. In a few seconds it shows which variables move together, which are unrelated, and which pairs are so similar that including both in a regression model would cause trouble.
How this calculator works
- Column detection. A column counts as numeric when at least 80% of its non-empty cells are numbers. Text columns such as names are skipped. Columns called id, index, year, date or similar are unticked by default because a running counter correlates with anything that trends over time. You can tick them back on.
- Pearson r is covariance divided by the product of the two standard deviations: r = Σ(x−x̄)(y−ȳ) / √[Σ(x−x̄)² · Σ(y−ȳ)²].
- Spearman ρ is Pearson r applied to the ranks of the values, with tied values given their average rank. It detects any consistently rising or falling pattern, not only straight lines, and is less affected by outliers.
- Missing values. Pairwise uses every row that has both values for that pair, so n can differ between cells (the same as Excel’s CORREL, pandas
corr()and R’suse="pairwise.complete.obs"). Listwise drops any row with a gap in any selected column, so every cell uses the same rows (R’suse="complete.obs"). - p-values come from the test statistic t = r√[(n−2)/(1−r²)] compared with a Student t distribution with n−2 degrees of freedom. For Spearman this is a standard approximation that works best with roughly 10 or more rows.
Worked example you can check by hand
Take x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5. The means are 3 and 4. The deviation products sum to 6, the squared x deviations to 10 and the squared y deviations to 6.
r = 6 / √(10 × 6) = 0.775. That is a strong positive correlation, yet with only n = 5 the p-value is about 0.12, so it is not significant at the 5% level. Large coefficients from small samples are easy to get by chance, which is why this tool shows n and p next to every r.
How to read the numbers
These labels are common rules of thumb, not laws. What counts as “strong” depends on your field: 0.5 is impressive in psychology and disappointing in physics calibration work.
| |r| | Usual description |
|---|---|
| 0.00 – 0.19 | Very weak or none |
| 0.20 – 0.39 | Weak |
| 0.40 – 0.59 | Moderate |
| 0.60 – 0.79 | Strong |
| 0.80 – 1.00 | Very strong |
Square r to get the share of variance two variables have in common: r = 0.6 means about 36% shared variance, not 60%.
Mistakes that produce misleading matrices
- Trusting r without looking at the scatter plot. A U-shaped relationship can have r near 0, and one extreme point can create a high r from otherwise unrelated data. Click a cell above to see the actual points.
- Tiny samples. With fewer than about 10 rows, r swings widely when one row changes.
- Running many pairs and reporting the “hits”. With 20 variables there are 190 pairs, and around 9 will reach p<.05 by chance alone. Treat starred cells as leads to investigate, or apply a multiple-comparison correction such as Bonferroni (divide .05 by the number of pairs).
- Correlated predictors in regression. Pairs above roughly |r| = 0.8 to 0.9 signal possible multicollinearity, which makes regression coefficients unstable. The tool flags these.
- Reading causation into correlation. Ice-cream sales and drowning both rise in summer; neither causes the other. A third variable, a reverse direction or coincidence can produce the same r.
- Mixing data types. Pearson assumes continuous values. For ratings on a 1–5 scale or ranked data, use Spearman.
Pearson or Spearman?
Use Pearson when both variables are continuous, the relationship looks roughly straight on a scatter plot, and there are no extreme outliers. Use Spearman when the data are ranks or ordinal ratings, the relationship curves but keeps going one direction, or outliers are present. If the two results differ a lot, that difference is itself informative: it usually means outliers or a curved relationship. For very small samples with many ties, Kendall’s tau is another option, though this tool does not calculate it.
Frequently asked questions
Which data layout does the tool expect?
One row per observation and one column per variable, with names in the first row. Copying a range from Excel or Google Sheets works directly because it pastes as tab-separated text. Quoted fields such as "1,200" are read correctly, but keep currency symbols, units and percent signs out of numeric cells.
Why is my year or ID column unticked?
Years and row numbers increase steadily, so they correlate with anything that grows over time. That tells you about time, not about the relationship between your real variables. Tick the box if you do want it included.
Do pairwise and listwise deletion give different answers?
Only when some cells are empty. With complete data they match. With gaps, pairwise keeps more information, while listwise keeps all cells comparable because they use identical rows. If the two disagree noticeably, your missing data may not be random and deserves a closer look.
What does a value near 0 mean?
No straight-line relationship, not necessarily no relationship. Check the scatter plot, and try Spearman if the pattern curves.
Does this match Excel, R and Python?
Pearson with pairwise deletion matches Excel’s CORREL and pandas DataFrame.corr(). Spearman matches pandas corr(method="spearman") and R’s cor(method="spearman"). P-values match standard t-test based output such as R’s cor.test() for Pearson.
Is my data uploaded anywhere?
No. The calculation is JavaScript running on this page, and nothing you paste is sent to a server or stored. You can confirm it in your browser’s Network tab.
How many rows and columns can it handle?
Thousands of rows and a few dozen columns are fine on an ordinary laptop. Very wide matrices are easier to read after downloading the CSV.
Further reading
- Pearson, K. (1895). Notes on regression and inheritance in the case of two parents. Proceedings of the Royal Society of London, 58, 240–242.
- Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72–101.
- Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum Associates.