Cosine Similarity Calculator

Measure the cosine of the angle between two 3D vectors.

Cosine similarity 0.9746
Angle (°) 12.933

Formula: cosθ = (a · b) ÷ (|a| |b|)

Step-by-step with your numbers:
1. Values used:
2. a₁ = 1
3. a₂ = 2
4. a₃ = 3
5. b₁ = 4
6. b₂ = 5
7. b₃ = 6
8.
9. Cosine similarity = 0.9746
10. Angle = 12.933°
Did we solve your problem today?

Cosine similarity rates how aligned two vectors are, widely used in search and machine learning.

How the Math Works

The cosine similarity calculator uses a fundamental formula from linear algebra: cosθ = (a · b) ÷ (|a| |b|). This equation calculates the cosine of the angle between two 3D vectors by taking their dot product (a · b) and dividing it by the product of their magnitudes (|a| and |b|). The dot product multiplies corresponding components and sums them, while the magnitude represents each vector's length calculated through the square root of squared components. This mathematical approach normalizes the comparison, producing a value between -1 and 1 that indicates directional alignment regardless of vector length.

Practical Applications

This calculator is invaluable for comparing directional similarity in various technical applications. In machine learning, it measures document similarity by treating text as vectors in high-dimensional space, where cosine values close to 1 indicate nearly identical meaning. Computer vision uses cosine similarity to compare feature descriptors when identifying objects across different images. In recommendation systems, it helps find users with similar preferences by comparing their rating vectors. Data scientists employ this tool for dimensionality reduction techniques and clustering algorithms where angle matters more than magnitude. It's also essential in natural language processing for semantic similarity analysis and information retrieval systems.

Day-to-Day Use

While you may not calculate cosine similarity manually every day, this concept influences many digital experiences you encounter daily. Your streaming services use it behind the scenes to recommend movies and shows you'll likely enjoy by comparing your viewing history with other users' patterns. Online shopping sites employ cosine similarity to suggest products based on your browsing and purchase behavior relative to similar customers. Social media platforms use it to curate your feed, showing content aligned with your interests. Search engines apply this principle to deliver more relevant results by understanding the semantic relationships between your queries and web pages. Even spam filters use cosine similarity to identify suspicious emails by comparing them to known spam patterns, making your digital interactions safer and more personalized.

Worked example

(1,2,3) and (4,5,6) → cosine similarity ≈ 0.974 (about 13°).

FAQ

Does magnitude matter?

No — cosine similarity ignores length and measures direction only.