# Cosine Similarity Calculator

URL: https://speedycalculator.com/calculators/math/cosine-similarity/
Last updated: 2026-10-30

> The cosine similarity calculator measures how similar the directions of two vectors are (−1 to 1), with the angle between them and the cosine distance, for vectors of 2 to 10 dimensions.

## Inputs

- Vector length (dimension)
- a₁
- b₁
- a₂
- b₂
- a₃
- b₃
- a₄
- b₄
- a₅
- b₅
- a₆
- b₆
- a₇
- b₇
- a₈
- b₈
- a₉
- b₉
- a₁₀
- b₁₀

## Results

- Cosine similarity S_C
- Angle θ between the vectors
- Cosine distance D_C
- Dot product a · b

## Formula

```
S_C = (a · b) ÷ (‖a‖ ‖b‖),  θ = arccos S_C,  D_C = 1 − S_C
```

## Explanation

Cosine similarity ignores length and compares direction. It is the standard way to compare documents (word-count vectors), user preferences in recommendation systems and embeddings in machine learning.

### How to use the Cosine Similarity Calculator

- **Vector length (dimension)**
- **a₁**
- **b₁**
- **a₂**
- **b₂**
- **a₃**
- **b₃**
- **a₄**
- **b₄**
- **a₅**
- **b₅**
- **a₆**
- **b₆**
- **a₇**
- **b₇**
- **a₈**
- **b₈**
- **a₉**
- **b₉**
- **a₁₀**
- **b₁₀**

Results update as you type, and everything is calculated in your browser.

### How it works

The dot product is divided by the product of the vector lengths. 1 means the same direction, 0 means perpendicular (unrelated) and −1 means opposite.

### Inputs explained

FieldWhat to enterVector length (dimension)Choose one: 2, 3, 4, 5 …a₁A numberb₁A numbera₂A numberb₂A numbera₃A numberb₃A numbera₄A numberb₄A numbera₅A numberb₅A numbera₆A numberb₆A numbera₇A numberb₇A numbera₈A numberb₈A numbera₉A numberb₉A numbera₁₀A numberb₁₀A number

### Example values

How the main result changes when **a₁** changes and everything else stays at the example values above:

a₁Cosine similarity S_C0.50.3560.750.39810.43851.250.47721.50.51420.5813

## Worked example

Inputs — Vector length (dimension): 3; a₁: 1; b₁: 2; a₂: 3; b₂: 1; a₃: 4; b₃: 0.

Results — **Cosine similarity S_C = 0.438529**; Angle θ between the vectors = 63.9899 °; Cosine distance D_C = 0.561471; Dot product a · b = 5.

## Key terms

- **Cosine similarity**: The cosine of the angle between two vectors.

## FAQ

**What does a cosine similarity of 0 mean?**
The vectors are perpendicular – no similarity in direction.

**Why ignore vector length?**
A long and a short document on the same topic should be similar.

**Can cosine similarity be negative?**
Yes, down to −1 for opposite directions; with non-negative data (word counts) it stays between 0 and 1.

**Is cosine distance a true metric?**
Not strictly – it can violate the triangle inequality.


## Sources

- [OpenStax – Calculus Volume 3](https://openstax.org/details/books/calculus-volume-3)
- [Wolfram MathWorld – Vector](https://mathworld.wolfram.com/Vector.html)
