Angle Between Vectors CalculatorFree online math calculator — instant results, no sign-up
Calculate the angle between two three-dimensional vectors.
Sign in to save results and favorites.
About the Angle Between Vectors Calculator
The Angle Between Vectors Calculator finds the angle between two three-dimensional vectors using their x, y, and z components. It uses the dot product and vector magnitudes to return the smaller, unsigned angle in degrees. With the default vectors (1, 0, 0) and (1, 1, 0), the angle is 45°.
- First x
- The x-component of the first vector, defaulting to 1, must use the same units as its y- and z-components or be unitless.
- First y
- The y-component of the first vector, defaulting to 0, must use the same units as its x- and z-components or be unitless.
- First z
- The z-component of the first vector, defaulting to 0, must use the same units as its x- and y-components or be unitless.
- Second x
- The x-component of the second vector, defaulting to 1, must use the same units as its y- and z-components or be unitless.
- Second y
- The y-component of the second vector, defaulting to 1, must use the same units as its x- and z-components or be unitless.
- Second z
- The z-component of the second vector, defaulting to 0, must use the same units as its x- and y-components or be unitless.
Formula and method
a = (a_x, a_y, a_z), b = (b_x, b_y, b_z); a · b = a_x b_x + a_y b_y + a_z b_z; ||a|| = √(a_x² + a_y² + a_z²); ||b|| = √(b_x² + b_y² + b_z²); θ_deg = arccos((a · b)/(||a|| ||b||)) × 180/π. For the defaults: θ_deg = arccos((1×1 + 0×1 + 0×0)/(√(1² + 0² + 0²) × √(1² + 1² + 0²))) × 180/π = arccos(1/√2) × 180/π = 45°.
- a, bThe first and second three-dimensional vectors.
- a_x, a_y, a_zThe First x, First y, and First z input values.
- b_x, b_y, b_zThe Second x, Second y, and Second z input values.
- a · bThe dot product, found by adding the products of corresponding components.
- ||a||, ||b||The magnitudes, or lengths, of the first and second vectors.
- arccosThe inverse cosine function, returning an angle in radians before conversion to degrees.
- πPi, used in the radians-to-degrees conversion factor 180/π.
- θ_degThe unsigned angle between the vectors in degrees, from 0° to 180°.
Compute the dot product and the magnitude of each vector, then divide the dot product by the product of the magnitudes to obtain the cosine of the angle. Apply inverse cosine and convert the result from radians to degrees. For the default inputs, the dot product is 1 and the magnitudes are 1 and √2, so the cosine is 1/√2 and the angle is 45°. If either magnitude is zero, the angle is undefined.
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- First x1
- First y0
- First z0
- Second x1
- Second y1
- Second z0
Results
- Angle (degrees)45
How to use the Angle Between Vectors Calculator
- 1Enter the first vector's components in First x, First y, and First z; keep 1, 0, and 0 to reproduce the default example.
- 2Enter the second vector's components in Second x, Second y, and Second z; keep 1, 1, and 0 for the default example.
- 3Check that both vectors use the same Cartesian coordinate axes, that each vector's components have consistent units, and that neither vector is the zero vector.
- 4Run the calculation to evaluate the dot-product angle formula.
- 5Read the Angle (degrees) output; the default inputs give 45.
Reading your result
The Angle (degrees) row reports the unsigned separation between the vectors when their starting points are placed together. The default result, 45, means the directions differ by 45°. A result of 0° indicates the same direction, 90° indicates perpendicular directions, and 180° indicates opposite directions. Angles below 90° have a positive dot product; angles above 90° have a negative dot product.
Limitations
The formula assumes real, finite components in a shared orthonormal Cartesian coordinate system. A zero vector has no direction, so an angle involving it is undefined. The result does not specify clockwise versus counterclockwise rotation or a rotation axis. Very large or very small components can cause numerical overflow or underflow, and nearly parallel or opposite vectors can be sensitive to rounding. In numerical implementations, a cosine ratio just outside [-1, 1] solely because of floating-point rounding should be clamped to that interval before applying inverse cosine.
Common questions
Why do the default vectors (1, 0, 0) and (1, 1, 0) give 45°?+
Their dot product is 1, and their magnitudes are 1 and √2. The cosine of the angle is therefore 1/√2, whose inverse cosine is 45°.
Can I use the angle-between-vectors calculator for two-dimensional vectors?+
Yes. Set First z and Second z to 0 so both vectors lie in the xy-plane. The default inputs already demonstrate this.
Do I need to normalize the vectors before entering them?+
No. Dividing by the product of the magnitudes accounts for their lengths. Multiplying either vector by a positive nonzero scalar leaves the angle unchanged; multiplying it by a negative scalar reverses its direction.
Why is the angle undefined when all three components of either vector are zero?+
That vector has zero magnitude and no direction. Its magnitude makes the denominator of the angle formula zero, so no angle can be calculated.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
You might also like
Vector Addition Calculator
Add two two-dimensional vectors component by component.
Vector Magnitude Calculator
Calculate the magnitude of a three-dimensional vector.
Dot Product Calculator
Calculate the dot product of two three-dimensional vectors.
Cross Product Calculator
Calculate the cross product of two three-dimensional vectors.
Two Linear Equations Calculator
Solve two independent linear equations in two unknowns.
Point Slope Line Calculator
Evaluate a line from a known point, slope and target x coordinate.
Results are estimates for informational purposes and are not financial, medical or legal advice.