Skip to content
Math

Angle Between Two Vectors Calculator

Enter the components of two vectors and get the angle between them in both degrees and radians. Choose 2D or 3D mode, see the dot product and magnitudes worked out step by step, and read a plain-English interpretation of whether the vectors are acute, right, or obtuse.

Your details

Choose 2D for planar vectors or 3D for vectors in space.
The x-component of vector A.
The y-component of vector A.
The z-component of vector A.
The x-component of vector B.
The y-component of vector B.
The z-component of vector B.
AngleAcute angle
12.9332degrees

Angle between the two vectors in degrees (0 to 180)

Angle (radians)0.225726rad
Dot product32
|A| magnitude3.7417
|B| magnitude8.775
12.9332 deg
Parallel<0.001Acute0.001-90Right90-90.001Obtuse90.001+
-101090180
Angle (degrees)

The angle is 12.9332 degrees (0.225726 rad).

  • The vectors form an acute angle of 12.9332 degrees. A positive dot product (32.0000) confirms they lean toward each other.
  • The magnitudes are |A| = 3.7417 and |B| = 8.7750.
  • The angle between two vectors is always between 0 and 180 degrees (0 and pi radians).

Next stepTo find the projection of A onto B, multiply |A| by cos(theta). Projections are central to regression, signal processing and computer graphics.

Formula

cos(θ)=ABAB=iAiBiiAi2iBi2,θ=arccos ⁣(ABAB)\cos(\theta) = \dfrac{\mathbf{A} \cdot \mathbf{B}}{|\mathbf{A}|\,|\mathbf{B}|} = \dfrac{\sum_i A_i B_i}{\sqrt{\sum_i A_i^2}\,\sqrt{\sum_i B_i^2}}, \quad \theta = \arccos\!\left(\frac{\mathbf{A} \cdot \mathbf{B}}{|\mathbf{A}|\,|\mathbf{B}|}\right)

Worked example

For A = (1, 2, 3) and B = (4, 5, 6): dot product = 4 + 10 + 18 = 32; |A| = sqrt(1 + 4 + 9) = sqrt(14) ~ 3.7417; |B| = sqrt(16 + 25 + 36) = sqrt(77) ~ 8.7750; cos(theta) = 32 / (3.7417 x 8.7750) ~ 0.9746; theta = arccos(0.9746) ~ 12.9332 degrees.

What is the angle between two vectors?

The angle between two vectors is the smallest rotation that would bring one vector into alignment with the other, measured at the point where they originate. It always falls between 0 and 180 degrees (0 and pi radians). A 0-degree angle means the vectors point in identical directions, a 90-degree angle means they are perpendicular (orthogonal), and a 180-degree angle means they point in exactly opposite directions. This angle is the same regardless of the lengths of the vectors: scaling a vector does not change the angle it makes with another.

How to calculate the angle using the dot product formula

The standard method uses the dot product. For vectors A and B, compute A . B (the sum of element-wise products), then divide by the product of their magnitudes |A| and |B|. The result is the cosine of the angle. Applying arccos gives the angle itself. For 2D vectors A = (ax, ay) and B = (bx, by): dot = ax*bx + ay*by; |A| = sqrt(ax^2 + ay^2); |B| = sqrt(bx^2 + by^2); theta = arccos(dot / (|A| * |B|)). The 3D version simply adds the z-term to each sum. This formula generalises to any number of dimensions without modification.

Interpreting the sign of the dot product

The dot product and the angle convey the same directional relationship. A positive dot product means the angle is less than 90 degrees (cosine is positive), so the vectors have a "forward" component relative to each other. A zero dot product means the angle is exactly 90 degrees: the vectors are orthogonal and completely independent in direction. A negative dot product means the angle exceeds 90 degrees: the vectors point more away from each other than toward each other. This sign is heavily used in computer graphics (backface culling, lighting), physics (work done by a force), and machine learning (cosine similarity for text embeddings).

Applications in science and engineering

Angles between vectors appear throughout applied mathematics. In physics, the work done by a force F over displacement d is F . d = |F| |d| cos(theta), so work is zero when force is perpendicular to motion. In computer graphics, the dot product of a surface normal and a light direction determines shading intensity. In machine learning, cosine similarity uses this formula to measure how alike two feature vectors are: a score of 1 means identical direction (topic), 0 means unrelated, and -1 means opposite. In navigation and robotics, the angle between a heading vector and a target vector drives steering corrections.

Vector angle classifications

AngleClassificationDot product signInterpretation
0 degreesParallel (same direction)Maximum positiveVectors point the same way
0 to 90 degreesAcutePositiveVectors lean toward each other
90 degreesPerpendicular (orthogonal)ZeroVectors are independent
90 to 180 degreesObtuseNegativeVectors lean away from each other
180 degreesAnti-parallelMaximum negativeVectors point opposite ways

Standard geometric and algebraic interpretation of the angle between two vectors.

Frequently asked questions

Can the angle between two vectors be greater than 180 degrees?

No. The formula arccos(A . B / (|A| |B|)) always returns a value between 0 and 180 degrees (0 and pi radians) by definition of the inverse cosine function. If you need a directed or signed angle that can exceed 180 degrees, you must specify an orientation (a reference axis and a rotation direction), which is a different concept from the undirected angle between two vectors.

What does a zero dot product mean?

A dot product of zero means the two vectors are perpendicular, or orthogonal. The cosine of 90 degrees is zero, so arccos(0) = 90 degrees. In linear algebra, orthogonal vectors represent completely independent directions: knowing how much of one you have tells you nothing about the other. This is the property exploited by orthonormal bases in Fourier analysis, principal component analysis, and quantum mechanics.

Does vector length affect the angle?

No. The formula divides the dot product by the product of the magnitudes, so any scaling of either vector cancels out. Doubling the length of vector A doubles both the dot product and |A|, leaving the ratio and therefore the angle unchanged. This is why cosine similarity in machine learning normalises vectors to unit length before comparing: it isolates direction from magnitude.

What is the difference between the angle in 2D and 3D?

The formula is identical: arccos(A . B / (|A| |B|)). The only difference is that in 3D you add the z-component to the dot product and include it under the square root for the magnitudes. The angle still lies in the range 0 to 180 degrees. In 2D you can also compute a signed angle using atan2, which tells you whether the rotation from A to B is clockwise or counterclockwise, but that is a separate calculation.

How is the angle between vectors used in machine learning?

Cosine similarity is the cosine of the angle between two feature vectors. In natural language processing, word or document embeddings are compared by the angle between their vectors in high-dimensional space: a small angle (large cosine similarity) means the documents discuss similar topics. It is preferred over raw dot product when vector magnitudes differ across samples, because it normalises for length and measures direction only.

Sources

Written by Dr. Elena Vasquez, PhD Mathematician · Lisbon, Portugal

Translating rigorous geometric theory into accurate, reliable calculation tools trusted by engineers, students, and researchers worldwide.

Search 3,500+ calculators

Loading search…