HomeMath › Angle Between Two Vectors Calculator

Angle Between Two Vectors Calculator

Find the angle between two vectors. Enter the x, y and z components of vector a and vector b to get the angle in degrees and radians, plus the dot product and whether the angle is acute, right or obtuse.

Example: with a: x 1 · a: y 0 · a: z 0 · b: x 1 · b: y 1 → Angle (degrees): 45°.

  • Angle (radians)0.7854 rad
  • Dot producta·b = 1 · acute — pointing similarly

Computed by the calculator below using its default values. Change any input to see your own numbers.

Angle (degrees)
Angle (radians)
Dot product

θ = acos( (a·b) / (|a| |b|) ). The dot product divided by the two magnitudes gives cos θ; taking the inverse cosine returns the angle between the vectors.

The dot product carries the angle

Two vectors define a plane, and the angle between them lives in that plane regardless of dimension. The dot product a·b equals |a||b|cosθ, so dividing the dot product by the product of the magnitudes isolates cosθ. The inverse cosine then returns the angle, always between 0° and 180°.

The sign of the dot product is a quick tell. Positive means the angle is acute and the vectors broadly agree; zero means they are perpendicular; negative means the angle is obtuse and they oppose each other. That is why the dot product shows up in lighting, similarity scores, and work calculations.

How it’s calculated

θ = acos( (a·b) / (|a| |b|) ), where a·b = axbx+ayby+azbz and |a|, |b| are the magnitudes. The cosine is clamped to [-1, 1] to absorb floating-point error, then converted from radians to degrees with 180/π. The result lies in [0°, 180°].

Neither vector may be the zero vector, since a zero-length vector has no defined direction and the angle would be undefined.

Angle for common dot-product values

cos θθ (degrees)θ (radians)Relationship
10Same direction
0.707145°0.7854Acute
090°1.5708Perpendicular
-0.5120°2.0944Obtuse
-1180°3.1416Opposite

Computed as θ = acos(cos θ); radians × 180/π = degrees.

Common mistakes

  • Forgetting to divide by both magnitudes — a·b alone is not the cosine unless both vectors are unit length.
  • Feeding a cosine slightly above 1 or below -1 into acos and getting NaN; it must be clamped.
  • Reading the result as radians when it is degrees, or vice versa.
  • Trying to find an angle when one vector is the zero vector, which has no direction.

Frequently asked questions

What is the formula for the angle between two vectors?

θ = acos( (a·b) / (|a| |b|) ). Compute the dot product, divide by the product of the two magnitudes to get cos θ, then take the inverse cosine.

How do I know if the angle is acute or obtuse without computing it?

Check the dot product. Positive means acute, zero means perpendicular, and negative means obtuse.

Does this work in 3D?

Yes. The dot-product formula works in any number of dimensions; just include every component in a·b and in each magnitude.

Why is the angle always between 0 and 180 degrees?

Inverse cosine only returns values in that range, and it matches the geometric angle between two directions, which is never more than a straight line.