Home · Math · Trigonometry · Cosine Similarity Calculator
Cosine Similarity Calculator
Cosine similarity measures how closely two vectors point in the same direction, from −1 (opposite) to 1 (identical direction).
What this calculator does
Cosine similarity measures how closely two vectors point in the same direction, from −1 (opposite) to 1 (identical direction). Every figure on this page is computed from the formula or definition stated below, with no hidden rounding steps, and the method notes name the exact convention where more than one exists.
The formula and method
Enter both vectors as comma-separated lists of the same length. The dot product is divided by the product of the vector lengths, so the result depends only on direction, not on how large the vectors are. A value of 0 means the vectors are perpendicular.
Worked example
With the example inputs this page opens with, the result is 0.9746 — cosine similarity. Change any figure and the result updates with the same formula.
Quick reference
| Figure | Value |
|---|---|
| Cosine similarity | 0.9746 |
| Dot product A · B | 32.00 |
| Magnitude |A| | 3.74 |
| Magnitude |B| | 8.77 |
Computed with the same formulas as the calculator above — enter any values there for figures beyond this table.
Common questions
How does the Cosine Similarity Calculator work?
Cosine similarity measures how closely two vectors point in the same direction, from −1 (opposite) to 1 (identical direction). Vector A, vector B → Cosine similarity, dot product, magnitudes. The result updates as you type, and the formula and method on this page state the exact definitions used, so you can reproduce the calculation by hand.
What inputs does the Cosine Similarity Calculator need?
Vector A, vector B → Cosine similarity, dot product, magnitudes. Invalid entries — such as a zero denominator, an out-of-range value or a malformed list — produce a plain-language message instead of a misleading number.
Is the Cosine Similarity Calculator free to use?
Yes. It runs entirely in your browser with no sign-up, and the same calculator is available as an embeddable widget via the Embed button, so it can be placed on another site with its calculation intact.