What This Calculator Does
The Angle Between Two Vectors Calculator finds the angle separating two vectors in two or three dimensions. Enter the X, Y, and (optionally) Z components of each vector and the tool returns the angle in both degrees and radians, along with the dot product, the magnitude of each vector, and the cosine of the angle. It works for any direction in space and is widely used in physics, engineering, computer graphics, and linear algebra.
How to Use It
Type the components of Vector A in the first row and Vector B in the second row. For 2D vectors, leave the Z fields empty or set them to 0. Click calculate to see the angle. The result is always between 0° and 180° because the inverse cosine of the dot-product ratio returns a non-negative angle.
The Formula Explained
The dot product of two vectors equals the product of their magnitudes times the cosine of the angle between them: $$\vec{a}\cdot\vec{b} = \lVert\vec{a}\rVert\,\lVert\vec{b}\rVert\cos\theta$$ Rearranging gives $$\theta = \arccos\left(\frac{\vec{a}\cdot\vec{b}}{\lVert\vec{a}\rVert\,\lVert\vec{b}\rVert}\right)$$ The dot product is computed as \(a_x b_x + a_y b_y + a_z b_z\), and each magnitude is the square root of the sum of its squared components. If either vector has zero length the angle is undefined, so the calculator guards against division by zero.
Worked Example
Take A = (1, 0, 0) and B = (1, 1, 0). The dot product is $$1\times1 + 0\times1 + 0\times0 = 1$$ The magnitudes are \(\lVert A\rVert = 1\) and \(\lVert B\rVert = \sqrt{2} \approx 1.4142\). So \(\cos\theta = 1 / 1.4142 \approx 0.7071\), and $$\theta = \arccos(0.7071) = 45^\circ$$ (about 0.7854 radians).
Interpreting Your Result
The angle \(\theta\) returned by this calculator ranges from \(0^\circ\) to \(180^\circ\) (\(0\) to \(\pi\) radians). Because the magnitudes \(\lVert\vec{A}\rVert\) and \(\lVert\vec{B}\rVert\) are always positive, the sign of the cosine matches the sign of the dot product. That single fact tells you the geometric relationship at a glance:
| Angle \(\theta\) | \(\cos\theta\) | Dot product \(\vec{A}\cdot\vec{B}\) | Geometric meaning |
|---|---|---|---|
| \(0^\circ\) | \(+1\) | Positive (maximum) | Same direction — vectors are parallel |
| \(0^\circ\)–\(90^\circ\) | Between \(0\) and \(+1\) | Positive | Acute angle — vectors point the same general way |
| \(90^\circ\) | \(0\) | Zero | Orthogonal (perpendicular) |
| \(90^\circ\)–\(180^\circ\) | Between \(-1\) and \(0\) | Negative | Obtuse angle — vectors oppose in general direction |
| \(180^\circ\) | \(-1\) | Negative (minimum) | Opposite direction — anti-parallel |
Quick reading rule: a positive dot product means an acute angle, a zero dot product means a right angle, and a negative dot product means an obtuse angle. The closer \(\cos\theta\) is to \(\pm 1\), the closer the vectors are to lying along the same line.
Definitions & Glossary
- Vector
- A quantity with both magnitude and direction, written as an ordered list of components such as \(\vec{A}=(A_x, A_y, A_z)\).
- Vector component (x / y / z)
- The projection of a vector onto a coordinate axis. \(A_x\), \(A_y\) and \(A_z\) are the amounts the vector extends along the x-, y- and z-axes respectively. For a 2D vector, set \(A_z = 0\).
- Dot product (scalar product)
- A single number formed from two vectors: \(\vec{A}\cdot\vec{B} = A_xB_x + A_yB_y + A_zB_z\). It equals \(\lVert\vec{A}\rVert\,\lVert\vec{B}\rVert\cos\theta\), so its sign reveals whether the angle is acute, right or obtuse.
- Magnitude (norm, length)
- The length of a vector, \(\lVert\vec{A}\rVert = \sqrt{A_x^2 + A_y^2 + A_z^2}\). It is always non-negative.
- Cosine
- The trigonometric ratio \(\cos\theta\) that here equals the normalized dot product \(\dfrac{\vec{A}\cdot\vec{B}}{\lVert\vec{A}\rVert\,\lVert\vec{B}\rVert}\). It ranges from \(-1\) (opposite) through \(0\) (perpendicular) to \(+1\) (same direction).
- Arccos (inverse cosine)
- The function \(\arccos(x)\) that recovers the angle from its cosine, returning a value between \(0^\circ\) and \(180^\circ\) (\(0\) to \(\pi\) radians).
- Orthogonal / perpendicular
- Vectors meeting at \(90^\circ\). Their dot product is exactly zero.
- Parallel / anti-parallel
- Parallel vectors point in the same direction (\(\theta = 0^\circ\), \(\cos\theta = +1\)); anti-parallel vectors point in exactly opposite directions (\(\theta = 180^\circ\), \(\cos\theta = -1\)). In both cases the vectors lie along the same line.
FAQ
Can it handle 2D vectors? Yes — just leave the Z components blank or 0.
Why is the angle never more than 180°? The inverse cosine returns values from 0 to 180°, which is the smallest angle between the two directions regardless of orientation.
What does a 90° result mean? The vectors are perpendicular (orthogonal), which happens whenever the dot product is exactly zero.