Angle Between Two Vectors Calculator
Find the angle between two vectors in 2D or 3D using the dot product. Enter components or two points and get the angle in degrees or radians, plus the dot product, lengths, and cosine.
https://hexacalculator.com/calculators/mathematics/trigonometry/angle-between-two-vectors-calculator
Mathematics
Trigonometry
Angle Between Two Vectors Calculator
Find the angle between two vectors in 2D or 3D using the dot product. Enter components or two points and get the angle in degrees or radians, plus the dot product, lengths, and cosine.
Angle Between Two Vectors Calculator
Enter your two vectors
Enter each vector from two points
Give a start point and an end point for each vector; the tool subtracts them to get the components.
Enter both vectors. The angle you get is the shortest one between them, always between 0 and 180 degrees, and it does not depend on the order of the vectors.
The angle between a and b is 27.266 deg (°). Their lengths are |a| = 3 and |b| = 3, and the dot product is 8.
- cos theta (cosine similarity)
- Dot product a . b
- sin theta
- Length of a, |a|
- Length of b, |b|
- Cross product magnitude |a x b|
- Projection of a onto b
The dot product is positive, so the angle is acute (less than 90 degrees). The vectors broadly point the same way.
Step-by-step
Show the step-by-step
Walk through the dot product, the two lengths, the cosine, and the final arccos with your numbers substituted in.
Step | Formula | Substitute | Result |
|---|---|---|---|
| Dot product a.b | ax*bx + ay*by + az*bz | 1*2 + 2*2 + 2*1 | 8 |
| Length |a| | sqrt(ax^2 + ay^2 + az^2) | sqrt(1 + 4 + 4) | 3 |
| Length |b| | sqrt(bx^2 + by^2 + bz^2) | sqrt(4 + 4 + 1) | 3 |
| cos theta | (a.b) / (|a| |b|) | 8 / (3 * 3) | 0.889 |
| Angle theta | arccos(cos theta) | arccos(0.888889) | 27.266044 deg |
The angle between two vectors is the amount of turn that separates the directions they point. This calculator finds it from the dot product: enter two vectors, in the plane or in space, and it returns the angle in degrees or radians, along with the dot product, the two lengths, the cosine, and a plain verdict on whether the vectors are acute, right, obtuse, parallel, or opposite.
What is the angle between two vectors?
Every vector has a direction, and any two directions meet at an angle. The angle between two vectors is the smaller of the two turns that carries one direction onto the other, so it always lands between 0 and 180 degrees. At 0 degrees the vectors point the same way. At 90 degrees they are perpendicular. At 180 degrees they point in exactly opposite directions. Because it measures direction only, the angle ignores how long the vectors are: doubling a vector leaves the angle untouched.
The angle between two vectors formula
The dot product ties the angle to quantities you can read straight off the components. For two vectors a and b, the dot product equals the product of their lengths and the cosine of the angle between them, which rearranges to give the cosine directly:
The dot product on top is the sum of the products of matching components, and each length underneath measures the vector with the Pythagorean formula:
Take the inverse cosine of that ratio and you have the angle:
How to use this calculator
Choose 2D or 3D, then enter the components of each vector. If you would rather work from coordinates, switch on the point option and give a start point and an end point for each vector; the tool subtracts them to get the components, since a vector from P to Q is Q minus P. The answer appears in degrees by default, and you can switch the unit to radians or gradians. Turn on the step-by-step panel to see the dot product, the two lengths, the cosine, and the final inverse cosine with your own numbers filled in.
A worked example
Take a = (1, 2, 2) and b = (2, 2, 1) in three dimensions. First the dot product:
Then the two lengths, which both come out to 3:
Divide to get the cosine, then take the inverse cosine:
The table below lists each symbol, what it means, and its value in this example.
Symbol | Meaning | Example |
|---|---|---|
a, b | The two vectors | (1, 2, 2) and (2, 2, 1) |
a . b | Dot product | 8 |
|a|, |b| | Vector lengths | 3 and 3 |
cos(theta) | Cosine of the angle | 8/9 = 0.8889 |
theta | Angle between the vectors | 27.27 degrees |
2D and 3D vectors
The same formula works in any number of dimensions; you simply add or drop a term. A flat 2D pair uses only the x and y components, so the dot product is a_x b_x + a_y b_y and each length uses two squares instead of three. Switching this calculator to 2D hides the z fields and treats those components as zero, which is exactly the same as leaving them off.
Reading the sign of the dot product
You can often tell the type of angle before finishing the arithmetic, because the numerator and the cosine always share a sign. A positive dot product means an acute angle under 90 degrees, where the vectors broadly agree in direction. A dot product of zero means a right angle, the defining test for perpendicular vectors. A negative dot product means an obtuse angle over 90 degrees, where the vectors broadly oppose each other.
The sine and cross-product form
Cosine is not the only route. The magnitude of the cross product gives the sine of the same angle, which this calculator reports alongside the cosine result:
Sine peaks when the vectors are perpendicular and falls to zero when they line up, the mirror image of how cosine behaves. The cosine form is usually preferred for the angle itself because it distinguishes acute from obtuse on its own, while sine alone cannot tell 30 degrees from 150.
Projection and cosine similarity
The cosine of the angle carries meaning well beyond geometry. Multiply it by the length of a and you get the scalar projection of a onto b, which is how much of a points along b and which drives the work done by a force along a direction. On its own the cosine is the cosine similarity used across data science: a value near 1 means two vectors, such as documents turned into word counts, point almost the same way, while a value near 0 means they share little direction.
Where the angle between vectors is used
Lighting in computer graphics leans on this angle, since a surface looks brightest when it faces the light and dims as the angle to the light grows. Physics uses it to resolve forces and to find the work a force does along a path. Navigation compares headings as vectors to read off a bearing difference. Machine learning ranks how similar two items are by the cosine of the angle between their feature vectors. Anywhere direction matters more than size, this angle is the natural measure.
Common mistakes to avoid
Match the components in order when you form the dot product, pairing x with x and y with y rather than crossing them. Divide by the product of the lengths, not by their sum. Watch the sign of each component, because a dropped minus sign flips an obtuse angle to an acute one. And check whether your tool is set to degrees or radians before reading the result, since the two differ by a factor of about 57.
This calculator is a learning and estimation aid. Confirm the setup of any physics or engineering problem, and mind the units your vectors carry, before relying on a result.
Frequently asked questions
- How do you find the angle between two vectors?
Compute the dot product of the two vectors, divide it by the product of their lengths and then take the arccosine of the result. Symbolically this is expressed as: theta equals arccos(a dot b) divided by (|a| multiplied by |b|). The dot product is the sum of the products of corresponding components while each length is obtained by applying Pythagoras' theorem to the respective vector components. This calculator performs all these steps and shows the solution path.
- What area is covered by the angle between two vectors?
The angle between two non-zero vectors is always between 0 degrees and 180 degrees or between 0 and π radians. It is the smallest rotation that takes one vector to another, so it is never negative and never exceeds a straight angle. If you need a signed angle that can be between -180 and 180 degrees, use this calculator which also calculates 2D directed angles for two-dimensional vectors.
- What does a 90-degree angle mean?
An angle of 90 degrees means that the vectors are perpendicular to each other, also called orthogonal. This only happens when the scalar product is zero since the cosine of an angle of 90 degrees is zero. Checking if the scalar product is equal to zero is the fastest method to check whether vectors are perpendicular to each other.
- Can the angle between two vectors be negative?
The angle between two vectors can never be negative, since the inverse cosine function only returns values between 0 and 180 degrees. Negative or signed angles are only meaningful in the context of 2D: one can define a directed rotation from the first vector to the second such that counterclockwise rotations are considered positive and clockwise rotations are considered negative. This tool shows this signed angle separately for 2D vectors.
- How do you calculate the angle between two vectors if each vector is made up of only two points?
Open the point coordinates option and input the starting and ending points for each vector. The calculator will subtract the two points from one another since a vector from point P to Q has components given by Q minus P. It then applies the standard cosine formula. This method is useful if your data consists of a set of coordinates rather than pre-made vectors.
- What is the difference between dot product and cross product?
The dot product gives the cosine of the angle and is suitable for any dimension. The magnitude of the cross product gives the sine value and is defined on vectors in 3D space. In general, the dot product is preferred to calculate the angle since its sign can distinguish between acute and obtuse angles whereas the sine alone does not distinguish an angle from its supplement. This calculator outputs both cosine and sine values.
Related calculators






Disclaimer: This calculator is provided for general informational and educational purposes only. Our calculators are under active development, and results may be inaccurate, incomplete, or unsuitable for your situation. Always verify the figures independently and seek advice from a qualified professional before relying on them. We make no warranties and accept no liability for any loss or decision arising from use of this tool.
References
- MIT OpenCourseWare: Dot Product (18.02 Multivariable Calculus)
University treatment of the dot product and the angle between vectors.
- LibreTexts Mathematics: The Dot Product
Open textbook derivation of the dot product, magnitude, and the cosine formula for the angle.
- Wolfram MathWorld: Vector Angle
Reference definition of the angle between two vectors via the dot product.