Connect via MCP →

Enter Calculation

Leave the z fields blank (or 0) for 2D vectors.

Formula

Advertisement

Results

Angle Between Vectors
90°
1.5708 radians
Dot product (a·b) 0
Magnitude |a| 1
Magnitude |b| 1
cos θ 0

What this calculator does

This tool finds the angle between two vectors in 2D or 3D space using the dot product. Enter the components of vector a and vector b, and it returns the angle in both degrees and radians, along with the dot product, each vector's magnitude, and the cosine of the angle. It works for pure mathematics, physics, engineering, computer graphics, and machine-learning similarity problems.

Two vectors from a common origin with the angle theta marked between them
The angle θ is measured between two vectors sharing a common origin.

How to use it

Type the x, y (and optional z) components of each vector. For 2D vectors, simply leave the z fields blank or set them to 0. Press calculate to see the angle. The angle returned is always between 0° and 180°, the geometric (smallest) angle between the two directions.

The formula explained

The dot product relates to the angle by \(\mathbf{a}\cdot\mathbf{b} = |\mathbf{a}||\mathbf{b}|\cos\theta\). Solving for θ gives

$$\theta = \arccos\!\left( \frac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|} \right).$$

The dot product is computed component-wise:

$$\mathbf{a}\cdot\mathbf{b} = a_x b_x + a_y b_y + a_z b_z.$$

Each magnitude is the square root of the sum of its squared components:

$$|\mathbf{a}| = \sqrt{a_x^2 + a_y^2 + a_z^2}.$$

The result of the division is clamped to the range \([-1, 1]\) before taking arccosine to avoid rounding errors.

Advertisement
Projection of one vector onto another illustrating the dot product relationship
The dot product relates to the projection of one vector onto the other and the cosine of θ.

Worked example

Let \(\mathbf{a} = (1, 0, 0)\) and \(\mathbf{b} = (1, 1, 0)\). The dot product is

$$1\cdot 1 + 0\cdot 1 + 0\cdot 0 = 1.$$

The magnitudes are \(|\mathbf{a}| = 1\) and \(|\mathbf{b}| = \sqrt{2} \approx 1.4142\). So

$$\cos\theta = \frac{1}{1 \times 1.4142} \approx 0.7071,$$

giving \(\theta = \arccos(0.7071) = 45°\), or about \(0.7854\) radians.

Interpreting Your Result

The angle \(\theta\) returned by the calculator describes how two vectors are oriented relative to each other, independent of their lengths. The sign and size of \(\cos\theta\) tell you the geometric relationship at a glance.

  • \(\theta = 0^\circ\) (\(\cos\theta = 1\)) — parallel / same direction. The vectors point exactly the same way; one is a positive scalar multiple of the other.
  • \(0^\circ < \theta < 90^\circ\) (\(\cos\theta > 0\)) — acute angle. The dot product is positive and the vectors point in broadly similar directions.
  • \(\theta = 90^\circ\) (\(\cos\theta = 0\)) — orthogonal (perpendicular). The dot product is exactly zero. This is the defining test for perpendicularity.
  • \(90^\circ < \theta < 180^\circ\) (\(\cos\theta < 0\)) — obtuse angle. The dot product is negative; the vectors point in generally opposing directions.
  • \(\theta = 180^\circ\) (\(\cos\theta = -1\)) — antiparallel / opposite direction. One vector is a negative scalar multiple of the other.

In machine learning and text analysis, the quantity \(\cos\theta\) itself is called cosine similarity. Interpreted directly: a value of 1 means identical direction (maximally similar), 0 means orthogonal/unrelated, and −1 means opposite. Because it ignores magnitude, two documents or embeddings with the same orientation but different lengths score as identical. The angle and the similarity carry the same information — the angle is simply \(\arccos\) of the similarity.

Advertisement

Common Angle Reference Values

These standard angles and their exact cosine values are useful for checking results and recognizing common orientations. The angle is found from \(\theta = \arccos(\cos\theta)\).

Angle (degrees) Angle (radians) \(\cos\theta\) Relationship
\(0\) 1.0000 Parallel (same direction)
30° \(\pi/6\) 0.8660 Acute
45° \(\pi/4\) 0.7071 Acute
60° \(\pi/3\) 0.5000 Acute
90° \(\pi/2\) 0.0000 Orthogonal (perpendicular)
120° \(2\pi/3\) −0.5000 Obtuse
135° \(3\pi/4\) −0.7071 Obtuse
150° \(5\pi/6\) −0.8660 Obtuse
180° \(\pi\) −1.0000 Antiparallel (opposite)

To convert a decimal-degree result such as 60° into degrees, minutes and seconds, you can use a 60° conversion.

FAQ

Can I use 2D vectors? Yes — leave the z components as 0 and the formula reduces to the 2D case.

Why is the angle never more than 180°? The arccosine function returns values from 0 to π (180°), which represents the smallest angle between the two directions regardless of orientation.

What if a vector is zero? A zero vector has no direction, so the angle is undefined; this calculator returns 0° when a magnitude is zero to avoid division by zero.

Last updated: