Vector Similarity
Compare cosine, Euclidean, and Manhattan on one pair.
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
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?
Do all three metrics rank neighbours the same?
Can I use it for embeddings?
Where do I compute just one of them?
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 YouTubeFinding mean, median, and mode
Khan Academy
Baseline stats for accuracy and evaluation helpers.
Watch on YouTube
- Machine Learning Crash Course
Google Developers
Official ML crash course pairing with metric calculators.
- Metrics and scoring
scikit-learn
Precision, recall, F1 definitions used by AI metric tools.