Silhouette Score Calculator
Paste your data points and cluster labels to get the silhouette score, the per-cluster means, and the full a(i)/b(i)/s(i) working for every point — with misassigned points flagged. Matches scikit-learn silhouette_score. No signup, nothing uploaded.
How it works
The silhouette score measures how well each point fits its assigned cluster compared with the nearest neighbouring cluster. It needs no ground-truth labels, which makes it an internal validity index — the standard way to judge a k-means, hierarchical, or DBSCAN result, and to compare different choices of k. It was introduced by Peter Rousseeuw in 1987 and is what scikit-learn returns from silhouette_score.
For a point i in cluster C, the tool computes three quantities:
- a(i) — cohesion. The mean distance from i to every other point in its own cluster:
a(i) = (1 / (|C| − 1)) · Σ d(i, j)over j in C, j ≠ i. Lower is better — the point is close to its cluster-mates. - b(i) — separation. For every other cluster C′, take the mean distance from i to all of its points, then keep the smallest:
b(i) = min over C′ of (1 / |C′|) · Σ d(i, j). That nearest rival cluster is the one the point would most plausibly belong to instead. - s(i) — the silhouette.
s(i) = (b(i) − a(i)) / max(a(i), b(i)), which falls between −1 and 1. Near 1 means the point is far from other clusters and snug in its own; near 0 means it sits on a boundary; negative means it is closer to a neighbour and probably misassigned. A point alone in its cluster getss(i) = 0by convention.
The overall score is the plain average of s(i) across all N points. Distance d(·,·) is Euclidean √(Σ (xₖ − yₖ)²) by default — matching scikit-learn — or Manhattan Σ |xₖ − yₖ| when selected. The computation is O(N²) in the number of points, which stays instant in the browser for the few-thousand-point inputs this tool accepts. As a credibility check it also recomputes the score a second way — as the size-weighted average of the per-cluster mean silhouettes — and confirms the two routes agree. To read the result, common practice (Kaufman & Rousseeuw, 1990) treats above 0.70 as strong structure, 0.51–0.70 as reasonable, 0.26–0.50 as weak or artificial, and 0.25 or below as no substantial structure.
Worked examples
Frequently asked questions
Sources & references
- scikit-learn — sklearn.metrics.silhouette_score and silhouette_samples (the (b − a) / max(a, b) definition, the [-1, 1] range, and the single-point convention)
- Rousseeuw, P.J. (1987) — Silhouettes: a graphical aid to the interpretation and validation of cluster analysis (the original a(i), b(i), s(i))
- Kaufman, L. & Rousseeuw, P.J. (1990) — Finding Groups in Data (the strong / reasonable / weak / none interpretation bands)
The formulas on this page were last cross-checked against these sources on 2026-06-11. The silhouette score is a stable mathematical definition, so this tool needs no rate or schedule updates — only the worked examples are periodically re-reconciled against scikit-learn.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.