Cosine Similarity Calculator
Enter two vectors of the same length to find the cosine of the angle between them.
Write the numbers in brackets, like (1, 2, 3). Both vectors need the same length.
Write the numbers in brackets, like (4, 5, 6).
Result
You entered
Rounded to 6 decimal places.
Exact value
Angle between the vectors
Show the work
Dot product
Multiply the matching components of and and add the products.
Lengths of the vectors
The squared length of a vector is the sum of the squares of its components. Both lengths must be more than 0, or the angle between the vectors would not mean anything.
Cosine similarity
The cosine of the angle between two vectors is their dot product divided by the product of their lengths. It is 1 when they point the same way, 0 at right angles and when they point in opposite directions.
Result
So the cosine similarity is .