Spearman’s rank correlation coefficient (ρ, or rs) measures how well the relationship between two variables can be described by a monotonic function, one that only goes up or only goes down. It ranks each variable and correlates the ranks, so it is robust to outliers and works with ordinal data. This calculator handles ties correctly and, unlike many online tools, gives you a p-value.
When to use Spearman’s correlation
- Ordinal variables such as rankings, Likert scales or grades.
- Numeric variables with outliers or a curved but consistently rising (or falling) relationship.
- Small samples where normality can’t be checked.
Calculation
- Rank the X values and the Y values separately. Tied values receive the average of the ranks they would occupy.
- Calculate Pearson’s correlation between the two sets of ranks. That is ρ.
- Test significance with t = ρ√(n − 2) ÷ √(1 − ρ²) on n − 2 degrees of freedom.
The shortcut formula ρ = 1 − 6Σd² ÷ (n(n² − 1)) is only exact when there are no ties. This calculator always uses the tie-correct method.
Worked example
For X = 1, 2, 2, 3, 4, 5, 5, 6 and Y = 2, 1, 3, 3, 5, 4, 6, 6 (several ties), ρ = 0.890 with p = .003, a very strong positive monotonic relationship.
Frequently asked questions
Spearman or Kendall?
Both are rank-based. Kendall’s τ is usually smaller in size, has a clearer probability interpretation and behaves better with many ties or small samples. Spearman’s ρ is more widely reported. The calculator shows both.
How do I report it in APA style?
“A Spearman correlation showed a strong positive relationship between X and Y, rs(6) = .89, p = .003.” The degrees of freedom are n − 2.