Last updated October 13, 2026 · Report an error
The angle between two vectors can be found from their dot product and magnitudes, using the formula cos(θ) = (u·v)/(|u||v|). This works identically for both 2D and 3D vectors, since the dot product and magnitude formulas both extend naturally to any number of dimensions. This calculation shows up constantly wherever direction matters as much as size: physics uses it to find the angle between force and displacement vectors when computing work (W = |F||d|cosθ), computer graphics and game engines use it to determine lighting angles and whether a surface faces the camera, machine learning uses the closely related cosine similarity to compare document or embedding vectors, and structural engineering uses it to resolve forces acting at an angle to a beam or cable.
How it works
Choose 2D or 3D and enter both vectors' components. The calculator first computes the dot product u·v (multiplying corresponding components and summing them), then the magnitude of each vector (the square root of the sum of its squared components, by the Pythagorean theorem), and finally solves cos(θ) = (u·v)/(|u||v|) for θ by taking the arccosine of the result. Because dividing by each vector's own length cancels out any scaling, this formula returns the true angle between the vectors' directions regardless of how long either one is.
- Enter vector dimension.
- Enter u₁.
- Enter u₂.
- Enter u₃ (3D only).
- Enter v₁.
- Enter v₂.
- Enter v₃ (3D only).
- Click Calculate to see your results.
Examples
u=(1,0), v=(0,1)
The dot product is (1×0)+(0×1) = 0, so cos(θ) = 0/(1×1) = 0, and θ = arccos(0) = 90° — the vectors are perpendicular.
u=(3,4), v=(4,3)
The dot product is (3×4)+(4×3) = 24. Both magnitudes are √(3²+4²) = 5, so cos(θ) = 24/(5×5) = 0.96, and θ = arccos(0.96) ≈ 16.26°.
u=(1,1,0), v=(1,0,1) (3D)
The dot product is (1×1)+(1×0)+(0×1) = 1. Both magnitudes are √2, so cos(θ) = 1/(√2×√2) = 1/2, and θ = arccos(0.5) = 60°.
Common mistakes to avoid
- Forgetting to fill in the z-component when switching to 3D mode, silently treating the vector as if it lies flat in the xy-plane.
- Confusing the dot product (which returns a single number, used here) with the cross product (which returns another vector and is only defined in 3D).
- Assuming a negative dot product means the vectors point in exactly opposite directions — it only means the angle exceeds 90°, not that it equals 180°.
- Trying to compute an angle involving a zero vector, which has no defined direction and therefore no meaningful angle to anything else.