# Cosine Similarity

> A score that says how alike two vectors are, by their angle.

**Field:** Artificial Intelligence  
**Category:** Retrieval & Search  
**Also known as:** Cosine Distance, Cosine Score

## Think of it like

Think of it like two arrows. If they point the same way, the things they stand for are alike.

## Definition

Cosine similarity measures how alike two vectors are by the angle between them, not their length. The score runs from 1, pointing the same way, through 0, at right angles, to minus 1, pointing opposite ways. For embeddings, a higher score means closer meaning. It is the most common way to compare embeddings in search. When vectors are scaled to length 1, it gives the same result as the dot product.

## Example

Lucy compares 'cheap flights' with 'low-cost air travel' and gets 0.89. With 'chocolate cake' she gets 0.12.

## Why it matters

It is the number behind most AI search. It decides which texts count as close.

## Common mistake

Reading a score as a percent of sameness. A score of 0.8 does not mean 80 percent the same, and good cut-offs differ by model.

## Three principles

- **Angle, not length.** Direction is what counts.
- **From 1 to minus 1.** Higher is closer.
- **Cut-offs vary.** Each model has its own.

## Related terms

- [Embedding (AI)](https://learn.benibix.com/term/ai/embedding)
- [Dot Product](https://learn.benibix.com/term/general/dot-product)
- [Nearest Neighbor Search](https://learn.benibix.com/term/ai/nearest-neighbor-search)
- [Vector](https://learn.benibix.com/term/general/vector)

## Told apart from

- [Cosine Similarity vs Dot Product](https://learn.benibix.com/compare/cosine-similarity-vs-dot-product): People often think cosine similarity and the dot product always put results in the same order. They do not, and length is the reason. The dot product grows with how long the vectors are, not just their angle. Cosine similarity looks at the angle alone. So the two agree only when each vector has a length of 1. Many embedding models do that, but some do not.

![Three pairs of arrows from one point. A narrow angle scores near 1, a right angle scores 0, and arrows pointing opposite ways score minus 1.](https://learn.benibix.com/diagrams/rt-cosine-similarity.svg)

---

Source: https://learn.benibix.com/term/ai/cosine-similarity
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
