Blog
Statistics on data

Spearman rank correlation calculator online

Spearman replaces every value with its rank and correlates those instead. That single change buys two things Pearson cannot offer: immunity to outliers, and the ability to detect a relationship that is consistently increasing but not straight.

Your data

Paste a table straight from Excel or Google Sheets, or drop a CSV file. Nothing is uploaded anywhere — the whole calculation runs inside this browser tab.

CSV, TSV or plain text. Files saved in windows-1251 are detected and re-read automatically, so Cyrillic headers do not turn into garbage.

Parsing options

Columns

Result

The drawing library is downloaded only when you press the button, and only on this page.

All calculations run locally in your browser: parsing, chart, export. Disconnect the network and the page keeps working.

Facts and limits of this method

What it measures Monotonic association — consistently rising or falling, not necessarily linear
Method Pearson correlation computed on ranks rather than values
Tie handling Tied values receive the average of the ranks they span
Robustness An extreme value becomes just the highest rank, so it cannot dominate
p-value Exact, via the t-distribution with n−2 degrees of freedom
Minimum rows 3, and meaningfully around 20

When it misleads you

How it is calculated

Each column is converted to ranks: the smallest value gets rank 1, the next rank 2, and so on. The Pearson correlation is then computed on those two rank columns, which is the definition of Spearman rho.

Tied values receive the average of the ranks they occupy. If three rows share the same value at positions 4, 5 and 6, all three get rank 5. This matters: assigning them 4, 5 and 6 in arbitrary order would inject a fake ordering and systematically inflate the coefficient.

Robustness follows directly from the ranking. In the sample data one salary of 260 sits among values in the forties to eighties — under Pearson it dominates the whole calculation, while under Spearman it is simply rank 14, contributing exactly as much as any other row.

The p-value is derived the same way as for Pearson, through a t statistic with n−2 degrees of freedom and the exact incomplete beta function. On very small samples this is an approximation for rho, and the result is best read as indicative rather than definitive.

Questions and answers

When should I choose Spearman over Pearson?

When your scatter plot shows a consistently rising or falling relationship that is not straight, when the data contains outliers you do not want to remove, or when the columns are rankings or ratings rather than measurements.

Why is my Spearman so different from my Pearson?

Usually one of two reasons: an outlier is inflating Pearson, or the relationship is curved. Compare them on the scatter plot — the disagreement between the two coefficients is itself diagnostic.

How are tied values handled?

They receive the average rank of the positions they span. This is the standard method and it prevents the arbitrary ordering of equal values from creating a correlation that is not there.

Can Spearman be used on ratings like 1 to 5?

Yes, and it is the right choice for them — Pearson assumes the distance from 1 to 2 equals the distance from 4 to 5, which is exactly the assumption a rating scale does not justify. Watch out for heavy ties, though.

Is anything uploaded?

No. Ranking and correlation both happen in your browser.

The opposite tool

Need it the other way round? Pearson correlation How strongly two columns move together, with a p-value

Related tools

All tools