Tested tool guide
Tested browser tools
Checked August 16, 2026
What K-Means Clustering Visualizer does, with a checked example
Each step exposes the two operations that K-means normally hides: assigning points to their nearest centroid and moving each centroid to the mean of its assigned points. The canvas shows those changes together with the centroids' Voronoi cells, and random initialization makes it possible to compare different starting arrangements. The important surprise is that K-means does not discover the number of clusters. It produces exactly the selected K, and different initial centroids can produce different final partitions.
Worked example
A concrete input and expected output from the current implementation.
Input
Set K to 1 and place points at (0, 0) and (2, 0).
->
Expected output
Both points belong to the single cluster, whose centroid is (1, 0). The visible plotting area is one Voronoi cell.
With K = 1, both points must share a cluster. Their coordinate mean is ((0 + 2) / 2, (0 + 0) / 2) = (1, 0), which confirms the displayed centroid.