Overview

This finds the angle between two 3D vectors from their components. Use it in physics, graphics and geometry.

For 2D vectors, enter 0 for both z-components.

Worked examples

InputsResult
A x-component1A y-component2A z-component3B x-component4B y-component5B z-component6Angle: 12.933°In radians: 0.2257Dot product: 32
Show 2 more examples
A x-component1A y-component0A z-component0B x-component0B y-component1B z-component0Angle: 90°In radians: 1.5708Dot product: 0
A x-component3A y-component4A z-component0B x-component-4B y-component3B z-component0Angle: 90°In radians: 1.5708Dot product: 0

Angle by b z-component

With the calculator's starting values, the angle is 12.933°. The table shows how it changes with the b z-component.

B z-componentAngle (°)
329.62°
423.017°
517.44°
6starting value12.933°
79.594°
87.643°
97.223°

Other inputs: A x-component: 1 · A y-component: 2 · A z-component: 3 · B x-component: 4 · B y-component: 5. Change them in the calculator above for your own numbers.

How it works

The dot product of two vectors equals the product of their lengths times the cosine of the angle between them. Rearranging gives the angle. A positive dot product means less than 90°, zero means exactly 90°, and a negative one means more than 90°.

The formula

θ = arccos((A · B) ÷ (|A| × |B|))
A · BDot product
|A|, |B|Vector lengths

Practical tips

  • (1, 2, 3) and (4, 5, 6) have a dot product of 32 and an angle of 12.933°.
  • Perpendicular vectors have a dot product of 0.
  • The result is always from 0° to 180°, whichever vector you list first.

Frequently asked questions

Why not a zero vector?

It has no direction, so the angle isn’t defined.

Does the length of the vectors matter?

No. Scaling a vector by a positive number doesn’t change the angle.