Angle Between Vectors Calculator
Find the angle in degrees between two 2D vectors given their X and Y components. Useful in physics, game development, and navigation when you need to know how far apart two directions are.
About this calculator
The angle θ between two 2D vectors is found by combining the dot product formula with the definition of cosine. For vectors **v1** = (v1x, v1y) and **v2** = (v2x, v2y), the formula is: θ = arccos(((v1x × v2x) + (v1y × v2y)) / (√(v1x² + v1y²) × √(v2x² + v2y²))) × (180 / π). The numerator is the dot product of the two vectors; the denominator is the product of their magnitudes. Dividing gives the cosine of the angle, and arccos converts that back to an angle. Multiplying by 180/π converts radians to degrees. The result is always between 0° and 180°. Two vectors pointing the same direction yield 0°, perpendicular vectors yield 90°, and opposite vectors yield 180°. If either vector has zero magnitude the angle is undefined.
How to use
Let **v1** = (1, 0) (pointing along the positive x-axis) and **v2** = (1, 1). Enter v1x = 1, v1y = 0, v2x = 1, v2y = 1. Dot product = (1×1) + (0×1) = 1. Magnitude of v1 = √(1² + 0²) = 1. Magnitude of v2 = √(1² + 1²) = √2 ≈ 1.4142. Divide: 1 / (1 × 1.4142) ≈ 0.7071. Apply arccos: arccos(0.7071) ≈ 0.7854 radians. Multiply by 180/π: 0.7854 × 57.296 ≈ 45°. The angle between the two vectors is exactly 45°.
Frequently asked questions
Why is the angle between two vectors always between 0 and 180 degrees?
The formula uses the arccos function, whose output is restricted to the range [0, π] radians, or [0°, 180°]. This is because the cosine function is not one-to-one over the full circle, so arccos only returns values in the principal range. Geometrically, the 'angle between two vectors' is conventionally defined as the smaller of the two possible angles you could measure, which is always at most 180°. If you need a directed angle (which distinguishes clockwise from counter-clockwise and can range from −180° to 180°), you would use atan2 instead.
What happens to the angle calculation when one vector has zero magnitude?
If either vector is the zero vector — all components equal to zero — its magnitude is zero and you would be dividing by zero in the formula. The angle is mathematically undefined in this case, because the zero vector has no direction. In practice, calculators handle this by returning an error or 'undefined' result. Always ensure both input vectors have at least one non-zero component before attempting to compute the angle between them.
How do I use the angle between vectors to check if two vectors are perpendicular or parallel?
If the angle equals exactly 90°, the vectors are perpendicular (orthogonal), and their dot product will be zero — you can use this as a quick perpendicularity test without computing arccos. If the angle is 0°, the vectors are parallel and pointing the same way; if it is 180°, they are anti-parallel (opposite directions). In both parallel cases the dot product equals the product of the magnitudes (positive or negative). These checks are useful in collision detection, structural analysis, and any application where alignment or orthogonality of directions matters.