Cosine Similarity Calculator
Paste two vectors or embeddings to compute their cosine similarity, dot product, Euclidean and Manhattan distance, magnitudes, and the angle between them. Numbers can be separated by commas, spaces or newlines, or pasted as a JSON array. Everything runs in your browser.
What is cosine similarity? Read the guide →
0 dimensions
0 dimensions
How to use the cosine similarity calculator
- Paste two vectors as comma- or space-separated numbers. They must have the same number of dimensions.
- Read the cosine similarity, along with the dot product and magnitudes used to compute it.
- It all runs in your browser, so you can check embeddings without sending them anywhere.
What cosine similarity measures
Cosine similarity is the cosine of the angle between two vectors: their dot product divided by the product of their magnitudes. Because it looks only at direction, not length, it tells you how aligned two vectors are regardless of their scale. The result ranges from 1 (pointing the same way) through 0 (perpendicular, unrelated) to -1 (opposite).
Why it's everywhere in AI
Embedding models turn text, images or audio into vectors where similar meanings point in similar directions. Comparing those vectors with cosine similarity is how semantic search, recommendation systems and retrieval-augmented generation (RAG) decide what is "most related" to a query. It is preferred over plain distance because it ignores vector length, which often reflects nothing about meaning.
For a plain-English walkthrough from vectors to RAG, read what are embeddings? Cosine similarity explained.
How to read the score
Mathematically the scale runs from -1 to 1, but real embedding scores cluster in a much narrower band: with many modern models, even unrelated sentences score around 0.6–0.7, and negative values essentially never appear for natural text. So do not read 0.75 as "75% similar" — judge scores relative to each other, from the same model. When comparing candidates against one query, the ranking is what matters; when you need an absolute cutoff (for example deduplication), calibrate it by measuring pairs you know are duplicates versus merely related.
Reading the other numbers
The calculator also shows the pieces behind the score. The dot product equals the cosine similarity whenever both magnitudes are 1 — a quick way to check whether your embedding API returns pre-normalized vectors (‖A‖ and ‖B‖ will read 1). The angle is the same information as the cosine in degrees, which some people find easier to picture. Euclidean (L2) and Manhattan (L1) distances are the length-sensitive alternatives — useful when magnitude genuinely carries meaning, which for text embeddings it usually doesn't.
Where you'd use this
Working with embeddings: checking whether two pieces of text are semantically close, debugging a retrieval step that returns irrelevant results, or picking a similarity threshold.
For example: Your search returns odd matches. Comparing the query embedding against two documents gives 0.91 and 0.42 — confirming the retriever is working and the problem is the cutoff, which is currently letting the 0.42 result through.
Frequently asked questions
What does cosine similarity measure?
It measures the angle between two vectors, giving a score from -1 to 1 where 1 means the same direction. It is widely used to compare text embeddings and recommendations.
Why use cosine similarity instead of distance?
Cosine similarity ignores vector magnitude and focuses on orientation, so it compares the direction of embeddings rather than their length — usually what you want for semantic similarity.
What is a good cosine similarity score for embeddings?
There is no universal threshold — scores are model-relative, and with many modern embedding models even unrelated text scores 0.6–0.7. Compare scores from the same model against each other, and calibrate any cutoff on pairs you know are related and unrelated.
Can I compare embeddings from two different models?
No. Vectors from different embedding models live in unrelated coordinate systems, so the cosine between them is meaningless even when the dimensions match. Re-embed all texts with the same model before comparing.
Is my data uploaded?
No. The calculation runs entirely in your browser.