...
📐 Vector Mathematics

Angle Between Two Vectors Calculator

Calculate the angle between any two vectors in 2D or 3D — with step-by-step working, interactive visualizer, dot product, magnitudes, and real-world interpretation. Supports degrees, radians, and gradians.

2D & 3D
Dimensions
cos⁻¹
Dot product formula
° rad grad
3 angle units
Step-by-step
Full working shown
Dimension Mode
Vector A
Vector B
Quick examples — click to load
Angle between vectors
°
Degrees
Radians
Gradians
📐
Acute Angle The vectors form an acute angle.
Dot Product (A·B)
|A| Magnitude
|B| Magnitude
cos(θ)
📊 Vector Diagram (2D projection)
A B θ

📝 Step-by-step solution

Enter multiple vector pairs to calculate all angles at once. Each row represents one pair (Ax, Ay, Az, Bx, By, Bz).

Aₓ
Ay
Az
Bₓ
By
Bz

Common angle values and their relationship to vector alignment — an essential quick reference for physics, engineering, and computer graphics.

Angle (°)Radianscos(θ)Vector RelationshipApplication
01Perfectly parallel (same direction)Force in same direction
30°π/6 ≈ 0.5236√3/2 ≈ 0.866Slight divergence30° incline projection
45°π/4 ≈ 0.78541/√2 ≈ 0.707Diagonal alignmentEqual x/y components
60°π/3 ≈ 1.04720.5Significant divergenceEquilateral triangle edges
90°π/2 ≈ 1.57080Perfectly perpendicularOrthogonal axes, right angle
120°2π/3 ≈ 2.094−0.5Obtuse, partial oppositionHexagonal lattice vectors
135°3π/4 ≈ 2.356−1/√2 ≈ −0.707Strongly opposedReflection vectors
150°5π/6 ≈ 2.618−√3/2 ≈ −0.866Nearly antiparallelObtuse force resolution
180°π ≈ 3.1416−1Perfectly antiparallel (opposite)Opposing forces

The dot product formula: A·B = |A||B|cos(θ). When cos(θ) = 0, vectors are perpendicular. When cos(θ) = 1, they are parallel. When cos(θ) = −1, they are antiparallel.

What Is the Angle Between Two Vectors?

The angle between two vectors is the measure of rotation needed to align one vector with the other, measured through the shorter arc — always between 0° and 180°. It is one of the most fundamental quantities in vector mathematics, with applications spanning physics, computer graphics, machine learning, robotics, and engineering.

Unlike the angle between two lines, the angle between vectors is directional-aware: a vector has both magnitude (length) and direction. Two vectors pointing in exactly the same direction have an angle of 0°. Two vectors pointing in exactly opposite directions have an angle of 180°. Two vectors that are perpendicular to each other form a 90° angle — and this case has special mathematical significance: their dot product is exactly zero.

Understanding this angle tells you something deep about the relationship between two quantities. In physics, it tells you how efficiently one force projects onto another. In machine learning, it is the basis of cosine similarity — how similar two documents, embeddings, or feature vectors are. In computer graphics, it determines how light reflects off a surface.

The Formula: Dot Product and Arc Cosine

The standard formula uses the dot product (also called scalar product or inner product) of two vectors, combined with the product of their magnitudes:

θ = arccos( A·B / (|A| × |B|) )

Where: A·B = AₓBₓ + AyBy + AzBz (dot product)
|A| = √(Aₓ² + Ay² + Az²) (magnitude of A)
|B| = √(Bₓ² + By² + Bz²) (magnitude of B)

The formula works identically in 2D and 3D — in 2D, simply set the z-components to zero. The result of the arccos function always falls in the range [0°, 180°], which is why the formula gives the smallest angle between the two vectors regardless of their orientation.

One important property: the formula is scale-invariant. Doubling the length of either vector does not change the angle between them. This is because both the dot product and the magnitudes scale proportionally, cancelling out. What matters is the direction of the vectors, not their length.

Step-by-Step: How to Calculate the Angle

Let’s work through a complete example: A = (3, 4, 0) and B = (4, 3, 0) in 2D.

1️⃣

Calculate the Dot Product

A·B = (3)(4) + (4)(3) + (0)(0) = 12 + 12 + 0 = 24

2️⃣

Calculate |A|

|A| = √(3² + 4² + 0²) = √(9 + 16) = √25 = 5

3️⃣

Calculate |B|

|B| = √(4² + 3² + 0²) = √(16 + 9) = √25 = 5

4️⃣

Apply Arccos

θ = arccos(24 / (5 × 5)) = arccos(24/25) = arccos(0.96) = 16.26°

Special Angle Cases and What They Mean

AngleDot ProductVector RelationshipReal-world Meaning
= |A||B|Parallel (same direction)Force fully applied in same direction; 100% work done
0° < θ < 90°> 0Acute anglePartial alignment; positive projection
90°= 0Perpendicular / OrthogonalNo shared component; zero work done; uncorrelated
90° < θ < 180°< 0Obtuse anglePartial opposition; negative projection
180°= −|A||B|Antiparallel (opposite)Perfectly opposing; force cancels completely

2D vs 3D Vector Angles

The angle formula works the same way in both 2 and 3 dimensions — the key difference is the number of components involved in the dot product and magnitude calculations. In 2D, you only have x and y components. In 3D, the z-axis adds a third dimension that can significantly change the angle.

Consider two vectors that appear perpendicular when viewed from above (in the xy-plane) but actually point in completely different directions in 3D space. Adding the z-component can make vectors that seemed parallel from one viewpoint actually form an angle of 45° or more. This is why 3D calculations are critical in fields like robotics (joint angles), 3D graphics (surface normals), and aerospace navigation (orientation of aircraft or spacecraft).

In our calculator, simply leave z as 0 for 2D calculations, or enable 3D mode and fill in all three components for full three-dimensional analysis.

Real-World Applications

Physics: Work and Force

Work = F·d = |F||d|cos(θ). The angle between force and displacement vectors determines how much work is done. At 90°, no work is done regardless of force magnitude.

🎮

Computer Graphics

The angle between a surface normal and light direction (dot product shading) determines pixel brightness in 3D rendering. Phong lighting and ray tracing both rely on this formula millions of times per frame.

🤖

Machine Learning

Cosine similarity (1 − θ/180°) measures how similar two text embeddings, recommendation vectors, or feature spaces are. It’s the foundation of most recommendation systems and semantic search.

🛸

Navigation & Robotics

The angle between a robot’s current heading vector and its target vector determines the turning angle needed. Used in path planning, drone navigation, and servo control systems.

🔬

Crystallography

Angles between lattice vectors define the geometry of crystal structures. The dot product formula determines bond angles and dihedral angles in molecular modelling.

📡

Signal Processing

Signal correlation and filter design use the angle between frequency-domain vectors. Orthogonal signals (90°) do not interfere with each other — the basis of OFDM in WiFi and 5G.

Cosine Similarity vs Angle Between Vectors

These two concepts are closely related but different. The angle between vectors gives you a value in degrees or radians between 0 and 180. Cosine similarity gives you the cosine of that angle — a value between −1 and 1.

Cosine similarity = cos(θ) = A·B / (|A||B|). When cosine similarity is 1, the vectors are identical in direction. When it is 0, they are perpendicular. When it is −1, they point in opposite directions. In natural language processing and information retrieval, cosine similarity is usually preferred over the raw angle because it is more computationally efficient and its scale (−1 to 1) is directly interpretable.

The relationship between the two is: θ = arccos(cosine similarity), which is exactly the formula our calculator uses.

What Happens with Zero Vectors?

A zero vector (a vector where all components are 0) has no defined direction, and therefore the angle between a zero vector and any other vector is mathematically undefined. Attempting to compute it leads to division by zero in the formula, since |A| = 0. Our calculator detects this automatically and alerts you rather than returning NaN or an incorrect result.

This edge case matters in programming and simulation: always check for zero-length vectors before calling an angle calculation function, or your code may produce NaN values that propagate silently through subsequent computations.

Frequently Asked Questions

Can the angle between two vectors be greater than 180°?

No. The arccos function always returns a value in the range [0°, 180°]. The angle between two vectors is defined as the smallest angle between them, which is never more than 180°. If you need a directed angle (where 270° is distinct from 90°), you need a signed angle calculation, which requires knowing which axis to rotate around — typically using atan2 in 2D or the cross product in 3D.

Does vector magnitude affect the angle?

No. The angle between two vectors is determined entirely by their direction, not their length. The vectors (1, 0) and (100, 0) point in the same direction and have an angle of 0° between them, just as (1, 0) and (1, 0) do. This is because the magnitude terms cancel in the denominator of the formula. However, a zero-length vector has no defined direction and the angle is undefined.

What does it mean when the dot product is zero?

When A·B = 0, the vectors are orthogonal (perpendicular), and the angle between them is exactly 90°. This is one of the most important results in linear algebra. Orthogonal vectors have zero projection onto each other — they share no component. In physics, this means a force applied perpendicular to displacement does no work. In signal processing, orthogonal signals can be transmitted simultaneously without interference.

How is this different from the angle between two lines?

Lines have no direction — they extend infinitely in both ways. The angle between two lines is always between 0° and 90° (the acute angle). Vectors have direction, so their angle ranges from 0° to 180°. Two lines at 120° can be described as two vectors at 120° (obtuse) or as two lines at 60° (acute, since lines extend both ways). When calculating angles between vectors, direction matters.

What is the cross product, and how does it relate to the angle?

The cross product A×B of two 3D vectors produces a vector perpendicular to both, with magnitude |A||B|sin(θ). While the dot product uses cos(θ), the cross product uses sin(θ). Together: A·B = |A||B|cos(θ) and |A×B| = |A||B|sin(θ). You can use atan2(|A×B|, A·B) to get the signed angle in 3D, which is more numerically stable than arccos alone for angles near 0° or 180°.

How do I find the angle if I have unit vectors?

Unit vectors have magnitude 1, so the formula simplifies significantly: θ = arccos(A·B), since |A| = |B| = 1 and the denominator equals 1. This is why machine learning libraries often normalise embeddings to unit length before computing cosine similarity — it reduces the calculation to a single dot product with no division required.

Scroll to Top
Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.