Angle Between Two Vectors Calculator

Created by Hanna Pamuła, PhD
Reviewed by Bogna Szyk and Jack Bowater
Last updated: Oct 26, 2022

With this angle between two vectors calculator, you'll quickly learn how to find the angle between two vectors. It doesn't matter if your vectors are in 2D or 3D, nor if their representations are coordinates or initial and terminal points - our tool is a safe bet in every case. Play with the calculator and check the definitions and explanations below; if you're searching for the angle between two vectors formulas, you'll definitely find them there.

Since you're here, hunting down solutions to your vector problems, can we assume that you're also interested in vector operations? Check Omni's other tools at the coordinate geometry section.

Angle between two vectors formulas

In this paragraph, you'll find the formulas for the angle between two vectors - and only the formulas. If you'd like to understand how we derive them, go directly into the next paragraph, How to find the angle between two vectors.

Image of the angle between two vectors

Angle between two 2D vectors

  1. Vectors represented by coordinates (standard ordered set notation, component form):
2D Vector in a component form

For vector a\boldsymbol a:

a=(xa,ya)\scriptsize \boldsymbol a = (x_a,y_a)

And b\boldsymbol b:

b=(xb,yb)\scriptsize \boldsymbol b = (x_b,y_b)

The angle is:

angle=arccos((xaxb+yayb)/((xa2+ya2)12(xb2+yb2)12))\scriptsize\begin{split} \mathrm{angle} &= \mathrm{arccos}\bigg(\Big(x_a\cdot x_b +y_a \cdot y_b\Big)\\ &\!\!\!\!\!\!\!\!\!/\Big(\big(x_a^2+y_a^2\big)^{\frac{1}{2}}\cdot\!\big(x_b^2+y_b^2\big)^{\frac{1}{2}}\Big)\bigg) \end{split}
  1. Vectors between a starting and terminal point:
2D Vector. Notation: starting and terminal point coordinates.

For vector a\boldsymbol a:

A=(x1,y1,z1)\scriptsize A =(x_1,y_1,z_1)

And:

B=(x2,y2,z2)\scriptsize B =(x_2,y_2,z_2)

So vector a\boldsymbol a is:

a=(x2x1,y2,y1)\scriptsize\boldsymbol a = (x_2-x_1,y_2,y_1)

For vector b\boldsymbol b:

C=(x3,y3,z3)\scriptsize C =(x_3,y_3,z_3)

And:

D=(x4,y4,z4)\scriptsize D =(x_4,y_4,z_4)

So vector b\boldsymbol b is:

b=(x4x3,y4y3)\scriptsize\boldsymbol{b}=(x_4-x_3,y_4-y_3)

And:

angle=arccos(((x2x1)(x4x3)+(y2y1)(y4y3))/(((x2x1)2+(y2y1)2)12((x4x3)2+(y4y3)2)12))\scriptsize\begin{split} \mathrm{angle} &= \mathrm{arccos}\bigg(\Big((x_2-x_1)\cdot(x_4-x_3)\\ &\!\!\!\!\!\!\!\!\!+(y_2-y_1)\cdot(y_4-y_3)\Big)\\ &\!\!\!\!\!\!\!\!\!/\Big(\big((x_2-x_1)^2+(y_2-y_1)^2\big)^{\frac{1}{2}}\\ &\!\!\!\!\!\!\!\!\!\cdot\!\big((x_4-x_3)^2+(y_4-y_3)^2\big)^{\frac{1}{2}}\Big)\bigg) \end{split}

Angle between two 3D vectors

  1. Vectors represented by coordinates:
3D Vector in a component form
a=(xa,ya,za)\scriptsize\boldsymbol a = (x_a,y_a,z_a)

And:

b=(xb,yb,zb)\scriptsize\boldsymbol b = (x_b,y_b,z_b)

Then:

angle=arccos((xaxb+yayb+zazb)/((xa2+ya2+za2)12(xb2+yb2+zb2)12))\scriptsize \begin{split} &\mathrm{angle} \!=\! \mathrm{arccos}\bigg((x_a\cdot x_b+y_a\cdot y_b+z_a\cdot z_b)\\ &\!\!/\Big(\big(x_a^2+y_a^2+z_a^2\big)^{\frac{1}{2}}\cdot\big(x_b^2+y_b^2+z_b^2\big)^{\frac{1}{2}}\Big)\bigg) \end{split}
  1. Vectors between a starting and terminal point:
3D Vector. Notation: starting and terminal point

For vector a\boldsymbol{a}:

A=(x1,y1,z1)\scriptsize A = (x_1,y_1,z_1)

And:

B=(x2,y2,z2)\scriptsize B =(x_2,y_2,z_2)

So:

a=(x2x1,y2y1,z2z1)\scriptsize\boldsymbol{a} = (x_2-x_1,y_2-y_1,z_2-z_1)

For vector b\boldsymbol{b}:

C=(x3,y3,z3)\scriptsize C = (x_3,y_3,z_3)

And:

D=(x4,y4,z4)\scriptsize D =(x_4,y_4,z_4)

So:

b=(x4x3,y4y3,z4z3)\scriptsize\boldsymbol{b}=(x_4-x_3,y_4-y_3,z_4-z_3)

Find the final formula analogically to the 2D version:

angle=arccos(((x2x1)(x4x3)+(y2y1)(y4y3)+(z2z1)(z4z3))/(((x2x1)2+(y2y1)2+(z2z1)2)12((x4x3)2+(y4y3)2+(z4z3)2)12))\scriptsize\begin{split} \mathrm{angle} &= \mathrm{arccos}\bigg(\Big((x_2-x_1)\cdot(x_4-x_3)\\ &\!\!\!\!\!\!\!\!+(y_2-y_1)\cdot(y_4-y_3)+(z_2-z_1)\\ &\!\!\!\!\!\!\!\!\cdot(z_4-z_3)\Big)/\Big(\big((x_2-x_1)^2+(y_2-y_1)^2\\ &\!\!\!\!\!\!\!\!+(z_2-z_1)^2\big)^{\frac{1}{2}}\!\cdot\!\big((x_4-x_3)^2+(y_4-y_3)^2\\ &\!\!\!\!\!\!\!\!+(z_4-z_3)^2\big)^{\frac{1}{2}}\Big)\bigg) \end{split}

Also, it is possible to have one angle defined by coordinates, and the other defined by a starting and terminal point, but we won't let that obscure this section even further. All that matters is that our angle between two vectors calculator has all possible combinations available to you.

How to find the angle between two vectors?

OK, the above paragraph was a bit of a TL;DR. As a way of better understanding the formulas for the angle between two vectors, let's check where they come from:

  1. Start with the basic geometric formula to calculate the dot product:

    The dot product is defined as the product of the vectors' magnitudes multiplied by the cosine of the angle between them (here denoted by α\alpha):

ab=a×b×cos(α)\boldsymbol{a}\cdot\boldsymbol{b} = |\boldsymbol{a}|\times|\boldsymbol{b}|\times \cos(\alpha)

🙋 Our vector magnitude calculator is here to help if you need a refresh about that other important vectorial quantity!

  1. Then, make the angle the subject of the equation:

    Divide by the product of the vectors' magnitudes:

cos(α)=(aba×b)\scriptsize\cos(\alpha) = \left(\frac{\boldsymbol{a}\cdot\boldsymbol{b}}{|\boldsymbol{a}|\times|\boldsymbol{b}|}\right)

Find the inverse cosine of both sides:

α=arccos(aba×b)\scriptsize\alpha = \mathrm{arccos}\left(\frac{\boldsymbol{a}\cdot\boldsymbol{b}}{|\boldsymbol{a}|\times|\boldsymbol{b}|}\right)
  1. Afterward, we need to brush up on the definition of a vectors' magnitude:

    As magnitude is the square root of the sum of the vector's components to the second power, we find out that:

  • v=x2+y2|\boldsymbol{v}| =\sqrt{x^2+y^2} in 2D space; and

  • v=x2+y2+z2|\boldsymbol{v}| =\sqrt{x^2+y^2+z^2} in 3D space.

Did you notice that it's the same formula as the one used in the distance calculator? And that it comes directly from geometry — learn how with the Pythagorean theorem calculator?

  1. Use the algebraic formula for the dot product (the sum of products of the vectors' components), and substitute in the magnitudes:
  • in 3D space

If vectors a\boldsymbol{a} and b\boldsymbol{b} are, respectively:

a=(xa,ya)\scriptsize\boldsymbol{a} = (x_a,y_a)

And:

b=(xb,yb)\scriptsize\boldsymbol{b} = (x_b,y_b)
α=arccos((xaxb+yayb)/((xa2+ya2)12(xb2+yb2)12))\scriptsize \begin{split} &\alpha = \mathrm{arccos}\bigg(\Big(x_a\cdot x_b+y_a \cdot y_b\Big)\\ &/\Big(\big(x_a^2+y_a^2\big)^{\frac{1}{2}}\!\cdot\!\big(x_b^2+y_b^2\big)^{\frac{1}{2}}\Big)\bigg) \end{split}
  • in 3D space

If vectors a\boldsymbol{a} and b\boldsymbol{b} are, respectively:

a=(xa,ya,za)\scriptsize\boldsymbol{a} = (x_a,y_a,z_a)

And:

b=(xb,yb,zb)\scriptsize\boldsymbol{b} = (x_b,y_b,z_b)

Then:

α=arccos((xaxb+yayb+zazb)/((xa2+ya2+za2)12(xb2+yb2+zb2)12))\scriptsize \begin{split} &\alpha = \mathrm{arccos}\bigg(\Big(x_a\cdot x_b+y_a \cdot y_b +z_a\cdot z_b\Big)\\ &/\Big(\big(x_a^2+y_a^2+z_a^2\big)^{\frac{1}{2}}\!\cdot\!\big(x_b^2+y_b^2+z_b^2\big)^{\frac{1}{2}}\Big)\bigg) \end{split}

And that's it!

Additionally, if your vectors are in a different form (you know their initial and terminal points), you'll need to perform some calculations beforehand. The aim is to reduce them into standard vector notation.

If your example vector is described by the initial point B=(x1,y1)B=(x_1, y_1) and the terminal point B=(x2,y2)B=(x_2, y_2), then vectora\boldsymbol{a} may be expressed as:

a=(x2x1,y2y1)\scriptsize\boldsymbol{a} = (x_2-x_1,y_2-y_1)

Still not making sense? No worries! We've prepared some exemplary calculations to make sure it's as clear as crystal.

Angle between two 3d vectors - example

Assume that we want to find the angle between two vectors:

a=(3,6,1)\scriptsize\boldsymbol{a} = (3, 6, 1)