Embedding Cosine Similarity
Free cosine similarity calculator for vectors. Compute embedding similarity and angle locally in your browser with no upload, no account, no API calls.
Runs locally in your browser. Your input is not uploaded to DevToolMate servers.
No embedding API
Paste JSON arrays or comma-separated numbers of equal length. No embedding API is called.
Developer Quick Tips
- Paste JSON arrays or comma-separated numbers; both vectors must be equal length and non-zero for accurate cosine similarity results.
- Use this calculator to validate embedding pairs and set similarity thresholds before indexing into Elasticsearch or vector databases.
- Output includes cosine similarity (0-1 range), approximate angle in degrees, and dimension count, all computed locally in your browser.
- Verify cosine similarity thresholds for semantic search and RAG retrieval before deploying to production systems.
- Supports vectors up to 16,384 dimensions within browser memory limits; no server upload or external API calls.
Frequently asked questions
How do I use a cosine similarity calculator for vectors?
Paste two vectors as JSON arrays (e.g., [0.1, 0.2, 0.3]) or comma-separated numbers into the input fields. Both vectors must have equal length. Click compute or press Ctrl/Cmd + Enter. The tool returns cosine similarity, approximate angle in degrees, and dimension count, all calculated locally in your browser.
What is cosine similarity for embedding vectors?
Cosine similarity measures the angle between two vectors, ranging from -1 to 1 (or 0 to 1 for normalized embeddings). Developers use it to validate embedding quality, tune semantic search thresholds, and verify vector similarity before deploying to production systems.
How do I calculate cosine similarity for Elasticsearch?
Compute cosine similarity here to validate embedding pairs and set appropriate similarity thresholds before configuring Elasticsearch dense_vector fields. This helps you tune retrieval quality and recall for semantic search and recommendation systems.
What is cosine distance and how does it relate to similarity?
Cosine distance is 1 minus cosine similarity. If cosine similarity is 0.8, cosine distance is 0.2. Both measure vector alignment; use similarity for ranking (higher is better) and distance for clustering algorithms that minimize distance.
Can I validate embeddings from OpenAI or Anthropic before indexing?
Yes. Export embedding vectors from your API response, paste them here, and verify the cosine similarity matches your expected threshold for semantic search or clustering. This is useful for validating RAG pipelines before indexing into vector databases.
Does this tool generate embeddings from text?
No. This tool computes similarity between numeric vectors you provide. To generate embeddings from text, use an external API (OpenAI, Anthropic, Hugging Face, etc.), then paste the resulting vectors here to measure their similarity.
Is my input uploaded or stored?
No. All vector math runs locally in your browser. Input is not uploaded to DevToolMate servers, external APIs, or stored after you close the tab. No account or login required.
Related tools
- Token Counter: Free token counter and content length calculator. Estimate prompt tokens and string length locally in your browser with character, word, and byte counts. No upload, no account.
- JSON Formatter: Online JSON formatter - beautify and format JSON in your browser with adjustable indentation and key sorting. Free, no upload, no account.