Vector Similarity

Compare cosine, Euclidean, and Manhattan on one pair.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter two vectors and see cosine similarity, Euclidean distance and Manhattan distance side by side. It is handy for choosing a metric for a vector search or clustering job, because the same pair can look close under one metric and far under another.

How to use

1
Step 1
Enter Vector A and Vector B.
2
Step 2
Press Calculate.
3
Step 3
Compare the three values.

How it works

Cosine measures the angle (direction), Euclidean measures straight-line distance and Manhattan sums absolute differences. Cosine is shown as the main answer. Use cosine for text embeddings, and Euclidean or Manhattan when magnitude matters.

Worked example

One pair, three metrics

Input
A = 1, 2, 3 B = 4, 6, 3
Output
Cosine 0.855482; Euclidean 5; Manhattan 7; dimensions 3
Walkthrough
Cosine says the vectors point in broadly similar directions (0.86), while the distances tell you they are 5 (L2) or 7 (L1) apart.

Limitations

  • Vectors must have equal length.
  • No dot product or other metrics such as Mahalanobis or Jaccard.

Questions

Which similarity metric should I use?
Cosine for most text embeddings; Euclidean or Manhattan when vector magnitude carries meaning.
Do all three metrics rank neighbours the same?
Not always. They agree for normalised vectors under cosine and Euclidean, but not in general.
Can I use it for embeddings?
Yes, paste two embedding vectors.
Where do I compute just one of them?
Use the cosine, Euclidean or Manhattan tools.

Features

  • Three metrics at once
  • Equal-length check
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Mean, Variance and Standard Deviation

    StatQuest with Josh Starmer

    Stats foundations behind many ML metrics tools.

    Watch on YouTube
  • Finding mean, median, and mode

    Khan Academy

    Baseline stats for accuracy and evaluation helpers.

    Watch on YouTube