Angle Between Two Vectors Calculator
The angle between a = (3, 4, 0) and b = (5, 12, 0) is 14.25 degrees, and the same angle is 0.2487 radians. Their dot product is 63, their lengths are 5 and 13, and cos θ = 63 ÷ 65 = 0.9692. Enter your own two vectors to repeat every step.
| Dot product (a dot b) | |
| Length |a| | |
| Length |b| | |
| cos θ = (a dot b) ÷ (|a| × |b|) | |
| Angle in degrees | |
| Angle in radians | |
| Reading | |
cos θ = (a dot b) ÷ (|a| × |b|), then arccos. Leave the third slot at 0 for 2D vectors. The calculations run in your browser, and nothing you type is uploaded or stored.
Enter two vectors and get the dot product, both lengths, the cosine of the angle and the angle itself in degrees and radians, with the sign explained.
Key takeaways
- cos θ = (a dot b) ÷ (|a| × |b|): for (3, 4, 0) and (5, 12, 0) that is 63 ÷ 65 and 14.25 degrees
- A dot product of 0 means 90 degrees: (3, 4) and (4, -3) are perpendicular
- Positive dot product means an acute angle, negative means obtuse
- In 3D, (1, 2, 2) and (-2, 1, 2) both have length 3, and the angle is 63.61 degrees
- Degrees to radians: multiply by π ÷ 180, so 14.25 degrees is 0.2487 radians
On this page
- What the angle between two vectors measures
- The formula, step by step
- What the sign of the dot product tells you
- A 3D example with equal lengths
- Degrees, radians and the switch between them
- Engineering, physics and 3D graphics uses
- Traps: zero vectors, units and rounding slips
- The calculator and neighboring tools
What the angle between two vectors measures
Point two arrows from the same spot and one question follows: how far apart are their directions? The angle between two vectors answers that, from 0 degrees when they point the same way to 180 degrees when they point opposite ways. The lengths of the arrows have nothing to do with it; only the directions matter, so a vector of length 5 and a vector of length 500 can still sit at the same angle.
The dot product is the bridge between components and angle. For vectors a and b it satisfies a dot b = |a| |b| cos θ, where |a| and |b| are the lengths and θ is the angle between them. Rearranged, that is the formula this calculator uses: θ = arccos((a dot b) ÷ (|a| × |b|)). It works the same in 2D and 3D, because the two vectors always share a plane and the formula only ever sees components. The OpenStax Calculus Volume 3 text, section 2.3 develops the dot product this way, and MIT OpenCourseWare uses the same identity to read the angle straight off components.
The formula, step by step
Take a = (3, 4, 0) and b = (5, 12, 0), a pair you can check with nothing but multiplication. Five steps, in order:
First the dot product: 3 × 5 + 4 × 12 + 0 × 0 = 15 + 48 + 0 = 63. Then the two lengths: |a| = √(9 + 16 + 0) = √25 = 5, and |b| = √(25 + 144 + 0) = √169 = 13. Multiply the lengths: 5 × 13 = 65. Divide: cos θ = 63 ÷ 65 = 0.9692. Finally take arccos: θ = 14.25 degrees, which is 0.2487 radians.
Both vectors here happen to be 2D, with the third slot at 0. Add real third components and nothing about the recipe changes; section four runs a full 3D pair.
| Step | Working | Result |
|---|---|---|
| Dot product | 3 × 5 + 4 × 12 + 0 × 0 | 63 |
| Length of a | √(9 + 16 + 0) | 5 |
| Length of b | √(25 + 144 + 0) | 13 |
| Cosine | 63 ÷ (5 × 13) = 63 ÷ 65 | 0.9692 |
| Angle | arccos(0.9692) | 14.25° = 0.2487 rad |
What the sign of the dot product tells you
Before reaching for arccos, read the sign of the dot product, because it splits all possible angles into three families. A positive dot product means an angle under 90 degrees. Zero means exactly 90 degrees, the perpendicular case. Negative means over 90 degrees. That is why engineering checks start with one multiplication: a dot b of 0 within rounding means right angles.
The extreme values are just as readable. cos θ = 1 means 0 degrees, two arrows on the same ray; cos θ = -1 means 180 degrees, arrows aimed at each other. So (1, 2, 3) and (-2, -4, -6), where the second is -2 times the first, come out at exactly 180 degrees. Anything between those bookends is an ordinary acute or obtuse pair.
| Dot product | Angle | Example |
|---|---|---|
| Positive | under 90° | (2, 1, 0) dot (1, 3, 0) = 5, angle 45.00° |
| Zero | exactly 90° | (3, 4, 0) and (4, -3, 0): dot product 0 |
| Negative | over 90° | (2, 1, 0) and (-3, 1, 0): dot product -5, angle 135.00° |
| cos θ = 1 | 0°, same direction | (1, 2, 3) and (2, 4, 6) |
| cos θ = -1 | 180°, opposite | (1, 2, 3) and (-2, -4, -6) |
One boundary worth knowing: geometry texts sometimes quote the angle between two lines rather than two vectors. Lines have no arrowheads, so their angle is the smaller one, min(θ, 180 − θ). Vectors keep the arrowheads, and this calculator reports the vector angle.
A 3D example with equal lengths
Three-dimensional pairs are where hand arithmetic starts to bite, so here is a clean one. Take a = (1, 2, 2) and b = (-2, 1, 2), chosen because both come out with length 3.
Dot product: 1 × (-2) + 2 × 1 + 2 × 2 = -2 + 2 + 4 = 4. Lengths: |a| = √(1 + 4 + 4) = √9 = 3, and |b| = √(4 + 1 + 4) = √9 = 3. Cosine: 4 ÷ (3 × 3) = 4 ÷ 9 = 0.4444. Angle: arccos(0.4444) = 63.61 degrees, or 1.1102 radians.
Two things to notice. The negative first component of b pulled the dot product down, but not below zero, so the angle landed in the acute family at 63.61 degrees rather than the obtuse one. And because both lengths were 3, the denominator was 9; with other lengths the same dot product of 4 would give a different angle.
| Quantity | Working | Value |
|---|---|---|
| Dot product | 1 × (-2) + 2 × 1 + 2 × 2 | 4 |
| Length of a | √(1 + 4 + 4) | 3 |
| Length of b | √(4 + 1 + 4) | 3 |
| Cosine | 4 ÷ 9 | 0.4444 |
| Angle | arccos(0.4444) | 63.61° = 1.1102 rad |
Degrees, radians and the switch between them
The same angle has two customary clothes. Degrees divide the half circle into 180; radians measure the arc itself, with the full circle at 2π ≈ 6.2832. Code cares, because most languages, including JavaScript and Python, return arccos in radians, and treating that number as degrees is a classic silent bug.
The conversion is one multiplication: radians = degrees × π ÷ 180. Going back, degrees = radians × 180 ÷ π. For the pairs on this page: 14.25 degrees × 0.017453 = 0.2487 radians, and 63.61 degrees comes to 1.1102 radians. The table below lists the reference angles worth memorizing, along with the cosine your dot product would need to produce each one.
| Degrees | Radians | cos θ needed | Meaning |
|---|---|---|---|
| 0° | 0 | 1 | same direction |
| 30° | 0.5236 | 0.8660 | narrow acute pair |
| 45° | 0.7854 | 0.7071 | equal share of a right angle |
| 60° | 1.0472 | 0.5000 | common in force triangles |
| 90° | 1.5708 | 0 | perpendicular |
| 180° | 3.1416 | -1 | opposite directions |
Working backwards is the common exam task: if a dot product and two lengths give cos θ = 0.5000, the angle is 60 degrees without touching a calculator key.
Engineering, physics and 3D graphics uses
Computer graphics is the heaviest industrial user of this calculation. Every shaded pixel involves the angle between a surface normal and the direction to the light: a face whose normal is (0, 1, 0) lit from direction (0.6, 0.8, 0) has dot product 0.8 with both lengths equal to 1, so the angle is 36.87 degrees and the surface receives cos θ = 0.8 of the full brightness. Game engines run the same test millions of times per frame, and the view cone check is the identical formula: a camera looking along (0, 0, 1) at a target in direction (1, 0, 3) sees cos θ = 3 ÷ √10 = 3 ÷ 3.1623 = 0.9487, an angle of 18.43 degrees, inside a 20 degree cone.
Physics uses the angle the same way through work and components. A force F acting through a displacement s delivers W = |F| |s| cos θ of work, so only the share of the force along the motion counts; at 60 degrees that share is exactly half. Structural engineers compare the directions of cable forces the same way: two supports pulling along (3, 0, 4) and (0, 4, 3) both have length 5, their dot product is 12, and the 61.31 degrees between them says how much their pulls reinforce or fight each other.
Search and recommendation systems borrow the geometry under the name cosine similarity: text or user ratings become vectors, and the angle between them grades the match. The pair (2, 1, 0) and (1, 3, 0) gives cos θ = 5 ÷ (2.2361 × 3.1623) = 0.7071, an angle of 45.00 degrees; smaller angle, closer match.
| Field | Vectors compared | Angle | What it decides |
|---|---|---|---|
| 3D lighting | normal (0, 1, 0), light (0.6, 0.8, 0) | 36.87° | brightness, 0.8 of full |
| Camera cone | view (0, 0, 1), target (1, 0, 3) | 18.43° | inside a 20° cone |
| Force directions | cables (3, 0, 4) and (0, 4, 3) | 61.31° | how the load splits |
| Similarity scoring | (2, 1, 0) and (1, 3, 0) | 45.00° | match quality |
Traps: zero vectors, units and rounding slips
- Feeding in the zero vector. A vector of length 0 has no direction, so its angle with anything is undefined. The formulas divide by |a| × |b|, which is 0, and the honest answer is a message, not a number. This calculator reports it instead of printing garbage.
- Mixing degrees and radians in code. Math.acos returns radians. Forgetting the × 180 ÷ π step turns 0.2487 radians into a reported angle of 0.2487 degrees, off by a factor of 57.2958.
- Trusting the cosine past its range. Floating point can hand back cos θ = 1.0000000000000002, and arccos of that is an error rather than an angle. Clamping to the range -1 to 1 first is standard practice; here it makes (1, 2, 3) versus (-2, -4, -6) return a clean 180 degrees instead of crashing.
- Skipping the division by the lengths. The bare dot product of (3, 4, 0) and (5, 12, 0) is 63, which is not an angle, not a cosine, and not unit free. Only after dividing by |a| × |b| does 63 become cos θ = 0.9692.
- Comparing a long vector against a short one and expecting length effects. The formula cancels both lengths. If an answer changes when you double one vector, something else went wrong.
The calculator and neighboring tools
The calculator above runs all five steps at once: enter a and b in two or three dimensions, and it returns the dot product, both lengths, cos θ, and the angle in degrees and radians, plus a one line reading of acute, right or obtuse. For the underlying pieces, the dot product calculator works through the componentwise sum in detail, the vector magnitude calculator handles each square root of summed squares, and the vector addition calculator combines vectors before you compare directions. When you need the part of one vector that lies along the other rather than the angle, the vector projection calculator covers that decomposition, and the arccos calculator converts any cosine from -1 to 1 back into an angle.
Frequently asked questions
What is the formula for the angle between two vectors?
cos θ = (a dot b) ÷ (|a| × |b|), then take arccos. For (3, 4, 0) and (5, 12, 0): 63 ÷ (5 × 13) = 0.9692, so θ = 14.25 degrees.
What does a dot product of 0 mean?
The angle is exactly 90 degrees. For (3, 4) and (4, -3) the products 12 and -12 add to 0, so the two vectors are perpendicular.
What does a negative dot product mean?
The angle is over 90 degrees. The vectors (2, 1, 0) and (-3, 1, 0) have a dot product of -5, and the angle between them is 135 degrees.
How do I convert the angle to radians?
Multiply degrees by π ÷ 180. That maps 14.25 degrees to 0.2487 radians and 90 degrees to 1.5708 radians.
How does it work in 3D?
Same formula, three components. (1, 2, 2) and (-2, 1, 2) give dot 4, lengths 3 and 3, cos θ = 0.4444, angle 63.61 degrees.
What if one vector is the zero vector?
The angle is undefined, because a vector of length 0 has no direction. The calculator reports that instead of printing a number.
When are two vectors parallel?
When cos θ = 1 (0 degrees) or cos θ = -1 (180 degrees). (1, 2, 3) and (-2, -4, -6) point in opposite directions, 180 degrees apart.
Why is the answer always between 0 and 180 degrees?
Arccos only covers 0 to 180. Two vectors share a plane, and the angle between their directions fits inside it, never more than a half turn.
Is this the same as cosine similarity?
Cosine similarity is cos θ itself. (2, 1, 0) and (1, 3, 0) have cosine similarity 0.7071, an angle of 45 degrees; a smaller angle means a closer match.
Do the two lengths need to be equal?
No. (1, 2, 2) and (-2, 1, 2) both have length 3, but (3, 4, 0) and (5, 12, 0) have lengths 5 and 13, and the formula divides them away either way.
Why does the calculator clamp the cosine?
Floating point can produce 1.0000000000000002, and arccos of that is an error. Clamping to -1 through 1 returns a clean 0 or 180 degrees instead.
Which angle goes into the work formula?
The angle between the force and the displacement. W = |F| |s| cos θ, so a force acting at 60 degrees to the motion delivers cos 60 = 0.5 of its full push.
Does the order of the vectors matter?
No. a dot b = b dot a and |a| × |b| = |b| × |a|, so swapping the two vectors leaves the angle unchanged.
Spotted a wrong number or a broken result?
More Math tools
Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.