Cosine Similarity Calculator (Vectors & Text)
Compute cosine similarity, dot product and Euclidean distance between two vectors or embeddings, or compare two texts with a bag-of-words model.
🔒 Processed locally in your browser — we don’t upload your input.
How to use the Cosine Similarity
Cosine similarity measures how closely two vectors point in the same direction, regardless of their length. It is the standard way to compare embeddings in semantic search, recommendation systems and RAG retrieval. This calculator accepts two vectors as comma- or space-separated numbers, or as JSON arrays copied straight from an embeddings API response, and returns the cosine similarity, the dot product, Euclidean distance and the magnitude of each vector.
If the vectors have different lengths the tool tells you instead of silently producing a wrong answer, a common bug when mixing embeddings from different models. Values near 1 mean very similar direction, around 0 means unrelated, and negative values mean opposite directions. Remember that similarity scores are only comparable between embeddings from the same model.
A second mode compares two pieces of plain text using a simple term-frequency (bag-of-words) vector, with optional stop-word removal. It is not a substitute for neural embeddings but is handy for teaching, quick duplicate detection and checking how lexical overlap differs from semantic similarity. All calculations run in your browser.
Frequently asked questions
What does a cosine similarity of 0.8 mean?
The vectors point in a very similar direction. Thresholds depend on the embedding model.
Can I paste embeddings from an API?
Yes, paste JSON arrays or comma-separated numbers.
Why must vectors have the same length?
Cosine similarity is defined element by element, so both need the same dimension.
Is text mode the same as AI embeddings?
No, it uses word counts. It measures word overlap, not meaning.
About this tool
Compute cosine similarity, dot product and Euclidean distance between two vectors or embeddings, or compare two texts with a bag-of-words model. People also look for: cosine similarity calculator, embedding similarity, vector similarity, text similarity.
Related searches