Angle Between Two Vectors Calculator
Calculate the angle between two vectors in 2D or 3D space using the dot product formula. Get results in degrees and radians instantly.
About
Computing the angle between two vectors is a foundational operation in linear algebra, computer graphics, robotics, and physics simulations. The standard method relies on the dot product identity: θ = arccos(A ⋅ B|A| ⋅ |B|). Floating-point arithmetic can push the arccos argument outside the valid domain of [−1, 1], producing NaN results in naive implementations. This calculator clamps the ratio before evaluation. A zero-magnitude vector has no direction; attempting to normalize it causes division by zero. The tool detects this and reports the error explicitly rather than returning a misleading result.
Results are provided in both degrees and radians. The tool also reports the dot product, individual magnitudes, and the unit vectors for verification. Note: the formula returns the smallest angle between the two vectors (0° to 180°). It does not distinguish signed orientation. For signed angles in 2D, the atan2 of the cross product and dot product is required, which this tool also computes when in 2D mode.
Formulas
The angle between two vectors is derived from the geometric definition of the dot product.
Where the dot product in R3 expands to:
And the magnitude (Euclidean norm):
For 2D signed angle (counterclockwise positive from A to B):
Where θ = angle between vectors, A and B = input vectors, ai and bi = components of A and B, |A| = Euclidean norm of A.
Reference Data
| Configuration | Angle | Dot Product Sign | Geometric Meaning |
|---|---|---|---|
| Same direction | 0° | > 0 | Parallel, co-directional |
| Perpendicular | 90° | = 0 | Orthogonal |
| Opposite direction | 180° | < 0 | Anti-parallel |
| Acute angle | 0° - 90° | > 0 | Vectors point roughly same way |
| Obtuse angle | 90° - 180° | < 0 | Vectors point roughly apart |
| A = 0 | Undefined | N/A | Zero vector has no direction |
| Unit vectors | arccos(A ⋅ B) | Equals cos(θ) | Dot product directly gives cosine |
| 2D signed angle | −180° to 180° | N/A | Uses atan2(cross, dot) |
| Common Vector Pairs & Angles | |||
| i = (1,0,0), j = (0,1,0) | 90° | 0 | Standard basis, orthogonal |
| (1,1), (−1,1) | 90° | 0 | Perpendicular diagonals |
| (1,0), (1,1) | 45° | 1 | Half-quadrant separation |
| (3,4), (4,3) | ≈ 16.26° | 24 | Close but distinct directions |
| (1,2,3), (−1,−2,−3) | 180° | −14 | Exact opposites |
| (1,0,0), (1,1,1) | ≈ 54.74° | 1 | Axis vs. space diagonal |