Home / Tools / Cosine similarity calculator

Cosine similarity calculator

Embeddings turn text into lists of numbers, and search and RAG systems find matches by comparing those lists. Paste two vectors to get the cosine similarity and the other common measures.

  • AI tool
  • Runs in your browser
  • Tested 19 November 2026
  • Sources
Numbers separated by commas or spaces. Square brackets from Python or JSON are fine.

The measures

  • Cosine similarity = A · B / (|A| × |B|), the cosine of the angle between the two vectors. It ignores length and only compares direction. It runs from −1 (opposite) through 0 (unrelated, at right angles) to 1 (same direction).
  • Dot product = the sum of ai × bi. For vectors already scaled to length 1, which many embedding models return, it equals the cosine similarity and is quicker to compute.
  • Euclidean distance is the straight-line distance between the two points. For length-1 vectors it's √(2 − 2 cos θ), so it ranks results in the same order as cosine similarity.
  • Manhattan distance adds up the absolute differences in each dimension.
Worked example. For A = [1, 2, 3] and B = [4, 5, 6], the dot product is 32, the lengths are 3.742 and 8.775, so the cosine similarity is 32 ÷ (3.742 × 8.775) = 0.9746, an angle of 12.9°. The Euclidean distance is √27 = 5.196.

Reading the numbers

There's no universal threshold for "similar". Each embedding model spreads its scores differently, and with some models even unrelated texts score well above 0. Compare scores from the same model, and judge them by ranking, not by a fixed cut-off. Never compare vectors from two different embedding models: their dimensions mean different things, even when the lengths match.

Real embeddings have hundreds or thousands of dimensions. You can paste them in full, and nothing leaves your browser.

Sources

Where the formulas and figures on this page come from. We test every tool against worked examples from these before publishing.