Free tool · browser-only calculation

Cosine similarity and vector distance calculator

Calculate cosine similarity, dot product, distances and norms for two or more vectors, with a shareable similarity matrix. With guided examples and shareable.

How the calculation works

cos(u,v)=u⋅v∥u∥2∥v∥2cos(u,v)=\frac{u\cdot v}{\|u\|_2\|v\|_2}
Formula as plain textcos(u,v)=\frac{u\cdot v}{\|u\|_2\|v\|_2}

Cosine similarity compares vector direction rather than magnitude. The dot product is divided by both norms and ranges from −1 to 1: aligned directions approach 1, opposite directions −1 and orthogonal vectors 0.

Euclidean distance measures pointwise separation in space, while Manhattan distance sums absolute differences. Norms and distances serve different purposes: cosine is useful for embeddings and retrieval, while the others expose absolute separation.

With multiple vectors, the similarity matrix reveals related pairs and outliers. Inputs must have matching dimensions and zero vectors are rejected because cosine is undefined. The example uses known relations and can be shared through URL parameters.