Angle Between Two Vectors Calculator

Calculate the angle between two vectors in 2D or 3D space using the dot product formula. Visualize vectors on a 2D canvas, get step‑by‑step reasoning, dot product, magnitudes, cosine similarity, and the geometric interpretation.

Vector A (x, y, z)
Vector B (x, y, z)
✅ Right angle: A(4,0,0) , B(0,3,0)
? Acute 45°: A(3,0) , B(2,2)
? Obtuse 120°: A(1,0) , B(-1,1.732)
➡️ Parallel (0°): A(2,1) , B(4,2)
⬅️ Antiparallel (180°): A(1,2) , B(-2,-4)
? 3D example: A(1,2,2) , B(2,1,-1)
Privacy-first: all calculations run locally in your browser. No vector data leaves your device.

Mathematical Foundation: Angle Between Vectors

The angle between two vectors A and B is derived from the dot product formula: A · B = |A||B| cos θ. Therefore, θ = arccos( (A·B) / (|A||B|) ), where θ ∈ [0°, 180°]. This fundamental relation connects algebraic operations to geometric intuition. The dot product in ℝⁿ is computed as sum of component‑wise products: A·B = Σ aᵢbᵢ.

$$\cos \theta = \frac{\mathbf{A} \cdot \mathbf{B}}{\|\mathbf{A}\| \|\mathbf{B}\|} = \frac{a_x b_x + a_y b_y + a_z b_z}{\sqrt{a_x^2+a_y^2+a_z^2} \cdot \sqrt{b_x^2+b_y^2+b_z^2}}$$

This identity appears in countless disciplines: cosine similarity in data science (measures document similarity), work W = F·d in physics, lighting computations in computer graphics (Lambertian reflectance), and orthogonal projections in engineering.

Step-by-Step Calculation Logic

  1. Compute dot product: A·B = AₓBₓ + AᵧBᵧ + A₂B₂ (including all dimensions).
  2. Compute magnitudes: |A| = √(Aₓ² + Aᵧ² + A₂²), same for |B|.
  3. Cosine value: cosθ = (A·B) / (|A||B|). Numerical clipping ensures result lies in [-1,1] despite floating errors.
  4. Angle in degrees: θ = arccos(cosθ) in radians, then convert to degrees.
  5. Relation classification: if |cosθ| ≈ 1 → parallel or antiparallel; if |cosθ| < 1e-6 → orthogonal; else acute/obtuse.

Real-World Applications & Domain Authority

Machine Learning: Cosine Similarity

In text mining and recommendation engines, documents are represented as high‑dimensional vectors (TF-IDF). Cosine similarity between vectors gives a measure of orientation, ignoring magnitude. Two documents with similar content have an angle close to 0° (cosine ≈ 1). Our calculator above provides the same core metric — essential for data scientists and AI engineers.

Physics: Work and Force Decomposition

Work done by a constant force is W = F·d = |F||d| cosθ. Using our vector angle calculator, students can instantly find the angle between force and displacement vectors, validate experimental data, or solve inclined‑plane problems. The interactive graph clarifies why zero work occurs when θ = 90°.

Computer Graphics & Game Development

Shading models rely on the angle between light direction and surface normals. The Lambertian diffuse term max(0, N·L) uses dot product; this calculator helps debug 3D scenes, compute angles between camera and object vectors, and implement collision detection.

Why Our Vector Angle Calculator Stands Out

  • Dual 2D/3D support: Enter z components for full 3D calculation; the graph shows 2D projection but angle is computed correctly in three dimensions.
  • Interactive visual feedback: See vector arrows, angle arc, and coordinate axes — ideal for spatial learners and professionals.
  • Comprehensive results: Dot product, magnitudes, cosine similarity, projection magnitude, orthogonality check, and relation type.
  • Educational examples: Pre‑loaded configurations for right angle, acute, obtuse, parallel, antiparallel and 3D test cases.

Quick Reference Table of Vector Angles

Condition Angle (θ) Dot Product Example Vectors (2D)
Parallel (same direction) |A||B| (3,0) , (6,0)
Perpendicular (orthogonal) 90° 0 (2,0) , (0,5)
Acute 0° < θ < 90° positive (4,1) , (2,3)
Obtuse 90° < θ < 180° negative (-2,3) , (4,1)
Antiparallel 180° -|A||B| (1,2) , (-2,-4)

Historical Context & Vector Analysis

The concept of vectors and dot product emerged in the 19th century with Josiah Willard Gibbs and Oliver Heaviside. The geometric interpretation of cosine via dot product revolutionized physics and engineering. Hermann Grassmann's work laid the foundation for modern linear algebra. Today, the angle between vectors is a cornerstone of principal component analysis (PCA), correlation coefficients (cosine similarity equals Pearson correlation for centered vectors), and orthogonal frequency division multiplexing (OFDM) in telecommunications.

Frequently Asked Questions

The same dot product formula works for any dimension. Input X, Y, Z components for both vectors; our calculator automatically uses all three dimensions. The 2D graph projects vectors onto XY‑plane but the numeric result is fully 3D.

A zero vector has undefined direction; angle is not defined. The calculator detects zero magnitude and shows a warning. Always use non‑zero vectors for meaningful angles.

Cosine similarity is the cosine of the angle between two vectors; it ranges from -1 (opposite) through 0 (orthogonal) to 1 (identical direction). Often used in NLP to compare document embeddings.

Although our UI supports up to 3D, the underlying math generalizes to any dimension. For higher dimensions you may use the dot product formula manually, but our tool currently focuses on 2D/3D with interactive visualization.

Trusted academic foundation – This tool implements validated geometric algorithms from standard references: Anton, H. "Elementary Linear Algebra", Strang, G. "Linear Algebra and its Applications". The interactive canvas library follows best‑practices for vector rendering. Reviewed by the GetZenQuery Tech team – last update April 2026.

? References: Wolfram MathWorld: Dot Product; Wikipedia: Cosine Similarity.